Rechercher

Question
· Oct 16, 2024

JWT Signature Creation for OAuth Call

Working on a project where I'm needing to make FHIR calls from my HealthConnect Interop production to Epic. 

My issue is I'm not able to construct a valid JWT for the OAuth token retrieval that Epic will accept. I have the below code where I'm able to create a valid header and payload that I'm base64URL encoding and then trying to sign with my .pem private key file. However, Epic is not liking the signature portion of my JWT.

As such, I wanted to present my code to see if I'm performing the signature steps correctly? I've seen some posts where the %Net.JSON JWT specific classes were used to generate the token, but I am thinking this method should work?

Any thoughts on this issue, or insight from other folks who have made OAuth calls from HealthConnect to Epic before, would be greatly appreciated! 

 

ClassMethod CreateJWT(pHostIn As %String) As Epic.Utils.JWTHeader
{
        
//Set Headers using message class I created.
set Header = ##class(Epic.Utils.JWTHeader).%New()
set Header.alg = "RS384"
Set Header.typ = "JWT"

//Set Epic payload values using message class I created.
Set Payload = ##class(Epic.Utils.JWTPayload).%New()
Set Payload.iss = "<Client ID>"
set Payload.sub = "<Client ID>"
set Payload.aud = pHostIn
Set Payload.jti = $SYSTEM.Util.CreateGUID()
Set Payload.exp = ##class(%Library.UTC).SecondsSinceUnixEpoch($ztimestamp)+3500

//Convert the Header and Payload JSON to stings.
do Header.%JSONExportToString(.HeaderString)
do Payload.%JSONExportToString(.PayloadString)

//Concat the Header and Payload together with period and Base64URL encode them.
set PayloadToSign = $$$BASE64URLENCODE(HeaderString)_"."_$$$BASE64URLENCODE(PayloadString)

//Open the private key pem file to be used for the RSA signature.
Set File=##class(%Stream.FileBinary).%New()
set File.Filename = "/PrivateKey.pem"
set PVKey = File.Read($$$MaxLocalLength)

//sign the concatenated Header and Payload using the PVKey from the file.
Set RSASig=##class(%SYSTEM.Encryption).RSASHASign(384,PayloadToSign,PVKey)

//Base64URL encode the returned RSA signature.
set Signature = $$$BASE64URLENCODE(RSASig)

//Concat the original Header/Payload string with the Base64URL encoded signature.
Set JWT = PayloadToSign_"."_Signature

//Return the fully constructed JWT for the token call.
       Quit JWT
}

1 Comment
Discussion (1)1
Connectez-vous ou inscrivez-vous pour continuer
Article
· Oct 16, 2024 2m de lecture

configuração do recurso de Python Flexível em Tempo de Execução no IRIS 2024.2

Olá Comunidade,

Este artigo tem como objetivo guiá-lo pelo processo de configuração e utilização do recurso Python Runtime Flexível para Python embutido. Antes da versão 2024.2, o instalador do InterSystems IRIS incluía uma versão pré-instalada do Python. Você pode encontrar as bibliotecas Python e os arquivos de aplicação localizados no diretório \lib\python dentro da sua pasta de instalação do IRIS (por exemplo, C:\InterSystems\IRIS20242\lib\python).

No entanto, a partir da versão 2024.2, o instalador do IRIS não mais inclui a instalação do Python por padrão. Consequentemente, você não encontrará esses arquivos no diretório mencionado. É necessário que você instale a versão necessária do Python para trabalhar eficazmente com Python embutido no IRIS.

Vamos proceder à configuração do recurso runtime flexível dentro do meu ambiente IRIS.

Eu instalei a versão comunitária 2024.2 na minha máquina e tentei conectar o shell python imediatamente no terminal IRIS.

USER>Write $ZV
IRIS for Windows (x86-64) 2024.2 (Build 247U) Tue Jul 16 2024 09:57:03 EDT
USER>Do $SYSTEM.Python.Shell()
ERROR #5002: ObjectScript error: <OBJECT DISPATCH>Shell+16^%SYS.Python.1 *Failed to Load Python: Check documentation and messages.log, Check CPF parameters:[PythonRuntimeLibrary,PythonRuntimeLibraryVersion], Check sys.path setup in: $INSTANCE/lib/python/iris_site.py.

Ele lança um erro devido à configuração ausente dos valores PythonRuntimeLibrary  e PythonRuntimeLibraryVersion (nota: eu já defini a versão PythonRuntimeLibraryVersion)

Agora, eu já instalei o python 3.12.5 no meu sistema e configurei os valores nas configurações.

