Support to scope definition when using KeycloakInstalled (desktop usage)
See original GitHub issueDescription
If you want to secure java desktop applications, the documentation recommendation is that you can use org.keycloak.keycloak-installed-adapter
. Nonetheless, there aren’t any way to define scopes (or if there is, it isn’t documented).
Discussion
No response
Motivation
No response
Details
Currently, to define custom scopes, you’re need to reimplement KeycloakInstalled
.
I made this following modifications: Replace this following lines: https://github.com/keycloak/keycloak/blob/c31d37ddf1c3e3529e761800a6842fdbf25ba931/adapters/oidc/installed/src/main/java/org/keycloak/adapters/installed/KeycloakInstalled.java#L241 https://github.com/keycloak/keycloak/blob/c31d37ddf1c3e3529e761800a6842fdbf25ba931/adapters/oidc/installed/src/main/java/org/keycloak/adapters/installed/KeycloakInstalled.java#L468 to this one:
.queryParam(OAuth2Constants.SCOPE, Optional.ofNullable(deployment.getScope()).orElse(OAuth2Constants.SCOPE_OPENID))
And, when specify the scope,
keycloak = new MyCustomKeycloakInstalled(targetStream);
keycloak.setLocale(Locale.getDefault());
keycloak.getDeployment().setScope(OAuth2Constants.SCOPE_OPENID + " mycustomscope");
Probably a better alternative is using keycloak.json
configuration file. But unfortunately Jackson Parser throws an exception.
Issue Analytics
- State:
- Created a year ago
- Comments:6 (4 by maintainers)
Looks like a valid requirement. We can probably just add a
setScope
method to do that, right?If you are able to send a PR, I’m glad to review and merge.
Cool, I added a PR a few days ago. Have a look when you have time.