Search in sources :

Example 1 with BasicClaimsSourceImpl

use of edu.uiuc.ncsa.myproxy.oa4mp.oauth2.servlet.BasicClaimsSourceImpl in project OA4MP by ncsa.

the class OA2ConfigurationLoader method createInstance.

@Override
public T createInstance() {
    try {
        initialize();
        T se = (T) new OA2SE(loggerProvider.get(), getTransactionStoreProvider(), getClientStoreProvider(), getMaxAllowedNewClientRequests(), getRTLifetime(), getClientApprovalStoreProvider(), getMyProxyFacadeProvider(), getMailUtilProvider(), getMP(), getAGIProvider(), getATIProvider(), getPAIProvider(), getTokenForgeProvider(), getConstants(), getAuthorizationServletConfig(), getUsernameTransformer(), getPingable(), getMpp(), getMacp(), getClientSecretLength(), getScopes(), getClaimSource(), getLdapConfiguration(), isRefreshTokenEnabled(), isTwoFactorSupportEnabled(), getMaxClientRefreshTokenLifetime(), getJSONWebKeys(), getIssuer(), getMLDAP(), isUtilServerEnabled());
        if (getClaimSource() instanceof BasicClaimsSourceImpl) {
            ((BasicClaimsSourceImpl) getClaimSource()).setOa2SE((OA2SE) se);
        }
        return se;
    } catch (ClassNotFoundException | IllegalAccessException | InstantiationException e) {
        throw new GeneralException("Error: Could not create the runtime environment", e);
    }
}
Also used : GeneralException(edu.uiuc.ncsa.security.core.exceptions.GeneralException) BasicClaimsSourceImpl(edu.uiuc.ncsa.myproxy.oa4mp.oauth2.servlet.BasicClaimsSourceImpl) OA2SE(edu.uiuc.ncsa.myproxy.oa4mp.oauth2.OA2SE)

Example 2 with BasicClaimsSourceImpl

use of edu.uiuc.ncsa.myproxy.oa4mp.oauth2.servlet.BasicClaimsSourceImpl in project OA4MP by ncsa.

the class OA2ConfigurationLoader method getClaimSource.

public ClaimSource getClaimSource() throws ClassNotFoundException, IllegalAccessException, InstantiationException {
    DebugUtil.dbg(this, "Getting scope handler " + claimSource);
    if (claimSource == null) {
        // This gets the scopes if any and injects them into the scope handler.
        if (0 < cn.getChildrenCount(SCOPES)) {
            String scopeHandlerName = getFirstAttribute(Configurations.getFirstNode(cn, SCOPES), SCOPE_HANDLER);
            if (scopeHandlerName != null) {
                Class<?> k = Class.forName(scopeHandlerName);
                Object x = k.newInstance();
                if (!(x instanceof ClaimSource)) {
                    throw new GeneralException("The scope handler specified by the class name \"" + scopeHandlerName + "\" does not extend the ScopeHandler " + "interface and therefore cannot be used to handle scopes.");
                }
                claimSource = (ClaimSource) x;
            } else {
                info("Scope handler attribute found in configuration, but no value was found for it. Skipping custom loaded scope handling.");
            }
        }
        // no scopes element, so just use the basic handler.
        if (claimSource == null) {
            DebugUtil.dbg(this, "No server-wide configured Scope handler");
            if (getLdapConfiguration().isEnabled()) {
                DebugUtil.dbg(this, "   LDAP scope handler enabled, creating default");
                claimSource = new LDAPClaimsSource(getLdapConfiguration(), myLogger);
            } else {
                DebugUtil.dbg(this, "   LDAP scope handler disabled, creating basic");
                claimSource = new BasicClaimsSourceImpl();
            }
        }
        claimSource.setScopes(getScopes());
        DebugUtil.dbg(this, "   Actual scope handler = " + claimSource.getClass().getSimpleName());
    }
    return claimSource;
}
Also used : LDAPClaimsSource(edu.uiuc.ncsa.myproxy.oa4mp.oauth2.servlet.LDAPClaimsSource) GeneralException(edu.uiuc.ncsa.security.core.exceptions.GeneralException) BasicClaimsSourceImpl(edu.uiuc.ncsa.myproxy.oa4mp.oauth2.servlet.BasicClaimsSourceImpl) ClaimSource(edu.uiuc.ncsa.security.oauth_2_0.server.ClaimSource)

Aggregations

BasicClaimsSourceImpl (edu.uiuc.ncsa.myproxy.oa4mp.oauth2.servlet.BasicClaimsSourceImpl)2 GeneralException (edu.uiuc.ncsa.security.core.exceptions.GeneralException)2 OA2SE (edu.uiuc.ncsa.myproxy.oa4mp.oauth2.OA2SE)1 LDAPClaimsSource (edu.uiuc.ncsa.myproxy.oa4mp.oauth2.servlet.LDAPClaimsSource)1 ClaimSource (edu.uiuc.ncsa.security.oauth_2_0.server.ClaimSource)1