UserDetail과 UserDetailsServiceJdbcUserDetailsManager(UserDetailsService의 구현체)설정 방법재정의해주어야 하는 쿼리Group Based Access Control?
UserDetail Provides core user information. Implementations are not used directly by Spring Security for security purposes. They simply store user information which is later encapsulated into Authentication objects. This allows non-security related user information (such as email addresses, telephone numbers etc) to be stored in a convenient location. Concrete implementations must take particular care to ensure the non-null contract detailed for each method is enforced. See User for a reference implementation (which you might like to extend or use in your code).
UserDetailService Core interface which loads user-specific data. It is used throughout the framework as a user DAO and is the strategy used by the DaoAuthenticationProvider. The interface requires only one read-only method, which simplifies support for new data-access strategies.

UserDetail과 UserDetailsService
JdbcUserDetailsManager(UserDetailsService의 구현체)

설정 방법
- 이름 그대로 JDBC를 통해 데이터베이스에서 사용자 인증 정보를 가져옴
- jdbcAuthentication 메소드는 UserDetailsService 인터페이스 구현체로 JdbcUserDetailsManager 객체를 등록함
- JdbcUserDetailsManager 클래스는 JdbcDaoImpl 클래스를 상속하며, 보다 풍부한 기능을 제공함
inMemoryAuthentication 메소드는 UserDetailsService 인터페이스 구현체로 InMemoryUserDetailsManager 객체를 등록했었다.
재정의해주어야 하는 쿼리

- JdbcDaoImpl 클래스는 수행 목적에 따라 3개의 SQL 쿼리를 정의하고 있는데 이를 위 테이블 구조에 맞게 재정의하여 활용해야 함
- usersByUsernameQuery — 사용자명과 일치하는 하나 이상의 사용자를 조회
- 조회하는 값들은 반드시 username: String, password: String, enabled: Boolean 컬럼 순서이어야함
- authoritiesByUsernameQuery — 사용자에게 직접 부여된 하나 이상의 권한을 반환 (Group-based Access Control 미적용시)
- 조회하는 두 번째 값은 반드시 authority: String 컬럼이어야 함
- groupAuthoritiesByUsernameQuery — 그룹 멤버십을 통해 사용자에게 승인된 권한을 반환 (Group-based Access Control 적용시)
- 조회하는 세 번째 값은 반드시 authority: String 컬럼이어야 함
- JdbcDaoImpl 객체를 Bean으로 등록
- usersByUsernameQuery, groupAuthoritiesByUsernameQuery SQL 쿼리 재정의
- enableGroups — Group-based Access Control 활용시 true 입력
- groupAuthoritiesByUsername 쿼리 정의시 자동으로 true 설정됨
- enableAuthorities — Group-based Access Control 활용시 false 입력
Group Based Access Control?
- 대부분의 어플리케이션에서는
Users → Roles
로도 충분함
- Group을 사용하고 싶은 경우는, 롤이 세분화되어 있고 하나의 유저에 대해서 여러 롤을 적용하고 싶을 때 이용하는 것임