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