PasswordCredentialsGrantTypeHandler.java revision 3e00d049c722abe4b6819929a7bfef6c3f62d4f2
/*
* 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.
*/
/**
* Implementation of the GrantTypeHandler for the OAuth2 Password Credentials grant.
*
* @since 12.0.0
*/
public class PasswordCredentialsGrantTypeHandler implements GrantTypeHandler {
private final ClientAuthenticator clientAuthenticator;
private final ResourceOwnerAuthenticator resourceOwnerAuthenticator;
private final OAuth2ProviderSettingsFactory providerSettingsFactory;
private final TokenStore tokenStore;
/**
* Constructs a new PasswordCredentialsGrantTypeHandler.
*
* @param clientAuthenticator An instance of the ClientAuthenticator.
* @param requestValidators A {@code List} of PasswordCredentialsRequestValidators.
* @param resourceOwnerAuthenticator An instance of the ResourceOwnerAuthenticator.
* @param providerSettingsFactory An instance of the OAuth2ProviderSettingsFactory.
* @param tokenStore An instance of the TokenStore.
*/
this.requestValidators = requestValidators;
this.tokenStore = tokenStore;
}
/**
* {@inheritDoc}
*/
public AccessToken handle(OAuth2Request request) throws ClientAuthenticationFailedException, InvalidClientException,
}
if (resourceOwner == null) {
throw new InvalidGrantException();
}
final Set<String> validatedScope = providerSettings.validateAccessTokenScope(clientRegistration, scope,
request);
if (providerSettings.issueRefreshTokens()) {
}
request);
if (refreshToken != null) {
}
}
return accessToken;
}
}