List out security concepts
Principal Authentication Authorization Authority Secure resource
What is authority?
Permission or credential enabling access. The most familiar example of authority is a role (string)
List out 5 authentication mechanisms:
Basic Digest Form X.509 OAuth
What is LDAP?
DAP: directory access protocol
LDAP: DAP using TCP/IP
What does authorization do?
check if user has the required authority
What are the advantages of Spring Security?
What does AuthenticationManager do?
authenticate(Authentication) return full Authentication object if successful. Throw AuthenticationException or sub-class if fails
What inside Authentication?
What does AccessDecisionManager do?
Holding list of Voter to decide if the user allows accessing a secured resource
List out default voters in AccessDecisionManager
2. AuthenticatedVoter: logged in as a valid user or not
What is the result of AccessDecisionManager.decide()?
In the big picture of Spring Security, how do components work together to protects secured resources?
What are the steps to setup Spring security in a web environment?
How springSecurityFilterChain works with DelegatingFilterProxy?
List out default filters in springSecurityFilterChain
What does SecurityContextPersistenceFilter do?
What does UsernamePasswordAuthenticationFilter do?
Puts Authentication into the SecurityContext on login request.
What does ExceptionTranslationFilter do?
Converts SpringSecurity exceptions into HTTP response or redirect
What is the default username?
user
How to configure custom security for your application?
@Configuration
@EnableWebSecurity // not need if Spring Boot
class ClassName extends WebSecurityConfigurerAdapter
How to enable security in a web app?
Using @EnableWebSecurity if not using Spring Boot
Ant style: /admin/* vs. /admin/**
/admin/** any path under /admin
/admin/* only matches /admin/xxx
antMatchers vs. mvcMatchers
Similar but there are some issue with antMatchers e.g. antMatchers(“/admin”) matches “/admin/”: potential security risk
mvcMatchers: recommended
Overloads of mvcMatchers
2. mvcMatchers(httpMethod, path)