July 2018
Intermediate to advanced
268 pages
7h 36m
English
Spring Security can be used to set up URL-based authorization. HTTP Security configured can be used with Spring Security configuration to achieve the desired authorization. In many examples that we have gone through so far, we have seen pattern matching authorization. Here is one such example:
http .antMatcher("/rest/**") .httpBasic() .disable() .authorizeRequests() .antMatchers("/rest/movie/**", "/rest/ticket/**", "/index") .hasRole("ROLE_USER");
In the preceding code snippet, the /rest URL's basic authentication is disabled, and for other URLs (/rest/movie, /rest/ticket and /index), users with the USER role have access. The snippet also shows single match (using ...
Read now
Unlock full access