|
List< ProviderConfigProperty > | getConfigProperties () |
|
String | getId () |
|
String | getDisplayType () |
|
String | getDisplayCategory () |
|
String | getHelpText () |
|
String | getProtocol () |
|
void | close () |
|
final ProtocolMapper | create (KeycloakSession session) |
|
void | init (Config.Scope config) |
|
void | postInit (KeycloakSessionFactory factory) |
|
AccessToken | transformUserInfoToken (AccessToken token, ProtocolMapperModel mappingModel, KeycloakSession session, UserSessionModel userSession, AuthenticatedClientSessionModel clientSession) |
|
AccessToken | transformUserInfoToken (AccessToken token, ProtocolMapperModel mappingModel, KeycloakSession session, UserSessionModel userSession, AuthenticatedClientSessionModel clientSession) |
|
AccessToken | transformAccessToken (AccessToken token, ProtocolMapperModel mappingModel, KeycloakSession session, UserSessionModel userSession, AuthenticatedClientSessionModel clientSession) |
|
AccessToken | transformAccessToken (AccessToken token, ProtocolMapperModel mappingModel, KeycloakSession session, UserSessionModel userSession, AuthenticatedClientSessionModel clientSession) |
|
IDToken | transformIDToken (IDToken token, ProtocolMapperModel mappingModel, KeycloakSession session, UserSessionModel userSession, AuthenticatedClientSessionModel clientSession) |
|
IDToken | transformIDToken (IDToken token, ProtocolMapperModel mappingModel, KeycloakSession session, UserSessionModel userSession, AuthenticatedClientSessionModel clientSession) |
|
default void | validateConfig (KeycloakSession session, RealmModel realm, ProtocolMapperContainerModel client, ProtocolMapperModel mapperModel) throws ProtocolMapperConfigException |
|
default int | order () |
|
|
static ProtocolMapperModel | create (String clientId, String clientRolePrefix, String name, String tokenClaimName, boolean accessToken, boolean idToken) |
|
static ProtocolMapperModel | create (String clientId, String clientRolePrefix, String name, String tokenClaimName, boolean accessToken, boolean idToken, boolean multiValued) |
|
static Stream< RoleModel > | getAllUserRolesStream (UserModel user) |
|
Allows mapping of user client role mappings to an ID and Access Token claim.
- 著者
- Thomas Darimont
|
inlinestaticprotectedinherited |
Retrieves all roles of the current user based on direct roles set to the user, its groups and their parent groups. Then it recursively expands all composite roles, and restricts according to the given predicate
. If the current client sessions is restricted (i.e. no client found in active user session has full scope allowed), the final list of roles is also restricted by the client scope. Finally, the list is mapped to the token into a claim.
- 引数
-
token | |
mappingModel | |
userSession | |
restriction | |
prefix | |
90 String rolePrefix = prefix == null ?
"" : prefix;
91 UserModel user = userSession.getUser();
96 boolean dontLimitScope = userSession.getAuthenticatedClientSessions().values().stream().anyMatch(cs -> cs.getClient().isFullScopeAllowed());
97 if (! dontLimitScope) {
98 Set<RoleModel> clientRoles = userSession.getAuthenticatedClientSessions().values().stream()
99 .flatMap(cs -> cs.getClient().getScopeMappings().stream())
100 .collect(Collectors.toSet());
102 clientUserRoles = clientUserRoles.filter(clientRoles::contains);
105 List<String> realmRoleNames = clientUserRoles
106 .map(m -> rolePrefix + m.getName())
107 .collect(Collectors.toList());
109 Object claimValue = realmRoleNames;
111 boolean multiValued =
"true".equals(mappingModel.getConfig().get(ProtocolMapperUtils.MULTIVALUED));
113 claimValue = realmRoleNames.toString();
116 OIDCAttributeMapperHelper.mapClaim(token, mappingModel, claimValue);
static Stream< RoleModel > getAllUserRolesStream(UserModel user)
Definition: AbstractUserRoleMappingMapper.java:52