use of com.predic8.membrane.core.interceptor.oauth2.parameter.ClaimsParameter in project service-proxy by membrane.
the class IdTokenTokenFlow method getValidIdTokenClaims.
private JwtGenerator.Claim[] getValidIdTokenClaims() {
ClaimsParameter cp = new ClaimsParameter(authServer.getClaimList().getSupportedClaims(), session.getUserAttributes().get(ParamNames.CLAIMS));
ArrayList<JwtGenerator.Claim> claims = new ArrayList<JwtGenerator.Claim>();
if (cp.hasClaims()) {
for (String claim : cp.getIdTokenClaims()) claims.add(new JwtGenerator.Claim(claim, session.getUserAttributes().get(ClaimRenamer.convert(claim))));
}
return claims.toArray(new JwtGenerator.Claim[0]);
}
use of com.predic8.membrane.core.interceptor.oauth2.parameter.ClaimsParameter in project service-proxy by membrane.
the class ClaimsParameterTest method testValidParsing.
@Test
public void testValidParsing() throws Exception {
cp = new ClaimsParameter(createSupportedClaims("email", "sub"), OAuth2TestUtil.getMockClaims());
assertEquals(OAuth2TestUtil.getMockClaims(), cp.toJson());
}
use of com.predic8.membrane.core.interceptor.oauth2.parameter.ClaimsParameter in project service-proxy by membrane.
the class ClaimsParameterTest method testParsingNoUserinfo.
@Test
public void testParsingNoUserinfo() throws Exception {
cp = new ClaimsParameter(createSupportedClaims("sub"), OAuth2TestUtil.getMockClaims());
assertEquals(getMockClaimsIdToken(), cp.toJson());
}
use of com.predic8.membrane.core.interceptor.oauth2.parameter.ClaimsParameter in project service-proxy by membrane.
the class AuthorizationCodeFlow method getValidIdTokenClaims.
private JwtGenerator.Claim[] getValidIdTokenClaims(SessionManager.Session session) {
ClaimsParameter cp = new ClaimsParameter(authServer.getClaimList().getSupportedClaims(), session.getUserAttributes().get(ParamNames.CLAIMS));
ArrayList<JwtGenerator.Claim> claims = new ArrayList<JwtGenerator.Claim>();
if (cp.hasClaims()) {
for (String claim : cp.getIdTokenClaims()) claims.add(new JwtGenerator.Claim(claim, session.getUserAttributes().get(ClaimRenamer.convert(claim))));
}
return claims.toArray(new JwtGenerator.Claim[0]);
}
use of com.predic8.membrane.core.interceptor.oauth2.parameter.ClaimsParameter in project service-proxy by membrane.
the class EmptyEndpointProcessor method processClaimsParameterToClaimsString.
private String[] processClaimsParameterToClaimsString(String claimsParam) {
ClaimsParameter cp = new ClaimsParameter(authServer.getClaimList().getSupportedClaims(), claimsParam);
StringBuilder builder = new StringBuilder();
HashSet<String> userinfo = cp.getUserinfoClaims();
for (String claim : userinfo) builder.append(" ").append(claim);
HashSet<String> idToken = cp.getIdTokenClaims();
for (String claim : idToken) builder.append(" ").append(claim);
return builder.toString().trim().split(" ");
}
Aggregations