Hi,
thx. with the provided links I was able modify code to call my keycloak.
for others this code on client worked for me:
AuthenticationConfiguration authenticationConfiguration = AuthenticationConfiguration.empty()
.useProviders(() -> new Provider[] { new WildFlyElytronSaslOAuth2Provider() })
.useCredentials(OAuth2CredentialSource.builder(new URL("http://localhost:8888/auth/realms/VIVAVIS/protocol/openid-connect/token"))
.useResourceOwnerPassword(login, password)
.clientCredentials("hlen", "dont_tell_me")
.build());
AuthenticationContext authenticationContext = AuthenticationContext.empty()
.with(MatchRule.ALL.matchHost(host),
authenticationConfiguration.setSaslMechanismSelector(SaslMechanismSelector.NONE.addMechanism("OAUTHBEARER")))
.with(MatchRule.ALL.matchHost("localhost").matchPort(8888).matchPath("/auth/realms/my_realm/protocol/openid-connect/token"),
AuthenticationConfiguration.empty()
.useName(login)
.usePassword(password));
AuthenticationContext.getContextManager().setGlobalDefault(authenticationContext);
and this I have in server configuration
<token-realm name="OAuth2Realm" principal-claim="preferred_username">
<oauth2-introspection client-id="hlen"
client-secret="dont_tell_me"
introspection-url="http://localhost:8888/auth/realms/my_realm/protocol/openid-connect/token/introspect"
client-ssl-context="LocalhostSslContext"
host-name-verification-policy="ANY" />
</token-realm>
<distributed-realm name="hlen-realm" realms="OAuth2Realm wincorejdbc-realm jdbc-internal-realm"/>
</security-realms>
just what confuse me is that OAuth2CredentialSource is deprecated but without some more info why.
Another question is how could mask client_secret. in server xml file we use MASK-XXXX format but what I understood from docu, clientMaskedCredentials are different and not possible generate it via elytron_tool.bat this tool generate old picket box compatible masked password.
I'm right or not?
And now I'm finding that roles are not propagated from introspection
introspection endpoint return in json my defined roles in this property:
"resource_access": {
"hlen": {
"roles": [
"guest"
]
},
"account": {
"roles": [
"manage-account",
"manage-account-links",
"view-profile"
]
}
},
but RolesAllowedInterpector returns for category ejb value NONE.
I think that missing is some role mapper or decoder but can't find any existing.
Dne úterý 24. května 2022 v 19:49:40 UTC+2 uživatel Farah Juma napsal: