KEYCLOAK-3237 Add scopes_supported to OIDC WellKnown endpoint

This commit is contained in:
mposolda 2016-07-15 09:47:09 +02:00
parent 021c2ec701
commit fda0a79e27
3 changed files with 19 additions and 0 deletions

View file

@ -61,6 +61,9 @@ public class OIDCWellKnownProvider implements WellKnownProvider {
public static final List<String> DEFAULT_CLAIM_TYPES_SUPPORTED= list("normal");
// TODO: Add more of OIDC scopes
public static final List<String> SCOPES_SUPPORTED= list(OAuth2Constants.SCOPE_OPENID, OAuth2Constants.OFFLINE_ACCESS);
private KeycloakSession session;
public OIDCWellKnownProvider(KeycloakSession session) {
@ -97,6 +100,8 @@ public class OIDCWellKnownProvider implements WellKnownProvider {
config.setClaimTypesSupported(DEFAULT_CLAIM_TYPES_SUPPORTED);
config.setClaimsParameterSupported(false);
config.setScopesSupported(SCOPES_SUPPORTED);
return config;
}

View file

@ -85,6 +85,9 @@ public class OIDCConfigurationRepresentation {
@JsonProperty("claims_parameter_supported")
private Boolean claimsParameterSupported;
@JsonProperty("scopes_supported")
private List<String> scopesSupported;
protected Map<String, Object> otherClaims = new HashMap<String, Object>();
public String getIssuer() {
@ -231,6 +234,14 @@ public class OIDCConfigurationRepresentation {
this.claimsParameterSupported = claimsParameterSupported;
}
public List<String> getScopesSupported() {
return scopesSupported;
}
public void setScopesSupported(List<String> scopesSupported) {
this.scopesSupported = scopesSupported;
}
@JsonAnyGetter
public Map<String, Object> getOtherClaims() {
return otherClaims;

View file

@ -95,6 +95,9 @@ public class OIDCWellKnownProviderTest extends AbstractKeycloakTest {
assertContains(oidcConfig.getClaimsSupported(), IDToken.NAME, IDToken.EMAIL, IDToken.PREFERRED_USERNAME, IDToken.FAMILY_NAME);
Assert.assertNames(oidcConfig.getClaimTypesSupported(), "normal");
Assert.assertFalse(oidcConfig.getClaimsParameterSupported());
// Scopes supported
Assert.assertNames(oidcConfig.getScopesSupported(), OAuth2Constants.SCOPE_OPENID, OAuth2Constants.OFFLINE_ACCESS);
} finally {
client.close();
}