Search in sources :

Example 1 with SessionDataPublisherImpl

use of org.wso2.carbon.apimgt.tokenmgt.handlers.SessionDataPublisherImpl in project carbon-apimgt by wso2.

the class APITokenMgtServiceComponent method activate.

@Activate
protected void activate(ComponentContext ctxt) {
    try {
        TokenMgtDataHolder.initData();
        listener = new KeyManagerUserOperationListener();
        serviceRegistration = ctxt.getBundleContext().registerService(UserOperationEventListener.class.getName(), listener, null);
        log.debug("Key Manager User Operation Listener is enabled.");
        APIManagerConfigurationService configurationService = ServiceReferenceHolder.getInstance().getAPIManagerConfigurationService();
        boolean accessTokenBindingEnable;
        String firstProperty = configurationService.getAPIManagerConfiguration().getFirstProperty(APIConstants.AccessTokenBinding.ACCESS_TOKEN_BINDING_ENABLED);
        if (firstProperty != null) {
            accessTokenBindingEnable = Boolean.parseBoolean(firstProperty);
        } else {
            accessTokenBindingEnable = false;
        }
        if (!accessTokenBindingEnable) {
            // registering logout token revoke listener
            try {
                SessionDataPublisherImpl dataPublisher = new SessionDataPublisherImpl();
                ctxt.getBundleContext().registerService(AuthenticationDataPublisher.class.getName(), dataPublisher, null);
                log.debug("SessionDataPublisherImpl bundle is activated");
            } catch (Throwable e) {
                log.error("SessionDataPublisherImpl bundle activation Failed", e);
            }
        }
    } catch (Exception e) {
        log.error("Failed to initialize key management service.", e);
    }
}
Also used : APIManagerConfigurationService(org.wso2.carbon.apimgt.impl.APIManagerConfigurationService) SessionDataPublisherImpl(org.wso2.carbon.apimgt.tokenmgt.handlers.SessionDataPublisherImpl) KeyManagerUserOperationListener(org.wso2.carbon.apimgt.tokenmgt.listeners.KeyManagerUserOperationListener) AuthenticationDataPublisher(org.wso2.carbon.identity.application.authentication.framework.AuthenticationDataPublisher) Activate(org.osgi.service.component.annotations.Activate)

Aggregations

Activate (org.osgi.service.component.annotations.Activate)1 APIManagerConfigurationService (org.wso2.carbon.apimgt.impl.APIManagerConfigurationService)1 SessionDataPublisherImpl (org.wso2.carbon.apimgt.tokenmgt.handlers.SessionDataPublisherImpl)1 KeyManagerUserOperationListener (org.wso2.carbon.apimgt.tokenmgt.listeners.KeyManagerUserOperationListener)1 AuthenticationDataPublisher (org.wso2.carbon.identity.application.authentication.framework.AuthenticationDataPublisher)1