work on different mechanisms of accessing the currently authenticated principal
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
package org.baeldung.security;
|
||||
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class AuthenticationFacade implements IAuthenticationFacade {
|
||||
|
||||
public AuthenticationFacade() {
|
||||
super();
|
||||
}
|
||||
|
||||
// API
|
||||
|
||||
@Override
|
||||
public final Authentication getAuthentication() {
|
||||
return SecurityContextHolder.getContext().getAuthentication();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user