PythonRuntimeLibrary  - “C:\Program Files\Python312\python3.dll”
PythonRuntimeLibraryVersion - 3.12

Depois de configurado, executei o Do $SYSTEM.Python.Shell() novamente e consegui entrar no shell Python com sucesso.

Observação: O recurso de tempo de execução flexível do Python, de acordo com a documentação, não é suportado para todos os sistemas operacionais.

Discussion (0)1
Connectez-vous ou inscrivez-vous pour continuer
Question
· Oct 16, 2024

Web gateway and management portal configuration in Mirrored environment

Is it possible to use one IIS server to configure Webgateway and external Webserver for management portal when implementing synchronous mirroring with VIP  i.e Is it necessary to have two mirror servers(primary and Backup) , one Arbiter server, one Webserver for Webgateway and a sperate webserver for management portal? 

If anyone can please point to any documentation on Mirroring with Webgateway and external webserver for management  portal will be really helpful. 

 

Thank you for your help

6 Comments
Discussion (6)2
Connectez-vous ou inscrivez-vous pour continuer
Question
· Oct 16, 2024

File generation issues while using $ZF(-100 asynchronously

Hello Community,

We use $ZF(-1 synchronous call to generate the pdf files. Now I want to change to asynchronously. So, I use $ZF(-100 with "/ASYNC" function. I use "/ASYNC" directly write $ZF(-100,"/ASYNC","notepad.exe") in windows/linux it throws the <NOTOPEN> error, However If I use $ZF(-100,"/ASYNC /SHELL","notepad.exe") it opens the notepad without issues.

However, I execute the below in Linux system the file is not generated properly. But  $ZF(-2,"/ASYNC /SHELL", " /fop/fop -r -fo ""/grp1/tempXSL-FO.TT.12.xml"" -pdf ""/grp1/tempXSL-FO.TT.12.pdf"" 1>/dev/null 2>""/grp1/tempXSL-FO.TT.12.err"" ") this works

write $ZF(-100,"/ASYNC /SHELL", " /fop/fop -r -fo ""/grp1/tempXSL-FO.TT.12.xml"" -pdf ""/grp1/tempXSL-FO.TT.12.pdf"" 1>/dev/null 2>""/grp1/tempXSL-FO.TT.12.err"" ")

Thanks!

Discussion (0)1
Connectez-vous ou inscrivez-vous pour continuer
Article
· Oct 16, 2024 2m de lecture

Funciones del "Lado Izquierdo" en ObjectScript

En ObjectScript, tenéis una amplia colección de funciones que devuelven algún valor, típicamente:

set variable = $somefunction(param1,param2, ...)

No hay nada especial en eso.  
Pero hay un conjunto de funciones que clasifico como del LADO IZQUIERDO.  
La especialidad de ellas es que también podéis usarlas a la izquierda del operador igual como un objetivo en el comando SET:

set $somefunction(param1,param2, ...) = value

La razón para plantear ese tema es que con IRIS 2024.1, después de muchos años, hay un "chico nuevo en el barrio".

$VECTOR()

Asigna, devuelve y elimina datos de vectores en posiciones específicas, especialmente.
set $VECTOR(MyVector , position , type) = value

No quiero entrar en detalles. La documentación es realmente completa.  
También hay 3 nuevas funciones relacionadas con vectores del lado derecho.
$VECTORDEFINED (),  $VECTOROP(), $ISVECTOR() 

Encontráis la descripción siguiendo los enlaces.

Si seguís los ejemplos en la documentación, veréis que la nueva función SQL relacionada TO_VECTOR() hace prácticamente lo mismo en notación SQL (de hecho, es visible en la referencia SQL de InterSystems).

Como recordatorio / resumen, una lista de las funciones tradicionales del lado izquierdo:

  • $BIT – Devuelve o establece el valor de un bit en una posición especificada en un bitstring.
  • $EXTRACT – Extrae una subcadena de una cadena de caracteres por posición, o reemplaza una subcadena por posición.
  • $LIST – Devuelve o reemplaza elementos en una lista.
  • $PIECE – Devuelve o reemplaza una subcadena, utilizando un delimitador.
  • $WEXTRACT – Extrae una subcadena de una cadena de caracteres por posición, o reemplaza una subcadena por posición, reconociendo pares de sustitución.

Es una lista corta, pero puede ser muy eficiente en algunos casos para evitar contenido duplicado y manipulaciones confusas.

1 Comment
Discussion (1)1
Connectez-vous ou inscrivez-vous pour continuer