I have created an oauth module for my project. It has the mechanism for authorization server, spring security and the resource server.
I need some of the end-points to be accessible only on authorization, so I configured the security in the resource-server:
@Override
public void configure(HttpSecurity http) throws Exception {
http.requestMatcher(new OrRequestMatcher(new AntPathRequestMatcher("/secured/**")))
.authorizeRequests().anyRequest().authenticated();
}
So far access-token/refresh-token calls are working fine.
Now, I want to create a separate module for all the webservices API - where I would put all the controllers and the logic for processing the requests.
Is it advisable to do it in a different module than oauth? If yes, how can I secure the calls and verify the tokens? How can I use the resource server in another module.