...
The following code fragment can be placed in your custom login servlet or into the JAAS example servlet in order to determine which SP made the authentication request or that there is no request. It would be located in the servlet service method.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
try { application = this.getServletContext(); loginContext = HttpServletHelper.getLoginContext(HttpServletHelper.getStorageService(application), application, request); entityDescriptor = HttpServletHelper.getRelyingPartyMetadata(loginContext.getRelyingPartyId(), HttpServletHelper.getRelyingPartyConfirmationManager(application)); // the entityID value is the unique SP entityID, it can be used to trigger customization // of the login page entityID = entityDescriptor.getEntityID(); DeviceConfig dc; // this line references the open source browser detection bean dc = mobi.javabeans.browserDetector.DeviceConfigDetector.detectCapabilities(request); if (dc.isMobileBrowser() == true) { log.debug("Found mobile browser request [" + dc.getBrowser() + "/" + dc.getManufacturer() + "]"); doMobile = true; } } catch (Exception e) { log.error("Exception determining SP entityID"); if (application == null) { log.error("application is null"); } if (loginContext == null) { log.error("loginContext is null"); } if (entityDescriptor == null) { log.error("entityDescriptor is null"); } // if we get here, then the user has us bookmarked, send them // to a portal page with some SP choices on it redirectToPage(request, response, null, noAuthnRequestPage); return; } |
...