Reputation: 829
I use Spring security with oauth2 but i have a question and i not found any answer, in many example of project you have 2 times configure(HttpSecurity http).
And also
So my question why to configure and when configure the http security in WebSecurityConfigurerAdapter or ResourceServerConfigurerAdapter?
Upvotes: 1
Views: 1839
Reputation: 6571
The ResourceServerConfigurerAdapter is configured for different endpoints (see antMatchers) than the WebSecurityConfigurerAdapter.
The difference between those two adapters is, that the ResourceServerConfigurerAdapter uses a special filter that checks for the bearer token in the request to authenticate the request via OAuth2.
The WebSecurityConfigurerAdapter is used to authenticate the user via a session (form login in the case of your given examples).
Upvotes: 3