Search in sources :

Example 1 with WebFingerServlet

use of org.wso2.carbon.identity.webfinger.servlet.WebFingerServlet in project identity-inbound-auth-oauth by wso2-extensions.

the class WebFingerServiceComponent method activate.

protected void activate(ComponentContext context) {
    try {
        BundleContext bundleContext = context.getBundleContext();
        WebFingerProcessor webFingerProcessor = DefaultWebFingerProcessor.getInstance();
        bundleContext.registerService(WebFingerProcessor.class.getName(), webFingerProcessor, null);
        WebFingerServiceComponentHolder.setWebFingerProcessor(webFingerProcessor);
        if (log.isDebugEnabled()) {
            log.debug("OpenID WebFinger bundle is activated.");
        }
        // Register OpenID Connect WebFinger servlet
        HttpService httpService = WebFingerServiceComponentHolder.getHttpService();
        Servlet webFingerServlet = new ContextPathServletAdaptor(new WebFingerServlet(), "/.well-known/webfinger");
        try {
            httpService.registerServlet("/.well-known/webfinger", webFingerServlet, null, null);
        } catch (Exception e) {
            String errMsg = "Error when registering Web Finger Servlet via the HttpService.";
            log.error(errMsg, e);
            throw new RuntimeException(errMsg, e);
        }
    } catch (Throwable e) {
        log.error("Error while activating the WebFingerServiceComponent", e);
    }
}
Also used : HttpService(org.osgi.service.http.HttpService) WebFingerServlet(org.wso2.carbon.identity.webfinger.servlet.WebFingerServlet) DefaultWebFingerProcessor(org.wso2.carbon.identity.webfinger.DefaultWebFingerProcessor) WebFingerProcessor(org.wso2.carbon.identity.webfinger.WebFingerProcessor) WebFingerServlet(org.wso2.carbon.identity.webfinger.servlet.WebFingerServlet) Servlet(javax.servlet.Servlet) BundleContext(org.osgi.framework.BundleContext) ContextPathServletAdaptor(org.eclipse.equinox.http.helper.ContextPathServletAdaptor)

Aggregations

Servlet (javax.servlet.Servlet)1 ContextPathServletAdaptor (org.eclipse.equinox.http.helper.ContextPathServletAdaptor)1 BundleContext (org.osgi.framework.BundleContext)1 HttpService (org.osgi.service.http.HttpService)1 DefaultWebFingerProcessor (org.wso2.carbon.identity.webfinger.DefaultWebFingerProcessor)1 WebFingerProcessor (org.wso2.carbon.identity.webfinger.WebFingerProcessor)1 WebFingerServlet (org.wso2.carbon.identity.webfinger.servlet.WebFingerServlet)1