Search in sources :

Example 1 with OAuth2IdentityProviderConfig

use of org.keycloak.broker.oidc.OAuth2IdentityProviderConfig in project keycloak by keycloak.

the class AbstractOAuth2IdentityProviderTest method getConfig.

private OAuth2IdentityProviderConfig getConfig(final String autorizationUrl, final String defaultScope, final String clientId, final Boolean isLoginHint) {
    IdentityProviderModel model = new IdentityProviderModel();
    OAuth2IdentityProviderConfig config = new OAuth2IdentityProviderConfig(model);
    config.setAuthorizationUrl(autorizationUrl);
    config.setDefaultScope(defaultScope);
    config.setClientId(clientId);
    config.setLoginHint(isLoginHint);
    return config;
}
Also used : OAuth2IdentityProviderConfig(org.keycloak.broker.oidc.OAuth2IdentityProviderConfig) IdentityProviderModel(org.keycloak.models.IdentityProviderModel)

Example 2 with OAuth2IdentityProviderConfig

use of org.keycloak.broker.oidc.OAuth2IdentityProviderConfig in project keycloak by keycloak.

the class AbstractOAuth2IdentityProviderTest method constructor_defaultScopeHandling.

@Test
public void constructor_defaultScopeHandling() {
    TestProvider tested = getTested();
    // default scope is set from the provider if not provided in the configuration
    Assert.assertEquals(tested.getDefaultScopes(), tested.getConfig().getDefaultScope());
    // default scope is preserved if provided in the configuration
    IdentityProviderModel model = new IdentityProviderModel();
    OAuth2IdentityProviderConfig config = new OAuth2IdentityProviderConfig(model);
    config.setDefaultScope("myscope");
    tested = new TestProvider(config);
    Assert.assertEquals("myscope", tested.getConfig().getDefaultScope());
}
Also used : OAuth2IdentityProviderConfig(org.keycloak.broker.oidc.OAuth2IdentityProviderConfig) IdentityProviderModel(org.keycloak.models.IdentityProviderModel) Test(org.junit.Test)

Aggregations

OAuth2IdentityProviderConfig (org.keycloak.broker.oidc.OAuth2IdentityProviderConfig)2 IdentityProviderModel (org.keycloak.models.IdentityProviderModel)2 Test (org.junit.Test)1