问题
First of all, I have already went through the previous questions on this subject.
I am trying to customize implementations of org.springframework.security.oauth2.provider.endpoint.TokenEndpoint and CheckTokenEndpoint. I can easily do that but I don't know how to plug that customized implementation in Spring Oauth2 Architecture. I am using @EnableAuthorizationServer annotation in my application. Could someone shed some light?
回答1:
Look at AuthorizationServerEndpointsConfiguration class. There are @Bean definitions of endpoints. Try to register your endpoint definition beans with the same names and register them as @Primary @Bean
i.e
@Primary
@Bean
public CustomTokenEndpoint tokenEndpoint() throws Exception {
...
}
来源:https://stackoverflow.com/questions/38298009/customizing-tokenendpoint-in-spring-oauth2