(Cheat Sheet by Michelle Ferreirae)
Authentication (or “access control”) is a process to verify the identity of a particular user.
AuthenticationManager
:public interface AuthenticationManager {
Authentication authenticate(Authentication authentication)
throws AuthenticationException;
}
and an implemented ProviderManager
and a series of AuthenticationProvider
instances:
public interface AuthenticationProvider {
Authentication authenticate(Authentication authentication)
throws AuthenticationException;
boolean supports(Class<?> authentication);
}
ProviderManager
s can have children which in turn have their own respective AuthenticationProvider
s.
AuthenticationManagerBuilder
class is used for quickly setting up authentication features, and uses the @Autowired
annotation to build AuthenticationManager
s.AccessDecisionManager
may handle multiple instances of AccessDecisionVoter
Filter
s are @Bean
s that have systems of prioritizing their order (by the DEFAULT_ORDER
property).
FilterRegistrationBeans
or else not be made @Bean
s.FilterChainProxy
) but has several layers of sub-filters in alternate alternate chains internally.
FilterChainProxy
to cover common routes (like /error
or /images/**
) as well as a wildcard route (/**
) for other cases.HttpSecurity
further controls authorization.@EnableGlobalMethodSecurity(securedEnables = true)
) by annotating particular methods. The following example is from the Spring guide on authorization:@Service
public class MyService {
@Secured("ROLE_USER")
public String secure() {
return "Hello Security";
}
}