Search in sources :

Example 1 with IdentityProviderType

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

the class OAuth2AuthenticationResourceTest method init.

@Before
public void init() {
    identityProvider = new SocialIdentityProviderEntity() {

        @Override
        public String getId() {
            return USER_SOURCE_OAUTH2;
        }

        @Override
        public IdentityProviderType getType() {
            return IdentityProviderType.OIDC;
        }

        @Override
        public String getAuthorizationEndpoint() {
            return null;
        }

        @Override
        public String getTokenEndpoint() {
            return "http://localhost:" + wireMockRule.port() + "/token";
        }

        @Override
        public String getUserInfoEndpoint() {
            return "http://localhost:" + wireMockRule.port() + "/userinfo";
        }

        @Override
        public List<String> getRequiredUrlParams() {
            return null;
        }

        @Override
        public List<String> getOptionalUrlParams() {
            return null;
        }

        @Override
        public List<String> getScopes() {
            return null;
        }

        @Override
        public String getDisplay() {
            return null;
        }

        @Override
        public String getColor() {
            return null;
        }

        @Override
        public String getClientSecret() {
            return "the_client_secret";
        }

        private Map<String, String> userProfileMapping = new HashMap<>();

        @Override
        public Map<String, String> getUserProfileMapping() {
            return userProfileMapping;
        }

        private List<GroupMappingEntity> groupMappings = new ArrayList<>();

        @Override
        public List<GroupMappingEntity> getGroupMappings() {
            return groupMappings;
        }

        private List<RoleMappingEntity> roleMappings = new ArrayList<>();

        @Override
        public List<RoleMappingEntity> getRoleMappings() {
            return roleMappings;
        }

        @Override
        public boolean isEmailRequired() {
            return true;
        }
    };
    when(socialIdentityProviderService.findById(eq(USER_SOURCE_OAUTH2), any())).thenReturn(identityProvider);
    cleanEnvironment();
    cleanRolesGroupMapping();
    reset(userService, groupService, roleService, membershipService);
}
Also used : RoleMappingEntity(io.gravitee.rest.api.model.configuration.identity.RoleMappingEntity) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) GroupMappingEntity(io.gravitee.rest.api.model.configuration.identity.GroupMappingEntity) SocialIdentityProviderEntity(io.gravitee.rest.api.model.configuration.identity.SocialIdentityProviderEntity) IdentityProviderType(io.gravitee.rest.api.model.configuration.identity.IdentityProviderType) HashMap(java.util.HashMap) Map(java.util.Map) Before(org.junit.Before)

Example 2 with IdentityProviderType

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

the class OAuth2AuthenticationResourceTest method init.

@Before
public void init() {
    identityProvider = new SocialIdentityProviderEntity() {

        private Map<String, String> userProfileMapping = new HashMap<>();

        private List<GroupMappingEntity> groupMappings = new ArrayList<>();

        private List<RoleMappingEntity> roleMappings = new ArrayList<>();

        @Override
        public String getId() {
            return USER_SOURCE_OAUTH2;
        }

        @Override
        public IdentityProviderType getType() {
            return IdentityProviderType.OIDC;
        }

        @Override
        public String getAuthorizationEndpoint() {
            return null;
        }

        @Override
        public String getTokenEndpoint() {
            return "http://localhost:" + wireMockRule.port() + "/token";
        }

        @Override
        public String getUserInfoEndpoint() {
            return "http://localhost:" + wireMockRule.port() + "/userinfo";
        }

        @Override
        public List<String> getRequiredUrlParams() {
            return null;
        }

        @Override
        public List<String> getOptionalUrlParams() {
            return null;
        }

        @Override
        public List<String> getScopes() {
            return null;
        }

        @Override
        public String getDisplay() {
            return null;
        }

        @Override
        public String getColor() {
            return null;
        }

        @Override
        public String getClientSecret() {
            return "the_client_secret";
        }

        @Override
        public Map<String, String> getUserProfileMapping() {
            return userProfileMapping;
        }

        @Override
        public List<GroupMappingEntity> getGroupMappings() {
            return groupMappings;
        }

        @Override
        public List<RoleMappingEntity> getRoleMappings() {
            return roleMappings;
        }

        @Override
        public boolean isEmailRequired() {
            return true;
        }
    };
    when(socialIdentityProviderService.findById(eq(USER_SOURCE_OAUTH2), any())).thenReturn(identityProvider);
    cleanEnvironment();
    cleanRolesGroupMapping();
    reset(userService, groupService, roleService, membershipService);
}
Also used : RoleMappingEntity(io.gravitee.rest.api.model.configuration.identity.RoleMappingEntity) GroupMappingEntity(io.gravitee.rest.api.model.configuration.identity.GroupMappingEntity) SocialIdentityProviderEntity(io.gravitee.rest.api.model.configuration.identity.SocialIdentityProviderEntity) IdentityProviderType(io.gravitee.rest.api.model.configuration.identity.IdentityProviderType) Before(org.junit.Before)

Aggregations

GroupMappingEntity (io.gravitee.rest.api.model.configuration.identity.GroupMappingEntity)2 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 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1