Search in sources :

Example 1 with IdentityProvider

use of io.gravitee.rest.api.portal.rest.model.IdentityProvider in project gravitee-management-rest-api by gravitee-io.

the class IdentityProviderMapperTest method testGoogleProvider.

@Test
public void testGoogleProvider() {
    GoogleIdentityProviderEntity providerEntity = new GoogleIdentityProviderEntity();
    providerEntity.setClientId(IDP_CLIENT_ID);
    providerEntity.setClientSecret(IDP_CLIENT_SECRET);
    providerEntity.setDescription(IDP_DESCRIPTION);
    providerEntity.setEmailRequired(IDP_EMAIL_REQUIRED);
    providerEntity.setGroupMappings(new ArrayList<>());
    providerEntity.setId(IDP_ID);
    providerEntity.setName(IDP_NAME);
    providerEntity.setRoleMappings(new ArrayList<>());
    IdentityProvider idp = identityProviderMapper.convert(providerEntity);
    checkIdp(idp, IdentityProviderType.GOOGLE);
}
Also used : GoogleIdentityProviderEntity(io.gravitee.rest.api.model.configuration.identity.google.GoogleIdentityProviderEntity) IdentityProvider(io.gravitee.rest.api.portal.rest.model.IdentityProvider) Test(org.junit.Test)

Example 2 with IdentityProvider

use of io.gravitee.rest.api.portal.rest.model.IdentityProvider in project gravitee-management-rest-api by gravitee-io.

the class IdentityProviderMapperTest method testGithubProvider.

@Test
public void testGithubProvider() {
    GitHubIdentityProviderEntity providerEntity = new GitHubIdentityProviderEntity();
    providerEntity.setClientId(IDP_CLIENT_ID);
    providerEntity.setClientSecret(IDP_CLIENT_SECRET);
    providerEntity.setDescription(IDP_DESCRIPTION);
    providerEntity.setEmailRequired(IDP_EMAIL_REQUIRED);
    providerEntity.setGroupMappings(new ArrayList<>());
    providerEntity.setId(IDP_ID);
    providerEntity.setName(IDP_NAME);
    providerEntity.setRoleMappings(new ArrayList<>());
    IdentityProvider idp = identityProviderMapper.convert(providerEntity);
    checkIdp(idp, IdentityProviderType.GITHUB);
}
Also used : GitHubIdentityProviderEntity(io.gravitee.rest.api.model.configuration.identity.github.GitHubIdentityProviderEntity) IdentityProvider(io.gravitee.rest.api.portal.rest.model.IdentityProvider) Test(org.junit.Test)

Example 3 with IdentityProvider

use of io.gravitee.rest.api.portal.rest.model.IdentityProvider in project gravitee-management-rest-api by gravitee-io.

the class IdentityProviderMapperTest method testGraviteeIoAMProvider.

@Test
public void testGraviteeIoAMProvider() {
    AMIdentityProviderEntity providerEntity = new AMIdentityProviderEntity(serverUrl);
    providerEntity.setClientId(IDP_CLIENT_ID);
    providerEntity.setClientSecret(IDP_CLIENT_SECRET);
    providerEntity.setColor(IDP_COLOR);
    providerEntity.setDescription(IDP_DESCRIPTION);
    providerEntity.setDiscoveryEndpoint(IDP_DISCOVERY_ENDPOINT);
    providerEntity.setEmailRequired(IDP_EMAIL_REQUIRED);
    providerEntity.setGroupMappings(new ArrayList<>());
    providerEntity.setId(IDP_ID);
    providerEntity.setName(IDP_NAME);
    providerEntity.setRoleMappings(new ArrayList<>());
    providerEntity.setScopes(Arrays.asList(IDP_SCOPE));
    providerEntity.setUserProfileMapping(new HashMap<>());
    IdentityProvider idp = identityProviderMapper.convert(providerEntity);
    checkIdp(idp, IdentityProviderType.GRAVITEEIO_AM);
}
Also used : AMIdentityProviderEntity(io.gravitee.rest.api.model.configuration.identity.am.AMIdentityProviderEntity) IdentityProvider(io.gravitee.rest.api.portal.rest.model.IdentityProvider) Test(org.junit.Test)

Example 4 with IdentityProvider

use of io.gravitee.rest.api.portal.rest.model.IdentityProvider in project gravitee-management-rest-api by gravitee-io.

