@Test(expected=BadCredentialsException.class) public void testTicketValidationWrong() throws Exception { when(ticketValidator.validateTicket(TEST_TOKEN)).thenThrow(new BadCredentialsException("")); provider.authenticate(INPUT_TOKEN); }
@Override public Authentication authenticate(Authentication authentication) throws AuthenticationException { KerberosServiceRequestToken auth = (KerberosServiceRequestToken) authentication; byte[] token = auth.getToken(); LOG.debug("Try to validate Kerberos Token"); String username = this.ticketValidator.validateTicket(token); LOG.debug("Succesfully validated " + username); UserDetails userDetails = this.userDetailsService.loadUserByUsername(username); userDetailsChecker.check(userDetails); additionalAuthenticationChecks(userDetails, auth); return new KerberosServiceRequestToken(userDetails, userDetails.getAuthorities(), token); }
KerberosServiceAuthenticationProvider implements
        AuthenticationProvider, InitializingBean { @Override public Authentication authenticate(Authentication authentication) throws AuthenticationException { KerberosServiceRequestToken auth = (KerberosServiceRequestToken) authentication; byte[] token = auth.getToken(); LOG.debug("Try to validate Kerberos Token"); String username = this.ticketValidator.validateTicket(token); LOG.debug("Succesfully validated " + username); UserDetails userDetails = this.userDetailsService.loadUserByUsername(username); userDetailsChecker.check(userDetails); additionalAuthenticationChecks(userDetails, auth); return new KerberosServiceRequestToken(userDetails, userDetails.getAuthorities(), token); } }
KerberosServiceAuthenticationProvider implements
        AuthenticationProvider, InitializingBean { @Override public Authentication authenticate(Authentication authentication) throws AuthenticationException { KerberosServiceRequestToken auth = (KerberosServiceRequestToken) authentication; byte[] token = auth.getToken(); LOG.debug("Try to validate Kerberos Token"); String username = this.ticketValidator.validateTicket(token); LOG.debug("Succesfully validated " + username); UserDetails userDetails = this.userDetailsService.loadUserByUsername(username); userDetailsChecker.check(userDetails); additionalAuthenticationChecks(userDetails, auth); return new KerberosServiceRequestToken(userDetails, userDetails.getAuthorities(), token); }  }
KerberosServiceAuthenticationProvider implements
        AuthenticationProvider, InitializingBean { @Override public Authentication authenticate(Authentication authentication) throws AuthenticationException { KerberosServiceRequestToken auth = (KerberosServiceRequestToken) authentication; byte[] token = auth.getToken(); LOG.debug("Try to validate Kerberos Token"); String username = this.ticketValidator.validateTicket(token); LOG.debug("Succesfully validated " + username); UserDetails userDetails = this.userDetailsService.loadUserByUsername(username); userDetailsChecker.check(userDetails); additionalAuthenticationChecks(userDetails, auth); return new KerberosServiceRequestToken(userDetails, userDetails.getAuthorities(), token); }  void setUserDetailsService(UserDetailsService userDetailsService); void setTicketValidator(KerberosTicketValidator ticketValidator); @Override Authentication authenticate(Authentication authentication); @Override boolean supports(Class<? extends Object> auth); @Override void afterPropertiesSet(); }
KerberosServiceAuthenticationProvider implements
        AuthenticationProvider, InitializingBean { @Override public Authentication authenticate(Authentication authentication) throws AuthenticationException { KerberosServiceRequestToken auth = (KerberosServiceRequestToken) authentication; byte[] token = auth.getToken(); LOG.debug("Try to validate Kerberos Token"); String username = this.ticketValidator.validateTicket(token); LOG.debug("Succesfully validated " + username); UserDetails userDetails = this.userDetailsService.loadUserByUsername(username); userDetailsChecker.check(userDetails); additionalAuthenticationChecks(userDetails, auth); return new KerberosServiceRequestToken(userDetails, userDetails.getAuthorities(), token); }  void setUserDetailsService(UserDetailsService userDetailsService); void setTicketValidator(KerberosTicketValidator ticketValidator); @Override Authentication authenticate(Authentication authentication); @Override boolean supports(Class<? extends Object> auth); @Override void afterPropertiesSet();  }