Search in sources :

Example 1 with OidcUserSubject

use of org.apache.cxf.rs.security.oidc.idp.OidcUserSubject in project cxf by apache.

the class SubjectCreatorImpl method createUserSubject.

@Override
public OidcUserSubject createUserSubject(MessageContext mc, MultivaluedMap<String, String> params) {
    OidcUserSubject oidcSub = new OidcUserSubject(OAuthUtils.createSubject(mc, (SecurityContext) mc.get(SecurityContext.class.getName())));
    final List<String> scopes;
    String requestedScope = params.getFirst(OAuthConstants.SCOPE);
    if (requestedScope != null && !requestedScope.isEmpty()) {
        scopes = OidcUtils.getScopeClaims(requestedScope.split(" "));
    } else {
        scopes = Collections.emptyList();
    }
    oidcSub.setIdToken(ID_TOKEN_PROVIDER.getIdToken(null, oidcSub, scopes));
    return oidcSub;
}
Also used : SecurityContext(org.apache.cxf.security.SecurityContext) OidcUserSubject(org.apache.cxf.rs.security.oidc.idp.OidcUserSubject)

Aggregations

OidcUserSubject (org.apache.cxf.rs.security.oidc.idp.OidcUserSubject)1 SecurityContext (org.apache.cxf.security.SecurityContext)1