разобрался, чтобы не писать свои велосипеды нужно подключить compile group: 'org.springframework.security.oauth.boot', name: 'spring-security-oauth2-autoconfigure', version: '2.1.0.RELEASE' для 4ой версии спринга, отсюда понадобится один класс UserInfoTokenServices :
и еще нужно добавить RequestContextListener ( No thread-bound request found: Are you referring to request attributes outside of an actual web request, ...)
public class WebAppInitializer implements WebApplicationInitializer {
private static final String MAPPING_URL = "/";
@Override
public void onStartup(ServletContext servletContext) throws ServletException {
// Create the 'root' Spring application context
AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext();
rootContext.register(AppConfig.class);
rootContext.registerShutdownHook();
// Manage the lifecycle of the root application context
servletContext.addListener(new ContextLoaderListener(rootContext));
// Create the dispatcher servlet's Spring application context
AnnotationConfigWebApplicationContext dispatcherContext = new AnnotationConfigWebApplicationContext();
dispatcherContext.registerShutdownHook();
// Register and map the dispatcher servlet
ServletRegistration.Dynamic dispatcher = servletContext.addServlet("dispatcher",
new DispatcherServlet(dispatcherContext));
dispatcher.setLoadOnStartup(1);
dispatcher.addMapping(MAPPING_URL);
servletContext.addListener(new RequestContextListener());
}
}
Написано
Войдите на сайт
Чтобы задать вопрос и получить на него квалифицированный ответ.
и еще нужно добавить RequestContextListener ( No thread-bound request found: Are you referring to request attributes outside of an actual web request, ...)