JWT Middleware

Hi,

I am currently using this in my XData Server and it works perfectly. I am setting a claim which is the user's GUID as follows.

  JWT:=TJWT.Create(TJWTClaims);
  JWT.Claims.Issuer:='EAP Cloud';
  JWT.Claims.SetClaimOfType<TGUID>('UserGUID',UserGUID);
  JWT.Claims.Expiration:=Now+1;

I now need to access this UserGUID n a TAureliusModelEvents.OnUpdated event. I have tried using:

User:=TXDataOperationContext.Current.Request.User;
if User.Claims.Exists('UserGUID') then

but it is not found. How can I do this?

Thanks,

Ken

I've not used TGUID in a JWT.Claims list. What if you write the GUID to a string in the claims and convert it when you need it?

2 Likes

That works thanks. I should have thought of that myself!

2 Likes

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.