[keycloak-user] Upgrading 3.4.3 to 4.1
Cédric Couralet
cedric.couralet at gmail.com
Thu Aug 2 04:21:05 EDT 2018
Hello,
>From the migrating doc, I think it was intended
(https://www.keycloak.org/docs/latest/upgrading/index.html#client-templates-changed-to-client-scopes).
I used a bit of code with keycloak admin client to set a client scope
to all client (except default) for a given realm:
"
Keycloak keycloak = Keycloak.getInstance("https://<keycloak>",
"master", "admin", "************************************",
"admin-cli");
List<String> defaultClients = Arrays.asList("account",
"broker", "admin-cli", "realm-management",
"security-admin-console");
List<String> defaultScope = Arrays.asList("profile", "email");
List<ClientScopeRepresentation> defaultScopes =
keycloak.realm(realmName).clientScopes().findAll().stream()
.filter(c ->
defaultScope.contains(c.getName())).collect(Collectors.toList());
keycloak.realm(realmName).clients().findAll(true).forEach(client -> {
if (!defaultClients.contains(client.getClientId()) &&
client.getDefaultClientScopes().isEmpty()) {
client.setDefaultClientScopes(defaultScope);
defaultScopes.forEach(scope -> {
keycloak.realm(realmName).clients().get(client.getId()).addDefaultClientScope(scope.getId());
});
}
});
"
Le jeu. 2 août 2018 à 09:48, Eivind Larsen <eivind at jotta.no> a écrit :
>
> Hi Keycloak users!
>
> After upgrading from 3.4.3 to 4.x, client templates are converted to client
> scopes. The conversion of the templates themselves look correct.
>
> Many clients had a default template set. After upgrade the corresponding
> default template is not included in the default scopes of the client.
>
> Is this intended? Do we have to manually update each client with the
> default scope?
> Is there a way to add the default scopes using the API?
>
> Best regards,
> Eivind Larsen
> _______________________________________________
> keycloak-user mailing list
> keycloak-user at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-user
More information about the keycloak-user
mailing list