KEYCLOAK-3237 Add scopes_supported to OIDC WellKnown endpoint
This commit is contained in:
parent
021c2ec701
commit
fda0a79e27
3 changed files with 19 additions and 0 deletions
|
@ -61,6 +61,9 @@ public class OIDCWellKnownProvider implements WellKnownProvider {
|
||||||
|
|
||||||
public static final List<String> DEFAULT_CLAIM_TYPES_SUPPORTED= list("normal");
|
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;
|
private KeycloakSession session;
|
||||||
|
|
||||||
public OIDCWellKnownProvider(KeycloakSession session) {
|
public OIDCWellKnownProvider(KeycloakSession session) {
|
||||||
|
@ -97,6 +100,8 @@ public class OIDCWellKnownProvider implements WellKnownProvider {
|
||||||
config.setClaimTypesSupported(DEFAULT_CLAIM_TYPES_SUPPORTED);
|
config.setClaimTypesSupported(DEFAULT_CLAIM_TYPES_SUPPORTED);
|
||||||
config.setClaimsParameterSupported(false);
|
config.setClaimsParameterSupported(false);
|
||||||
|
|
||||||
|
config.setScopesSupported(SCOPES_SUPPORTED);
|
||||||
|
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -85,6 +85,9 @@ public class OIDCConfigurationRepresentation {
|
||||||
@JsonProperty("claims_parameter_supported")
|
@JsonProperty("claims_parameter_supported")
|
||||||
private Boolean claimsParameterSupported;
|
private Boolean claimsParameterSupported;
|
||||||
|
|
||||||
|
@JsonProperty("scopes_supported")
|
||||||
|
private List<String> scopesSupported;
|
||||||
|
|
||||||
protected Map<String, Object> otherClaims = new HashMap<String, Object>();
|
protected Map<String, Object> otherClaims = new HashMap<String, Object>();
|
||||||
|
|
||||||
public String getIssuer() {
|
public String getIssuer() {
|
||||||
|
@ -231,6 +234,14 @@ public class OIDCConfigurationRepresentation {
|
||||||
this.claimsParameterSupported = claimsParameterSupported;
|
this.claimsParameterSupported = claimsParameterSupported;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<String> getScopesSupported() {
|
||||||
|
return scopesSupported;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setScopesSupported(List<String> scopesSupported) {
|
||||||
|
this.scopesSupported = scopesSupported;
|
||||||
|
}
|
||||||
|
|
||||||
@JsonAnyGetter
|
@JsonAnyGetter
|
||||||
public Map<String, Object> getOtherClaims() {
|
public Map<String, Object> getOtherClaims() {
|
||||||
return otherClaims;
|
return otherClaims;
|
||||||
|
|
|
@ -95,6 +95,9 @@ public class OIDCWellKnownProviderTest extends AbstractKeycloakTest {
|
||||||
assertContains(oidcConfig.getClaimsSupported(), IDToken.NAME, IDToken.EMAIL, IDToken.PREFERRED_USERNAME, IDToken.FAMILY_NAME);
|
assertContains(oidcConfig.getClaimsSupported(), IDToken.NAME, IDToken.EMAIL, IDToken.PREFERRED_USERNAME, IDToken.FAMILY_NAME);
|
||||||
Assert.assertNames(oidcConfig.getClaimTypesSupported(), "normal");
|
Assert.assertNames(oidcConfig.getClaimTypesSupported(), "normal");
|
||||||
Assert.assertFalse(oidcConfig.getClaimsParameterSupported());
|
Assert.assertFalse(oidcConfig.getClaimsParameterSupported());
|
||||||
|
|
||||||
|
// Scopes supported
|
||||||
|
Assert.assertNames(oidcConfig.getScopesSupported(), OAuth2Constants.SCOPE_OPENID, OAuth2Constants.OFFLINE_ACCESS);
|
||||||
} finally {
|
} finally {
|
||||||
client.close();
|
client.close();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue