JWTToObject
Goodday,
I would like to Validate token signature with public key i have in pem format, i am using below code but i get error message. Could you please tell me what i am doing not right? FOUT #5002: Caché fout : <DIRECTORY>zLinkToFile+2^%Stream.FileBinary.1 *-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMI ...
hier is my code
Method ValidateTokenWithPublicKey(jwt As %String) As %String
{
Set tFile=##Class(%File).%New("c:\Kety\publicKey.pem")
Do tFile.Close()
Set tStatus=tFile.Open("RU")
$$$ThrowOnError(tStatus)
Set tPublicKey=tFile.Read()
Do tFile.Close()
set sc = ##class(%OAuth2.JWT).JWTToObject(jwt,,tPublicKey,.JOSE,.Body)
if ('sc){
set errMsg = $System.Status.GetErrorText(sc)
$$$TRACE(..classId _ "- Error validateJWT:" _ errMsg)
}
$$$TRACE(..classId _ "- validateJWT:" _ JOSE)
}
Kind Regards
Ed
The <DIRECTORY> error means that the directory or file couldn't be found. Make sure IRIS has access to this file.