private void impersonateSubject(FilterChain filterChain, HttpServletRequest request, HttpServletResponse response, UserProfile userProfile) throws IOException, ServletException { // Products use the username to set the authentication context. SimplePrincipal principal = new SimplePrincipal(userProfile.getUsername()); final Authenticator.Result authenticationResult = new Authenticator.Result.Success(createMessage("Successful three-legged-auth"), principal); authenticationListener.authenticationSuccess(authenticationResult, request, response); filterChain.doFilter(request, response); }
private void actAsAddonUser(FilterChain filterChain, HttpServletRequest request, HttpServletResponse response, String addonKey) throws IOException, ServletException { try { final Principal principal = getPrincipal(addonKey); final Authenticator.Result authenticationResult = new Authenticator.Result.Success(createMessage("Successful two-legged-auth"), principal); authenticationListener.authenticationSuccess(authenticationResult, request, response); filterChain.doFilter(request, response); } catch (InvalidSubjectException e) { createAndSendFailure(e, response, HttpServletResponse.SC_UNAUTHORIZED, badCredentialsMessage); } }
private void impersonateSubject(FilterChain filterChain, HttpServletRequest request, HttpServletResponse response, UserProfile userProfile) throws IOException, ServletException { // Products use the username to set the authentication context. SimplePrincipal principal = new SimplePrincipal(userProfile.getUsername()); final Authenticator.Result authenticationResult = new Authenticator.Result.Success(createMessage("Successful three-legged-auth"), principal); authenticationListener.authenticationSuccess(authenticationResult, request, response); filterChain.doFilter(request, response); }
private void actAsAddonUser(FilterChain filterChain, HttpServletRequest request, HttpServletResponse response, String addonKey) throws IOException, ServletException { try { final Principal principal = getPrincipal(addonKey); final Authenticator.Result authenticationResult = new Authenticator.Result.Success(createMessage("Successful two-legged-auth"), principal); authenticationListener.authenticationSuccess(authenticationResult, request, response); filterChain.doFilter(request, response); } catch (InvalidSubjectException e) { createAndSendFailure(e, response, HttpServletResponse.SC_UNAUTHORIZED, i18nResolver.getText(BAD_CREDENTIALS_KEY)); } }
authenticationListener.authenticationSuccess(result, request, response); return true; case NO_ATTEMPT:
case SUCCESS: authenticationListener.authenticationSuccess(result, request, response); authenticationSuccessListener.authenticationSuccess(result.getPrincipal(), request, response); return true;
authenticationListener.authenticationSuccess(result, request, response);