Search in sources :

Example 6 with GroupMappingEntity

use of io.gravitee.rest.api.model.configuration.identity.GroupMappingEntity in project gravitee-management-rest-api by gravitee-io.

the class OAuth2AuthenticationResourceTest method mockWrongELGroupsMapping.

private void mockWrongELGroupsMapping() {
    GroupMappingEntity condition1 = new GroupMappingEntity();
    condition1.setCondition("Some Soup");
    condition1.setGroups(Arrays.asList("Example group", "soft user"));
    identityProvider.getGroupMappings().add(condition1);
    GroupMappingEntity condition2 = new GroupMappingEntity();
    condition2.setCondition("{#jsonPath(#profile, '$.identity_provider_id') == 'idp_6'}");
    condition2.setGroups(Collections.singletonList("Others"));
    identityProvider.getGroupMappings().add(condition2);
    GroupMappingEntity condition3 = new GroupMappingEntity();
    condition3.setCondition("{#jsonPath(#profile, '$.job_id') != 'API_BREAKER'}");
    condition3.setGroups(Collections.singletonList("Api consumer"));
    identityProvider.getGroupMappings().add(condition3);
}
Also used : GroupMappingEntity(io.gravitee.rest.api.model.configuration.identity.GroupMappingEntity)

Example 7 with GroupMappingEntity

use of io.gravitee.rest.api.model.configuration.identity.GroupMappingEntity in project gravitee-management-rest-api by gravitee-io.

the class UserServiceTest method mockGroupsMapping.

private void mockGroupsMapping() {
    GroupMappingEntity condition1 = new GroupMappingEntity();
    condition1.setCondition("{#jsonPath(#profile, '$.identity_provider_id') == 'idp_5' && #jsonPath(#profile, '$.job_id') != 'API_BREAKER'}");
    condition1.setGroups(Arrays.asList("Example group", "soft user"));
    GroupMappingEntity condition2 = new GroupMappingEntity();
    condition2.setCondition("{#jsonPath(#profile, '$.identity_provider_id') == 'idp_6'}");
    condition2.setGroups(Collections.singletonList("Others"));
    GroupMappingEntity condition3 = new GroupMappingEntity();
    condition3.setCondition("{#jsonPath(#profile, '$.job_id') != 'API_BREAKER'}");
    condition3.setGroups(Collections.singletonList("Api consumer"));
    when(identityProvider.getGroupMappings()).thenReturn(Arrays.asList(condition1, condition2, condition3));
}
Also used : GroupMappingEntity(io.gravitee.rest.api.model.configuration.identity.GroupMappingEntity)

Aggregations

GroupMappingEntity (io.gravitee.rest.api.model.configuration.identity.GroupMappingEntity)7 IdentityProviderType (io.gravitee.rest.api.model.configuration.identity.IdentityProviderType)2 RoleMappingEntity (io.gravitee.rest.api.model.configuration.identity.RoleMappingEntity)2 SocialIdentityProviderEntity (io.gravitee.rest.api.model.configuration.identity.SocialIdentityProviderEntity)2 Before (org.junit.Before)2 TemplateEngine (io.gravitee.el.TemplateEngine)1 UuidString (io.gravitee.rest.api.service.common.UuidString)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 Test (org.junit.Test)1