use of org.wso2.carbon.identity.oauth.listener.OAuthTokenSessionMappingEventHandler in project identity-inbound-auth-oauth by wso2-extensions.
the class OAuthServiceComponent method activate.
protected void activate(ComponentContext context) {
try {
// initialize the OAuth Server configuration
OAuthServerConfiguration oauthServerConfig = OAuthServerConfiguration.getInstance();
if (OAuthCache.getInstance().isEnabled()) {
log.debug("OAuth Caching is enabled. Initializing the cache.");
}
IdentityOathEventListener listener = new IdentityOathEventListener();
serviceRegistration = context.getBundleContext().registerService(UserOperationEventListener.class.getName(), listener, null);
log.debug("Identity Oath Event Listener is enabled");
context.getBundleContext().registerService(AbstractEventHandler.class.getName(), new IdentityOauthEventHandler(), null);
if (log.isDebugEnabled()) {
log.debug("Identity Oauth Event handler is enabled");
}
OAuth2Service oauth2Service = new OAuth2Service();
context.getBundleContext().registerService(OAuth2Service.class.getName(), oauth2Service, null);
OAuthComponentServiceHolder.getInstance().setOauth2Service(oauth2Service);
// We need to explicitly populate the OAuthTokenIssuerMap since it's used for token validation.
oauthServerConfig.populateOAuthTokenIssuerMap();
OAuthAdminServiceImpl oauthAdminService = new OAuthAdminServiceImpl();
OAuthComponentServiceHolder.getInstance().setOAuthAdminService(oauthAdminService);
OAuth2ServiceComponentHolder.getInstance().setOAuthAdminService(oauthAdminService);
context.getBundleContext().registerService(OAuthEventInterceptor.class, new OAuthTokenSessionMappingEventHandler(), null);
if (log.isDebugEnabled()) {
log.debug("OAuthTokenSessionMapping Event Handler is enabled");
}
context.getBundleContext().registerService(OAuthAdminServiceImpl.class.getName(), oauthAdminService, null);
if (log.isDebugEnabled()) {
log.debug("Identity OAuth bundle is activated");
}
} catch (Throwable e) {
String errMsg = "Error occurred while activating OAuth Service Component";
log.error(errMsg, e);
throw new RuntimeException(errMsg, e);
}
}
Aggregations