Search in sources :

Example 1 with OIDCLogoutServlet

use of org.wso2.carbon.identity.oidc.session.servlet.OIDCLogoutServlet in project identity-inbound-auth-oauth by wso2-extensions.

the class OIDCSessionManagementComponent method activate.

protected void activate(ComponentContext context) {
    HttpService httpService = OIDCSessionManagementComponentServiceHolder.getHttpService();
    // Register Session IFrame Servlet
    Servlet sessionIFrameServlet = new ContextPathServletAdaptor(new OIDCSessionIFrameServlet(), OIDCSessionConstants.OIDCEndpoints.OIDC_SESSION_IFRAME_ENDPOINT);
    try {
        httpService.registerServlet(OIDCSessionConstants.OIDCEndpoints.OIDC_SESSION_IFRAME_ENDPOINT, sessionIFrameServlet, null, null);
    } catch (Exception e) {
        String msg = "Error when registering OIDC Session IFrame Servlet via the HttpService.";
        log.error(msg, e);
        throw new RuntimeException(msg, e);
    }
    Servlet logoutServlet = new ContextPathServletAdaptor(new OIDCLogoutServlet(), OIDCSessionConstants.OIDCEndpoints.OIDC_LOGOUT_ENDPOINT);
    try {
        httpService.registerServlet(OIDCSessionConstants.OIDCEndpoints.OIDC_LOGOUT_ENDPOINT, logoutServlet, null, null);
    } catch (Exception e) {
        String msg = "Error when registering OIDC Logout Servlet via the HttpService.";
        log.error(msg, e);
        throw new RuntimeException(msg, e);
    }
    if (log.isDebugEnabled()) {
        log.info("OIDC Session Management bundle is activated");
    }
    ClaimProviderImpl claimProviderImpl = new ClaimProviderImpl();
    try {
        context.getBundleContext().registerService(ClaimProvider.class.getName(), claimProviderImpl, null);
    } catch (Exception e) {
        String msg = "Error when registering ClaimProvider service";
        log.error(msg, e);
        throw new RuntimeException(msg, e);
    }
    if (log.isDebugEnabled()) {
        log.debug("ClaimProvider bundle is activated");
    }
    try {
        context.getBundleContext().registerService(AbstractEventHandler.class.getName(), new OIDCLogoutEventHandler(), null);
    } catch (Exception e) {
        String msg = "Error when registering OIDCLogoutEventHandler.";
        log.error(msg, e);
        throw new RuntimeException(msg, e);
    }
    context.getBundleContext().registerService(SessionContextMgtListener.class.getName(), new OIDCInboundSessionContextMgtListener(), null);
}
Also used : ClaimProviderImpl(org.wso2.carbon.identity.oidc.session.backchannellogout.ClaimProviderImpl) OIDCLogoutEventHandler(org.wso2.carbon.identity.oidc.session.handler.OIDCLogoutEventHandler) ClaimProvider(org.wso2.carbon.identity.openidconnect.ClaimProvider) OIDCLogoutServlet(org.wso2.carbon.identity.oidc.session.servlet.OIDCLogoutServlet) ContextPathServletAdaptor(org.eclipse.equinox.http.helper.ContextPathServletAdaptor) OIDCSessionIFrameServlet(org.wso2.carbon.identity.oidc.session.servlet.OIDCSessionIFrameServlet) AbstractEventHandler(org.wso2.carbon.identity.event.handler.AbstractEventHandler) HttpService(org.osgi.service.http.HttpService) Servlet(javax.servlet.Servlet) OIDCLogoutServlet(org.wso2.carbon.identity.oidc.session.servlet.OIDCLogoutServlet) OIDCSessionIFrameServlet(org.wso2.carbon.identity.oidc.session.servlet.OIDCSessionIFrameServlet) OIDCInboundSessionContextMgtListener(org.wso2.carbon.identity.oidc.session.OIDCInboundSessionContextMgtListener) SessionContextMgtListener(org.wso2.carbon.identity.application.authentication.framework.listener.SessionContextMgtListener) OIDCInboundSessionContextMgtListener(org.wso2.carbon.identity.oidc.session.OIDCInboundSessionContextMgtListener)

Aggregations

Servlet (javax.servlet.Servlet)1 ContextPathServletAdaptor (org.eclipse.equinox.http.helper.ContextPathServletAdaptor)1 HttpService (org.osgi.service.http.HttpService)1 SessionContextMgtListener (org.wso2.carbon.identity.application.authentication.framework.listener.SessionContextMgtListener)1 AbstractEventHandler (org.wso2.carbon.identity.event.handler.AbstractEventHandler)1 OIDCInboundSessionContextMgtListener (org.wso2.carbon.identity.oidc.session.OIDCInboundSessionContextMgtListener)1 ClaimProviderImpl (org.wso2.carbon.identity.oidc.session.backchannellogout.ClaimProviderImpl)1 OIDCLogoutEventHandler (org.wso2.carbon.identity.oidc.session.handler.OIDCLogoutEventHandler)1 OIDCLogoutServlet (org.wso2.carbon.identity.oidc.session.servlet.OIDCLogoutServlet)1 OIDCSessionIFrameServlet (org.wso2.carbon.identity.oidc.session.servlet.OIDCSessionIFrameServlet)1 ClaimProvider (org.wso2.carbon.identity.openidconnect.ClaimProvider)1