Encontrar

Question
· Apr 1

GENERATE JWT / OAUTH2.0 SIGNATURE

 JSON Web Token (JWT) Authentication

Hi Everyone,

I would like to share the code and step-by-step instructions/or guideline for generating a JWT (JSON Web Token) signature, as well as how to test it using Postman / HealthConnect.

JWT is an open standard (RFC 7519) that defines a compact, URL-safe method for securely transmitting information between parties in the form of a JSON object.

Structure of a JWT:

A JWT consists of three parts, separated by dots (.):

Header

.

Payload

.

Signature

 

  1. Header: The header contains about the token, specifying its type and the signing algorithm used. It typically includes the following fields:
  • alg (Algorithm): Defines the signing algorithm (e.g., HMAC SHA256, RSA, etc.).
  • typ (Type): Specifies the token type, which is always JWT.
  • kid (Key ID): Identifies the key used for signature verification.

Example:

{

  "alg": "HS256",  

  "typ": "JWT",

   “kid”: “my-key”

}

 

  1. Payload: The payload contains the claims. It typically includes the following fields:
  • iss  -(Issuer) – Issuer of the token.
  • Sub - (Subject) – Subject of the JWT (user identifier).
  • Aud - (Audience) – Intended recipient of the token (JWT).
  • Exp - (Expiration time) – Token expiry timestamp.
  • jti – (Unique) - Token identifier.
  • iat  - (Issued At) – When the token was created.
  • etc

Example:

{

  "iss": "your issuer",

   "sub": "your subject",

   "aud": “your audience”,

   “jti”: “your jti”,

  “exp”: “your expiry time”

}

  1. Signature: it is created by encoding the header and payload, then signing them using a private or secret key. It ensures the integrity and authenticity of the token.

Signature= header + payload and a private or secret key

Example:

{

 HMACSHA256( base64UrlEncode(header) +

"."

+  base64UrlEncode(payload),

secret key)

}

Example: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJVadQssw5c

PROCESS

Step 1: Generate Public and Private Keys

To generate a public-private key pair, you can use either OpenSSL or an online JSON Web Key (JWK) generator like mkjwk.

Using mkjwk (JSON Web Key Generator): mkjwk - JSON Web Key Generator

  • Open the mkjwk tool.
  • Set the following parameters:
    • Key Size: Based on your requirements (e.g., 4096 bits).
    • Key Use: Signature.
    • Algorithm: Select the desired algorithm (e.g., RS512).
    • Key ID (kid): Choose a name for the key identifier (this key value is required for code, see screenshot -1, below.).
    • Show X.509 Certificate: Enable this option to generate an X.509 certificate if needed (e.g. “Yes”)
  • This will generate both a public key and a private key for signing and verification.

 

Step 2: Generate and Sign a JWT Using Cache Object Script

The code implementation for this process is provided in Screenshot 1 below.

Screenshot 1: Cache Object Script Code

 

Step 3: Execute the Method – see screenshot 2 below.

Screenshot 2 – Method Execution.

 

Step 4: After executing the method in Step 3, copy the Base64-encoded output from the result displayed in Screenshot 2.

Step 5: Test in Postman - Follow these steps to send a request using Postman:

  1. Open Postman (if you don’t have it, just download and install it)
  2. Select the “POST” method and enter the appropriate “URL”.
  3. Navigate to the “Body” section, then add the required key-value pairs (needed to set up the key and value)
  4. In the "client_assertion" field, paste the Base64-encoded data from Step 4.
  5. Then “Send” to submit the request.

You should receive a response containing the access_token, expiration time, and other details based on - setup.

Screenshot 3: Postman Output

 

I hope this guide helps you. Once you have successfully generated and tested the JWT, you can proceed with configuring it in the HealthConnect Management Portal based on your requirements.

Thank you.

Discussion (0)1
Log in or sign up to continue
Article
· Apr 1 19m read

Virtualização de grandes bancos de dados - Planejamento de capacidade de CPU VMware

Frequentemente, clientes, fornecedores ou equipes internas me pedem para explicar o planejamento de capacidade de CPU para para grandes bancos de dados de produção rodando no VMware vSphere.

Em resumo, existem algumas práticas recomendadas simples a seguir para dimensionar a CPU para grandes bancos de dados de produção:

Discussion (0)1
Log in or sign up to continue
Announcement
· Apr 1

¡El jueves tenemos webinar! "Conectando sensores con InterSystems IRIS"

Hola a todos... ¡Aún con la resaca del Meetup? 

Os esperamos en el webinar gratuito que tenemos el jueves a las 16.00 CEST. Jairo nos hará una demostración práctica de algo que conecta InterSystems con deporte y con datos en tiempo real... ¡Preparaos para flipar!

 

Webinar dirigido a Desarrolladores, analistas de integración y todos aquellos interesados en las posibilidades de la tecnología InterSystems :)

¡Os esperamos!

🗣 Ponente: , Jairo Ruiz Sales Engineer en InterSystems Colombia

➡️ Registro >>

Discussion (0)1
Log in or sign up to continue
Digest
· Apr 1

Résumé de la communauté des développeurs d'InterSystems, Mars 2025

Bonjour, voici la newsletter de la communauté des développeurs de Mars 2025.
Statistiques générales
✓ Nouvelles publications 20 publiées le Mars :
 9 nouveaux articles
 9 nouvelles annonces
 2 nouvelles questions
✓ Nouveaux membres 2 ayant rejoint le Mars
✓ Publications 1,133 publiées depuis le début
✓ Membres 166 ayant rejoint depuis le début
Meilleures publications
Les meilleurs auteurs du mois
Articles
Annonces
#InterSystems IRIS
#Communauté des développeurs officielle
Questions
Mars, 2025Month at a GlanceInterSystems Developer Community
Article
· Apr 1 1m read

Cómo obtener información del servidor/instancia

Hola a todos,

Como parte del desarrollo de una API para saber a qué instancia de IRIS está conectada, he encontrado algunos métodos para obtener información sobre el servidor que pueden ser útiles.

Obtener el nombre del servidor: $SYSTEM.INetInfo.LocalHostName()

Obtener la IP del servidor: $SYSTEM.INetInfo.HostNameToAddr($SYSTEM.INetInfo.LocalHostName())

Obtener el nombre de la instancia: $PIECE($SYSTEM,":",2)

Entonces, he creado el siguiente código como clase BS:

Class St.Common.Api Extends (%CSP.REST, Ens.BusinessService)
{
{

XData UrlMap [ XMLNamespace = "http://www.intersystems.com/urlmap" ]
{
<Routes>
	<Route Url="/check" Method="GET" Call="Check"/>
</Routes>
}

ClassMethod Check() As %Status
{
	set serverInfo = {}
	set serverInfo.ServerName = $SYSTEM.INetInfo.LocalHostName()
	set serverInfo.ServerIP = $SYSTEM.INetInfo.HostNameToAddr($SYSTEM.INetInfo.LocalHostName())
	set serverInfo.Instance = $PIECE($SYSTEM,":",2)
	
	write serverInfo.%ToJSON()
	quit $$$OK
}
}

Llamando al método:

localhost:52773/common/api/check

{
  "ServerName": "LAPTOP-KURRO-3",
  "ServerIP": "11.52.197.99",
  "Instance": "HEALTHCONNECT"
}

Espero que te sea tan útil como a mí.

Saludos cordiales.

Discussion (0)1
Log in or sign up to continue