Search in sources :

Example 1 with MapUserConsentEntity

use of org.keycloak.models.map.user.MapUserConsentEntity in project keycloak by keycloak.

the class MapFieldPredicates method getUserConsentClientFederationLink.

private static MapModelCriteriaBuilder<Object, MapUserEntity, UserModel> getUserConsentClientFederationLink(MapModelCriteriaBuilder<Object, MapUserEntity, UserModel> mcb, Operator op, Object[] values) {
    String providerId = ensureEqSingleValue(UserModel.SearchableFields.CONSENT_CLIENT_FEDERATION_LINK, "provider_id", op, values);
    String providerIdS = new StorageId((String) providerId, "").getId();
    Function<MapUserEntity, ?> getter;
    getter = ue -> Optional.ofNullable(ue.getUserConsents()).orElseGet(Collections::emptySet).stream().map(MapUserConsentEntity::getClientId).anyMatch(v -> v != null && v.startsWith(providerIdS));
    return mcb.fieldCompare(Boolean.TRUE::equals, getter);
}
Also used : MapScopeEntity(org.keycloak.models.map.authorization.entity.MapScopeEntity) Arrays(java.util.Arrays) MapClientScopeEntity(org.keycloak.models.map.clientscope.MapClientScopeEntity) MapRoleEntity(org.keycloak.models.map.role.MapRoleEntity) MapResourceServerEntity(org.keycloak.models.map.authorization.entity.MapResourceServerEntity) SearchableModelField(org.keycloak.storage.SearchableModelField) MapRealmEntity(org.keycloak.models.map.realm.MapRealmEntity) AuthenticatedClientSessionModel(org.keycloak.models.AuthenticatedClientSessionModel) Map(java.util.Map) ClientScopeModel(org.keycloak.models.ClientScopeModel) RealmModel(org.keycloak.models.RealmModel) IdentityHashMap(java.util.IdentityHashMap) Predicate(java.util.function.Predicate) Collection(java.util.Collection) RoleModel(org.keycloak.models.RoleModel) CriterionNotSupportedException(org.keycloak.models.map.storage.CriterionNotSupportedException) Objects(java.util.Objects) Operator(org.keycloak.models.map.storage.ModelCriteriaBuilder.Operator) List(java.util.List) AbstractEntity(org.keycloak.models.map.common.AbstractEntity) Stream(java.util.stream.Stream) RootAuthenticationSessionModel(org.keycloak.sessions.RootAuthenticationSessionModel) MapResourceEntity(org.keycloak.models.map.authorization.entity.MapResourceEntity) MapUserLoginFailureEntity(org.keycloak.models.map.loginFailure.MapUserLoginFailureEntity) Optional(java.util.Optional) MapRootAuthenticationSessionEntity(org.keycloak.models.map.authSession.MapRootAuthenticationSessionEntity) ClientModel(org.keycloak.models.ClientModel) Scope(org.keycloak.authorization.model.Scope) MapPermissionTicketEntity(org.keycloak.models.map.authorization.entity.MapPermissionTicketEntity) HashMap(java.util.HashMap) MapUserSessionEntity(org.keycloak.models.map.userSession.MapUserSessionEntity) Function(java.util.function.Function) StorageId(org.keycloak.storage.StorageId) PermissionTicket(org.keycloak.authorization.model.PermissionTicket) UserModel(org.keycloak.models.UserModel) QueryParameters(org.keycloak.models.map.storage.QueryParameters) GroupModel(org.keycloak.models.GroupModel) MapPolicyEntity(org.keycloak.models.map.authorization.entity.MapPolicyEntity) ResourceServer(org.keycloak.authorization.model.ResourceServer) UserLoginFailureModel(org.keycloak.models.UserLoginFailureModel) CORRESPONDING_SESSION_ID(org.keycloak.models.UserSessionModel.CORRESPONDING_SESSION_ID) UserSessionModel(org.keycloak.models.UserSessionModel) MapClientEntity(org.keycloak.models.map.client.MapClientEntity) MapUserEntity(org.keycloak.models.map.user.MapUserEntity) Policy(org.keycloak.authorization.model.Policy) UpdatePredicatesFunc(org.keycloak.models.map.storage.chm.MapModelCriteriaBuilder.UpdatePredicatesFunc) MapUserConsentEntity(org.keycloak.models.map.user.MapUserConsentEntity) MapAuthenticatedClientSessionEntity(org.keycloak.models.map.userSession.MapAuthenticatedClientSessionEntity) Comparator(java.util.Comparator) Collections(java.util.Collections) Resource(org.keycloak.authorization.model.Resource) MapGroupEntity(org.keycloak.models.map.group.MapGroupEntity) MapUserConsentEntity(org.keycloak.models.map.user.MapUserConsentEntity) Collections(java.util.Collections) StorageId(org.keycloak.storage.StorageId) MapUserEntity(org.keycloak.models.map.user.MapUserEntity)

Aggregations

Arrays (java.util.Arrays)1 Collection (java.util.Collection)1 Collections (java.util.Collections)1 Comparator (java.util.Comparator)1 HashMap (java.util.HashMap)1 IdentityHashMap (java.util.IdentityHashMap)1 List (java.util.List)1 Map (java.util.Map)1 Objects (java.util.Objects)1 Optional (java.util.Optional)1 Function (java.util.function.Function)1 Predicate (java.util.function.Predicate)1 Stream (java.util.stream.Stream)1 PermissionTicket (org.keycloak.authorization.model.PermissionTicket)1 Policy (org.keycloak.authorization.model.Policy)1 Resource (org.keycloak.authorization.model.Resource)1 ResourceServer (org.keycloak.authorization.model.ResourceServer)1 Scope (org.keycloak.authorization.model.Scope)1 AuthenticatedClientSessionModel (org.keycloak.models.AuthenticatedClientSessionModel)1 ClientModel (org.keycloak.models.ClientModel)1