Search in sources :

Example 1 with ResponseTypeHandler

use of org.forgerock.oauth2.core.ResponseTypeHandler in project OpenAM by OpenRock.

the class OpenAMOAuth2ProviderSettings method getAllowedResponseTypes.

/**
     * {@inheritDoc}
     */
public Map<String, ResponseTypeHandler> getAllowedResponseTypes() throws UnsupportedResponseTypeException, ServerException {
    try {
        Set<String> responseTypeSet = getSetting(realm, OAuth2ProviderService.RESPONSE_TYPE_LIST);
        if (responseTypeSet == null || responseTypeSet.isEmpty()) {
            return Collections.emptyMap();
        }
        Map<String, ResponseTypeHandler> responseTypes = new HashMap<String, ResponseTypeHandler>();
        for (String responseType : responseTypeSet) {
            String[] parts = responseType.split("\\|");
            if (parts.length != 2) {
                logger.error("Response type wrong format for realm: " + realm);
                continue;
            }
            responseTypes.put(parts[0], wrap(parts[0], parts[1]));
        }
        return responseTypes;
    } catch (SMSException e) {
        logger.error(e.getMessage());
        throw new ServerException(e);
    } catch (SSOException e) {
        logger.error(e.getMessage());
        throw new ServerException(e);
    }
}
Also used : NoneResponseTypeHandler(org.forgerock.oauth2.core.NoneResponseTypeHandler) LegacyResponseTypeHandler(org.forgerock.openam.oauth2.legacy.LegacyResponseTypeHandler) ResponseTypeHandler(org.forgerock.oauth2.core.ResponseTypeHandler) ServerException(org.forgerock.oauth2.core.exceptions.ServerException) HashMap(java.util.HashMap) SMSException(com.sun.identity.sm.SMSException) SSOException(com.iplanet.sso.SSOException)

Aggregations

SSOException (com.iplanet.sso.SSOException)1 SMSException (com.sun.identity.sm.SMSException)1 HashMap (java.util.HashMap)1 NoneResponseTypeHandler (org.forgerock.oauth2.core.NoneResponseTypeHandler)1 ResponseTypeHandler (org.forgerock.oauth2.core.ResponseTypeHandler)1 ServerException (org.forgerock.oauth2.core.exceptions.ServerException)1 LegacyResponseTypeHandler (org.forgerock.openam.oauth2.legacy.LegacyResponseTypeHandler)1