ulisesbocchio / spring-boot-security-saml

spring-security-saml integration with Spring Boot
MIT License
158 stars 73 forks source link

how to use SwitchUserFilter with SAML #43

Closed longthanhtran closed 6 years ago

longthanhtran commented 6 years ago

I am trying to get SwitchUserFilter with SAML but stuck with java.lang.IllegalArgumentException: null source when SwitchUserFilter calls SecurityContextHolder.getContext().getAuthentication()

  // publish event
  if (this.eventPublisher != null) {
      this.eventPublisher.publishEvent(new AuthenticationSwitchUserEvent(
              SecurityContextHolder.getContext().getAuthentication(), targetUser));
  }

so I think I don't know how to prepare or use SecurityContextHolder with SAML. Can you please guide me to do that @ulisesbocchio ? Thanks

longthanhtran commented 6 years ago

I figure it out by myself, I miss use WebSecurity to ignore the path which leads to no context.

ulisesbocchio commented 6 years ago

Great!