/** * Gets pac4j context. * * @param request the request * @param sessionStore the session store * @return the pac4j context */ public static J2EContext getPac4jJ2EContext(final HttpServletRequest request, final SessionStore sessionStore) { return getPac4jJ2EContext(request, HttpRequestUtils.getHttpServletResponseFromRequestAttributes(), sessionStore); }
/** * Gets pac4j context. * * @param sessionStore the session store * @return the pac4j context */ public static J2EContext getPac4jJ2EContext(final SessionStore sessionStore) { return getPac4jJ2EContext(HttpRequestUtils.getHttpServletRequestFromRequestAttributes(), HttpRequestUtils.getHttpServletResponseFromRequestAttributes(), sessionStore); }
/** * Gets pac4j context. * * @param request the request * @return the pac4j context */ public static J2EContext getPac4jJ2EContext(final HttpServletRequest request) { return getPac4jJ2EContext(request, HttpRequestUtils.getHttpServletResponseFromRequestAttributes(), new J2ESessionStore()); }
/** * Gets pac4j context. * * @return the pac4j context */ public static J2EContext getPac4jJ2EContext() { return getPac4jJ2EContext(HttpRequestUtils.getHttpServletRequestFromRequestAttributes(), HttpRequestUtils.getHttpServletResponseFromRequestAttributes(), new J2ESessionStore()); } }
/** * Return the username of the authenticated user (based on pac4j security). * * @return the authenticated username. */ public static String getPac4jAuthenticatedUsername() { val request = HttpRequestUtils.getHttpServletRequestFromRequestAttributes(); val response = HttpRequestUtils.getHttpServletResponseFromRequestAttributes(); if (request != null && response != null) { val manager = getPac4jProfileManager(request, response); val profile = (Optional<CommonProfile>) manager.get(true); if (profile != null && profile.isPresent()) { val id = profile.get().getId(); if (id != null) { return id; } } } return PrincipalResolver.UNKNOWN_USER; }
val adaptor = adaptorRes.orElseThrow(() -> new IllegalArgumentException("Unable to find metadata for saml service " + serviceId)); val httpRequest = HttpRequestUtils.getHttpServletRequestFromRequestAttributes(); val httpResponse = HttpRequestUtils.getHttpServletResponseFromRequestAttributes(); samlObjectSigner.encode(samlLogoutRequest, samlService, adaptor, httpResponse, httpRequest, binding, samlLogoutRequest);