AuthorizationTokenIssuer.java revision 33908fb93167e643fbb21b47d87c5b632df0dc59
/*
* The contents of this file are subject to the terms of the Common Development and
* Distribution License (the License). You may not use this file except in compliance with the
* License.
*
* You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
* specific language governing permission and limitations under the License.
*
* When distributing Covered Software, include this CDDL Header Notice in each file and include
* the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
* Header, with the fields enclosed by brackets [] replaced by your own identifying
* information: "Portions copyright [year] [name of copyright owner]".
*
* Copyright 2014 ForgeRock AS.
*/
/**
* Issues Authorization Tokens requested by OAuth2 authorize requests.
*
* @since 12.0.0
*/
public class AuthorizationTokenIssuer {
/**
* Issues tokens for the OAuth2 authorize request.
*
* @param request The OAuth2 request.
* @param clientRegistration The client's registration.
* @param resourceOwner The resource owner.
* @param authorizationScope The authorization scope.
* @param providerSettings An instance of the OAuth2ProviderSettings.
* @return An AuthorizationToken.
* @throws InvalidClientException If either the request does not contain the client's id or the client fails to be
* authenticated.
* @throws UnsupportedResponseTypeException If the requested response type is not supported by either the client
* or the OAuth2 provider.
* @throws ServerException If any internal server error occurs.
*/
ResourceOwner resourceOwner, Set<String> authorizationScope, OAuth2ProviderSettings providerSettings)
//issue tokens
final Set<String> requestedResponseTypes = splitResponseType(request.<String>getParameter("response_type"));
throw new UnsupportedResponseTypeException("Response type is not supported");
}
final Map<String, ResponseTypeHandler> allowedResponseTypes = providerSettings.getAllowedResponseTypes();
boolean returnAsFragment = false;
throw new UnsupportedResponseTypeException("Response type is not supported");
}
final Map.Entry<String, Token> token = responseTypeHandler.handle(accessToken, tokenType, validatedScope,
}
throw new UnsupportedResponseTypeException("Returning multiple response types with the same url "
+ "value");
}
if (!returnAsFragment) {
}
}
}
//plugin point for provider to add additional entries to tokenMap
final Map<String, String> additionalData = providerSettings.additionalDataToReturnFromAuthorizeEndpoint(
returnAsFragment = true;
}
}
}
// Only add the scope to the response if not identical to the scope requested by the client
}
}
}
/**
* Flattens a {@code Map} of token name and Token into a single {@code Map} of the token name and any additional
* information from an access token.
*
* @param tokens The {@code Map} of tokens.
* @return A {@code Map} of the flattened tokens.
* @throws ServerException If any internal server error occurs.
*/
}
//if access token add extra fields
}
}
}
}
return tokenMap;
}
/**
* Comparator that takes a given String in its ctor which is moved to the front
* of the list. The order of other elements is undetermined.
*/
}
return -1;
return 1;
} else {
return 0;
}
}
}
}