Professional Documents
Culture Documents
// ...
@Override
protected void configure(HttpSecurity http) throws Exception {
// @formatter:off
http
.authorizeRequests(a -> a
.antMatchers("/", "/error",
"/webjars/**").permitAll()
.anyRequest().authenticated()
)
.exceptionHandling(e -> e
.authenticationEntryPoint(new
HttpStatusEntryPoint(HttpStatus.UNAUTHORIZED))
)
.oauth2Login();
// @formatter:on
}
On the client, we just need to provide a logout button and some JavaScript to call
back to the server to ask for the authentication to be cancelled. First, in the
"authenticated" section of the UI, we add the button:
index.html