use of org.wso2.carbon.identity.webfinger.WebFingerProcessor 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);
}
}
use of org.wso2.carbon.identity.webfinger.WebFingerProcessor in project identity-inbound-auth-oauth by wso2-extensions.
the class WebFingerServlet method getOIDProviderIssuer.
public void getOIDProviderIssuer(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws IOException {
WebFingerProcessor processor = WebFingerServiceComponentHolder.getWebFingerProcessor();
String response = "";
try {
WebFingerResponseBuilder webFingerResponseBuilder = new JSONResponseBuilder();
response = webFingerResponseBuilder.getOIDProviderIssuerString(processor.getResponse(httpServletRequest));
} catch (WebFingerEndpointException e) {
httpServletResponse.setStatus(processor.handleError(e));
return;
} catch (ServerConfigurationException e) {
log.error("Server Configuration error occurred.", e);
httpServletResponse.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
return;
}
httpServletResponse.setContentType(WebFingerConstants.RESPONSE_CONTENT_TYPE);
PrintWriter out = httpServletResponse.getWriter();
out.print(response);
}
Aggregations