the class IdentityProviderMapperTest method testOIDCProvider.

@Test
public void testOIDCProvider() {
    OIDCIdentityProviderEntity providerEntity = new OIDCIdentityProviderEntity();
    providerEntity.setAuthorizationEndpoint(IDP_AUTHORIZATION_ENDPOINT);
    providerEntity.setClientId(IDP_CLIENT_ID);
    providerEntity.setClientSecret(IDP_CLIENT_SECRET);
    providerEntity.setColor(IDP_COLOR);
    providerEntity.setDescription(IDP_DESCRIPTION);
    providerEntity.setDiscoveryEndpoint(IDP_DISCOVERY_ENDPOINT);
    providerEntity.setEmailRequired(IDP_EMAIL_REQUIRED);
    providerEntity.setGroupMappings(new ArrayList<>());
    providerEntity.setId(IDP_ID);
    providerEntity.setName(IDP_NAME);
    providerEntity.setRoleMappings(new ArrayList<>());
    providerEntity.setScopes(Arrays.asList(IDP_SCOPE));
    providerEntity.setTokenEndpoint(IDP_TOKEN_ENDPOINT);
    providerEntity.setTokenIntrospectionEndpoint(IDP_TOKEN_INTROSPECTION_ENDPOINT);
    providerEntity.setUserInfoEndpoint(IDP_USER_INFO_ENDPOINT);
    providerEntity.setUserLogoutEndpoint(IDP_USER_LOGOUT_ENDPOINT);
    providerEntity.setUserProfileMapping(new HashMap<>());
    IdentityProvider idp = identityProviderMapper.convert(providerEntity);
    checkIdp(idp, IdentityProviderType.OIDC);
}
Also used : IdentityProvider(io.gravitee.rest.api.portal.rest.model.IdentityProvider) OIDCIdentityProviderEntity(io.gravitee.rest.api.model.configuration.identity.oidc.OIDCIdentityProviderEntity) Test(org.junit.Test)

Example 5 with IdentityProvider

use of io.gravitee.rest.api.portal.rest.model.IdentityProvider in project gravitee-management-rest-api by gravitee-io.

the class IdentityProviderMapper method convert.

public IdentityProvider convert(SocialIdentityProviderEntity socialIdentityProviderEntity) {
    IdentityProvider idpItem = new IdentityProvider();
    idpItem.setAuthorizationEndpoint(socialIdentityProviderEntity.getAuthorizationEndpoint());
    idpItem.setClientId(socialIdentityProviderEntity.getClientId());
    idpItem.setColor(socialIdentityProviderEntity.getColor());
    idpItem.setDescription(socialIdentityProviderEntity.getDescription());
    idpItem.setDisplay(socialIdentityProviderEntity.getDisplay());
    idpItem.setEmailRequired(socialIdentityProviderEntity.isEmailRequired());
    idpItem.setId(socialIdentityProviderEntity.getId());
    idpItem.setName(socialIdentityProviderEntity.getName());
    idpItem.setOptionalUrlParams(socialIdentityProviderEntity.getOptionalUrlParams());
    idpItem.setRequiredUrlParams(socialIdentityProviderEntity.getRequiredUrlParams());
    idpItem.setScopes(socialIdentityProviderEntity.getScopes());
    idpItem.setTokenIntrospectionEndpoint(socialIdentityProviderEntity.getTokenIntrospectionEndpoint());
    idpItem.setType(IdentityProviderType.fromValue(socialIdentityProviderEntity.getType().name()));
    idpItem.setUserLogoutEndpoint(socialIdentityProviderEntity.getUserLogoutEndpoint());
    return idpItem;
}
Also used : IdentityProvider(io.gravitee.rest.api.portal.rest.model.IdentityProvider)

Aggregations

IdentityProvider (io.gravitee.rest.api.portal.rest.model.IdentityProvider)5 Test (org.junit.Test)4 AMIdentityProviderEntity (io.gravitee.rest.api.model.configuration.identity.am.AMIdentityProviderEntity)1 GitHubIdentityProviderEntity (io.gravitee.rest.api.model.configuration.identity.github.GitHubIdentityProviderEntity)1 GoogleIdentityProviderEntity (io.gravitee.rest.api.model.configuration.identity.google.GoogleIdentityProviderEntity)1 OIDCIdentityProviderEntity (io.gravitee.rest.api.model.configuration.identity.oidc.OIDCIdentityProviderEntity)1