|
@ -0,0 +1,23 @@
|
|
|
package com.yihu.jw.base.config;
|
|
|
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
import org.springframework.data.domain.AuditorAware;
|
|
|
import org.springframework.security.core.Authentication;
|
|
|
import org.springframework.security.core.context.SecurityContext;
|
|
|
import org.springframework.security.core.context.SecurityContextHolder;
|
|
|
|
|
|
import java.util.Optional;
|
|
|
|
|
|
@Configuration
|
|
|
public class SpringSecurityAuditorAware implements AuditorAware {
|
|
|
@Override
|
|
|
public Object getCurrentAuditor() {
|
|
|
// return Optional.ofNullable(SecurityContextHolder.getContext())
|
|
|
// .map(SecurityContext::getAuthentication)
|
|
|
// .filter(Authentication::isAuthenticated)
|
|
|
// .map(Authentication::getPrincipal);
|
|
|
//// .map(Authentication::getDetails);
|
|
|
|
|
|
return "123";
|
|
|
}
|
|
|
}
|