Alternative for deprecated method TokenVerifier.realmUrl()

56 views
Skip to first unread message

Ganesh Dhongade

unread,
Sep 23, 2021, 6:38:55 AM9/23/21
to Keycloak User
Hello Team,

I am trying to verify the AccessToken using below code -

TokenVerifier<AccessToken> verifier = TokenVerifier.create(StringAccessToken, AccessToken.class).withDefaultChecks();
PublicKey publicKey = getRealmPublicKey(verifier.getHeader());
return verifier.realmUrl("someStringUrl").publicKey(publicKey).verify().getToken();

But seems a realmUrl() method is deprecated. Can you please help with alternative solution for this?

or can you suggest an effective way to verify access token ?

Thank you,
Ganesh Dhongade

Thomas Darimont

unread,
Sep 23, 2021, 7:04:24 AM9/23/21
to Ganesh Dhongade, Keycloak User
Hello Ganesh,

take a look at org.keycloak.TokenVerifier#withChecks which takes predicates for token validation.
The realm check is performed by org.keycloak.TokenVerifier.RealmUrlCheck

Cheers,
Thomas

--
You received this message because you are subscribed to the Google Groups "Keycloak User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to keycloak-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/keycloak-user/ed19a0be-a058-48e7-b038-f2201ee0b65an%40googlegroups.com.

Ganesh Dhongade

unread,
Sep 23, 2021, 9:13:12 AM9/23/21
to Keycloak User
Hello  Thomas,

Thank you for the reply.
It helped.

Regards,
Ganesh
Reply all
Reply to author
Forward
0 new messages