use of com.adeptj.modules.commons.oauth.common.OAuthProvider in project adeptj-modules by AdeptJ.
the class OAuthProviderFactoryImpl method deleted.
/**
* {@inheritDoc}
*/
@Override
public void deleted(String pid) {
LOGGER.info("Removing configs for pid: [{}]", pid);
OAuthProvider provider = this.providers.remove(pid);
if (provider != null) {
this.providerNamePidMappings.remove(provider.getProviderName());
}
}
use of com.adeptj.modules.commons.oauth.common.OAuthProvider in project adeptj-modules by AdeptJ.
the class OAuth2AuthorizationRequestServlet method doGet.
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
String providerName = StringUtils.substringAfterLast(req.getRequestURI(), "/");
LOGGER.info("Authz request for provider: [{}]", providerName);
OAuthProvider provider = this.providerFactory.getProvider(providerName);
LOGGER.info("OAuthProvider: [{}]", provider);
OAuth20Service oauth2Service = this.providerFactory.getOAuth2Service(providerName);
if (oauth2Service == null) {
oauth2Service = new ServiceBuilder().apiKey(provider.getApiKey()).apiSecret(provider.getApiSecret()).callback(provider.getCallbackURL()).build(provider.getApi());
this.providerFactory.addOAuth2Service(providerName, oauth2Service);
}
String authorizationUrl = oauth2Service.getAuthorizationUrl();
LOGGER.info("Authz URL: [{}]", authorizationUrl);
resp.sendRedirect(authorizationUrl);
}
Aggregations