@Test public void testAuth() { PortalPersonUserDetails details = (PortalPersonUserDetails) filter.getPreAuthenticatedPrincipal(request); assertEquals(this.username, details.getUsername()); }
@Override protected Object getPreAuthenticatedPrincipal(HttpServletRequest request) { final Jws<Claims> userinfo = idTokenFactory.getUserInfo(request); if (userinfo != null) { final String username = userinfo.getBody().getSubject(); logger.debug( "Processing authentication for username='{}' based on OIDC Id token in the {} header", username, HttpHeaders.AUTHORIZATION); final IPerson person = personService.getPerson(username); return new PortalPersonUserDetails(person); } final HttpSession session = request.getSession(false); if (session != null) { final IPerson person = personManager.getPerson(request); logger.debug("getPreAuthenticatedPrincipal -- person=[{}]", person); return new PortalPersonUserDetails(person); } return null; }
PortalPreAuthenticatedProcessingFilter extends AbstractPreAuthenticatedProcessingFilter { @Override protected Object getPreAuthenticatedPrincipal(HttpServletRequest request) { final Jws<Claims> userinfo = idTokenFactory.getUserInfo(request); if (userinfo != null) { final String username = userinfo.getBody().getSubject(); logger.debug( "Processing authentication for username='{}' based on OIDC Id token in the {} header", username, HttpHeaders.AUTHORIZATION); final IPerson person = personService.getPerson(username); return new PortalPersonUserDetails(person); } final HttpSession session = request.getSession(false); if (session != null) { final IPerson person = personManager.getPerson(request); logger.debug("getPreAuthenticatedPrincipal -- person=[{}]", person); return new PortalPersonUserDetails(person); } return null; } }
PortalPreAuthenticatedProcessingFilter extends AbstractPreAuthenticatedProcessingFilter { @Override protected Object getPreAuthenticatedPrincipal(HttpServletRequest request) { final Jws<Claims> userinfo = idTokenFactory.getUserInfo(request); if (userinfo != null) { final String username = userinfo.getBody().getSubject(); logger.debug( "Processing authentication for username='{}' based on OIDC Id token in the {} header", username, HttpHeaders.AUTHORIZATION); final IPerson person = personService.getPerson(username); return new PortalPersonUserDetails(person); } final HttpSession session = request.getSession(false); if (session != null) { final IPerson person = personManager.getPerson(request); logger.debug("getPreAuthenticatedPrincipal -- person=[{}]", person); return new PortalPersonUserDetails(person); } return null; }  }
PortalPreAuthenticatedProcessingFilter extends AbstractPreAuthenticatedProcessingFilter { @Override protected Object getPreAuthenticatedPrincipal(HttpServletRequest request) { final Jws<Claims> userinfo = idTokenFactory.getUserInfo(request); if (userinfo != null) { final String username = userinfo.getBody().getSubject(); logger.debug( "Processing authentication for username='{}' based on OIDC Id token in the {} header", username, HttpHeaders.AUTHORIZATION); final IPerson person = personService.getPerson(username); return new PortalPersonUserDetails(person); } final HttpSession session = request.getSession(false); if (session != null) { final IPerson person = personManager.getPerson(request); logger.debug("getPreAuthenticatedPrincipal -- person=[{}]", person); return new PortalPersonUserDetails(person); } return null; }  @Autowired void setIdentitySwapperManager(IdentitySwapperManager identitySwapperManager); @Autowired void setPersonManager(IPersonManager personManager); @Autowired void setPersonService(PersonService personService); @Autowired void setAuthenticationService(Authentication authenticationService); @Autowired void setIdTokenFactory(IdTokenFactory idTokenFactory); void setClearSecurityContextPriorToPortalAuthentication(boolean b); @Autowired void setSecurityContextFactories(Set<ISecurityContextFactory> securityContextFactories); @Override void afterPropertiesSet(); void setLoginPath(String loginPath); void setLogoutPath(String logoutPath); @Override void doFilter(ServletRequest request, ServletResponse response, FilterChain chain); @Override void setApplicationEventPublisher(
            ApplicationEventPublisher anApplicationEventPublisher); }
PortalPreAuthenticatedProcessingFilter extends AbstractPreAuthenticatedProcessingFilter { @Override protected Object getPreAuthenticatedPrincipal(HttpServletRequest request) { final Jws<Claims> userinfo = idTokenFactory.getUserInfo(request); if (userinfo != null) { final String username = userinfo.getBody().getSubject(); logger.debug( "Processing authentication for username='{}' based on OIDC Id token in the {} header", username, HttpHeaders.AUTHORIZATION); final IPerson person = personService.getPerson(username); return new PortalPersonUserDetails(person); } final HttpSession session = request.getSession(false); if (session != null) { final IPerson person = personManager.getPerson(request); logger.debug("getPreAuthenticatedPrincipal -- person=[{}]", person); return new PortalPersonUserDetails(person); } return null; }  @Autowired void setIdentitySwapperManager(IdentitySwapperManager identitySwapperManager); @Autowired void setPersonManager(IPersonManager personManager); @Autowired void setPersonService(PersonService personService); @Autowired void setAuthenticationService(Authentication authenticationService); @Autowired void setIdTokenFactory(IdTokenFactory idTokenFactory); void setClearSecurityContextPriorToPortalAuthentication(boolean b); @Autowired void setSecurityContextFactories(Set<ISecurityContextFactory> securityContextFactories); @Override void afterPropertiesSet(); void setLoginPath(String loginPath); void setLogoutPath(String logoutPath); @Override void doFilter(ServletRequest request, ServletResponse response, FilterChain chain); @Override void setApplicationEventPublisher(
            ApplicationEventPublisher anApplicationEventPublisher);  }