OAuth2GuiceModule.java revision f6bcea5521069355d19e6800758b1a09b41fc93e
/*
* 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-2015 ForgeRock AS.
*/
/**
*
* @since 12.0.0
*/
public class OAuth2GuiceModule extends AbstractModule {
/**
* {@inheritDoc}
*/
protected void configure() {
bind(AccessTokenVerifier.class).annotatedWith(named(HEADER)).to(RestletHeaderAccessTokenVerifier.class);
bind(AccessTokenVerifier.class).annotatedWith(named(FORM_BODY)).to(RestletFormBodyAccessTokenVerifier.class);
bind(AccessTokenVerifier.class).annotatedWith(named(QUERY_PARAM)).to(RestletQueryParameterAccessTokenVerifier.class);
bind(OpenIdConnectClientRegistrationService.class).to(OpenAMOpenIdConnectClientRegistrationService.class);
public OpenAMSettings get() {
}
});
passwordCredentialsRequestValidators.addBinding().to(PasswordCredentialsRequestValidatorImpl.class);
grantTypeHandlers.addBinding(OAuth2Constants.TokenEndpoint.SAML2_BEARER).to(Saml2GrantTypeHandler.class);
binder(), AuthorizeRequestHook.class);
binder(), TokenRequestHook.class);
install(new FactoryModuleBuilder()
.build(ResourceSetStoreFactory.class));
install(new LabelsGuiceModule());
}
}
? new LinkedBlockingQueue<Runnable>()
}
public JavaBeanAdapter<ResourceSetDescription> getResourceSetDescriptionAdapter(TokenIdGenerator idFactory) {
}
return new RestletHeaderAccessTokenVerifier(tokenStore);
}
return new RestletFormBodyAccessTokenVerifier(tokenStore);
}
return new RestletQueryParameterAccessTokenVerifier(tokenStore);
}
return new RealmAgnosticTokenStore(oauthTokenStore, providerSettingsFactory, clientRegistrationStore,
}
}
}
}
}
public Restlet createResourceSetRegistrationEndpoint(TokenStore store, OAuth2RequestFactory<Request> reqFactory) {
return new ResourceSetRegistrationExceptionFilter(
new AccessTokenProtectionFilter(null, store, reqFactory, wrap(ResourceSetRegistrationEndpoint.class)));
}
public static class RealmAgnosticTokenStore extends OpenAMTokenStore {
super(tokenStore, providerSettingsFactory, clientRegistrationStore, realmNormaliser, ssoTokenManager,
}
protected void validateTokenRealm(String tokenRealm, OAuth2Request request) throws InvalidGrantException {
//No need to validate the realm for the provided token.
}
}
return set;
}
}