Package org.springframework.security.web.authentication.switchuser

Examples of org.springframework.security.web.authentication.switchuser.AuthenticationSwitchUserEvent


  private static class WebAuditListener {

    public void process(AuthenticationAuditListener listener,
        AbstractAuthenticationEvent input) {
      if (listener != null) {
        AuthenticationSwitchUserEvent event = (AuthenticationSwitchUserEvent) input;
        Map<String, Object> data = new HashMap<String, Object>();
        if (event.getAuthentication().getDetails() != null) {
          data.put("details", event.getAuthentication().getDetails());
        }
        data.put("target", event.getTargetUser().getUsername());
        listener.publish(new AuditEvent(event.getAuthentication().getName(),
            "AUTHENTICATION_SWITCH", data));
      }

    }
View Full Code Here


    verify(this.publisher).publishEvent((ApplicationEvent) anyObject());
  }

  @Test
  public void testAuthenticationSwitch() {
    this.listener.onApplicationEvent(new AuthenticationSwitchUserEvent(
        new UsernamePasswordAuthenticationToken("user", "password"), new User(
            "user", "password", AuthorityUtils
                .commaSeparatedStringToAuthorityList("USER"))));
    verify(this.publisher).publishEvent((ApplicationEvent) anyObject());
  }
View Full Code Here

TOP

Related Classes of org.springframework.security.web.authentication.switchuser.AuthenticationSwitchUserEvent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.