OAuth2ProviderSettingsImpl.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.
*/
/**
* @since 12.0.0
*/
public class OAuth2ProviderSettingsImpl implements OAuth2ProviderSettings {
private final String deploymentUrl;
private final ConfigurationResource configurationResource;
private ScopeValidator scopeValidator;
public OAuth2ProviderSettingsImpl(final String deploymentUrl, final ConfigurationResource configurationResource) {
this.deploymentUrl = deploymentUrl;
}
public Map<String, ResponseTypeHandler> getAllowedResponseTypes() throws UnsupportedResponseTypeException, ServerException {
try {
final Iterator<JsonValue> iter = configurationResource.getConfiguration().get("allowedResponseTypes").iterator();
final HashMap<String, ResponseTypeHandler> responseTypeHandlers = new HashMap<String, ResponseTypeHandler>();
.asSubclass(ResponseTypeHandler.class)));
}
return responseTypeHandlers;
} catch (ClassNotFoundException e) {
throw new ServerException(e);
}
}
return false;
}
return false;
}
}
if (scopeValidator == null) {
try {
final String scopeValidatorClassName = configurationResource.getConfiguration().get("scopeValidator")
.asString();
if (isEmpty(scopeValidatorClassName)) {
throw new ServerException("Scope Validator class not set.");
}
} catch (ClassNotFoundException e) {
throw new ServerException(e);
}
}
return scopeValidator;
}
public Set<String> validateAuthorizationScope(ClientRegistration clientRegistration, Set<String> scope) throws ServerException {
}
public Set<String> validateAccessTokenScope(ClientRegistration clientRegistration, Set<String> scope, OAuth2Request request) throws ServerException {
}
public Set<String> validateRefreshTokenScope(ClientRegistration clientRegistration, Set<String> requestedScope, Set<String> tokenScope, OAuth2Request request) throws ServerException {
return getScopeValidator().validateRefreshTokenScope(clientRegistration, requestedScope, tokenScope, request);
}
public Map<String, Object> getUserInfo(AccessToken token, OAuth2Request request) throws ServerException, UnauthorizedClientException {
}
}
public Map<String, String> additionalDataToReturnFromAuthorizeEndpoint(Map<String, Token> tokens, OAuth2Request request) throws ServerException {
}
public void additionalDataToReturnFromTokenEndpoint(AccessToken accessToken, OAuth2Request request) throws ServerException, InvalidClientException {
}
}
public boolean issueRefreshTokens() throws ServerException {
}
public boolean issueRefreshTokensOnRefreshingToken() throws ServerException {
return configurationResource.getConfiguration().get("issueRefreshTokensOnRefreshingToken").asBoolean();
}
public long getAuthorizationCodeLifetime() throws ServerException {
}
public long getAccessTokenLifetime() throws ServerException {
}
public long getOpenIdTokenLifetime() throws ServerException {
}
public long getRefreshTokenLifetime() throws ServerException {
}
final KeystoreManager keystoreManager = new KeystoreManager(keystoreType, keystorePath, keystorePassword);
}
return null; //To change body of implemented methods use File | Settings | File Templates.
}
}
return new HashSet<String>(configurationResource.getConfiguration().get("supportedOpenIdTokenSigningAlgorithms")
}
public String getOpenIDConnectVersion() {
return "3.0";
}
public String getOpenIDConnectIssuer() {
return deploymentUrl;
}
public String getAuthorizationEndpoint() {
return deploymentUrl + "/oauth2/authorize";
}
public String getTokenEndpoint() {
return deploymentUrl + "/oauth2/access_token";
}
public String getUserInfoEndpoint() {
return deploymentUrl + "/oauth2/userinfo";
}
public String getCheckSessionEndpoint() {
return deploymentUrl + "/oauth2/connect/checkSession";
}
public String getEndSessionEndpoint() {
return deploymentUrl + "/oauth2/connect/endSession";
}
}
public String getClientRegistrationEndpoint() {
return deploymentUrl + "/oauth2/connect/register";
}
}
public boolean isOpenDynamicClientRegistrationAllowed() throws ServerException {
return false;
}
public boolean isRegistrationAccessTokenGenerationEnabled() throws ServerException {
return false;
}
return Collections.emptyMap();
}
return null;
}
return Collections.emptyMap();
}
}