This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| back-end:spring:security [2021/04/26 14:28] – [Authentication] Diagram 링크 삭제 ledyx | back-end:spring:security [2021/04/29 15:23] (current) – [WebSecurityConfigurerAdapter] configure() 설명 추가 ledyx | ||
|---|---|---|---|
| Line 9: | Line 9: | ||
| * Authentication : 인증. “유효한 사용자인가? | * Authentication : 인증. “유효한 사용자인가? | ||
| * Authorization : 허가(권한 부여). 유효한 사용자가 이 작업을 할 수 있는가? | * Authorization : 허가(권한 부여). 유효한 사용자가 이 작업을 할 수 있는가? | ||
| - | |||
| - | {{https:// | ||
| - | |||
| === Documents === | === Documents === | ||
| * [[https:// | * [[https:// | ||
| + | * [[https:// | ||
| * [[https:// | * [[https:// | ||
| * [[https:// | * [[https:// | ||
| - | |||
| - | |||
| - | |||
| - | |||
| == Authentication == | == Authentication == | ||
| [[https:// | [[https:// | ||
| + | |||
| + | {{: | ||
| + | |||
| + | * 모두 Interface | ||
| < | < | ||
| classDiagram | classDiagram | ||
| class AuthenticationManager { | class AuthenticationManager { | ||
| - | | + | authenticate(Authentication authentication) |
| } | } | ||
| | | ||
| class AuthenticationProvider { | class AuthenticationProvider { | ||
| - | | + | authenticate(Authentication authentication) |
| - | | + | supports(Class~?~ authentication) |
| } | } | ||
| - | + | ||
| - | | + | class UserDetailsService { |
| + | loadUserByUsername(String username) UserDetails | ||
| + | } | ||
| + | |||
| + | class UserDetails { | ||
| + | getAuthorities() Collection~? | ||
| + | getPassword() String | ||
| + | isAccountNonExpired() boolean | ||
| + | isAccountNonLocked() boolean | ||
| + | isCredentialsNonExpired() boolean | ||
| + | isEnabled() boolean | ||
| + | } | ||
| + | | ||
| AuthenticationManager --> AuthenticationProvider : authRequest | AuthenticationManager --> AuthenticationProvider : authRequest | ||
| + | AuthenticationProvider <..> UserDetailsService : 서비스 주입 후 authenticate()에서 사용자 정보를 꺼내어 사용 | ||
| + | UserDetailsService -- UserDetails | ||
| </ | </ | ||
| + | |||
| + | === AuthenticationManager === | ||
| + | |||
| + | * [[https:// | ||
| + | * 기본 구현체 : [[https:// | ||
| + | * [[https:// | ||
| + | |||
| + | {{: | ||
| + | |||
| + | === AuthenticationProvider | ||
| + | |||
| + | * [[https:// | ||
| + | |||
| + | {{: | ||
| + | |||
| + | === UserDetailsService | ||
| + | |||
| + | " | ||
| + | |||
| + | {{: | ||
| + | |||
| + | 또 다른 사용자 정보를 담는 Bean을 만들기보다 이를 상속해서 사용하는게 일을 덜 할 수 있으리라 판단된다. | ||
| + | |||
| + | 마음에 드는 구현체가 없다면 이 Interface를 상속받아서 재정의. | ||
| + | |||
| + | 자식 Interface인 [[https:// | ||
| + | |||
| + | |||
| + | ---- | ||
| + | |||
| + | |||
| + | === WebSecurityConfigurerAdapter === | ||
| + | |||
| + | 전역적인(globally) authentication이 필요할 때 사용. | ||
| + | |||
| + | [[https:// | ||
| + | |||
| + | * **protected void configure(AuthenticationManagerBuilder auth)** | ||
| + | * Used by the default implementation of authenticationManager() to attempt to obtain an AuthenticationManager. | ||
| + | * **protected void configure(HttpSecurity http)** | ||
| + | * Override this method to configure the HttpSecurity. | ||
| + | * **void configure(WebSecurity web)** | ||
| + | * Override this method to configure WebSecurity. | ||
| + | |||
| + | {{: | ||
| + | |||
| + | * WebSecurityConfigurerAdapter, | ||
| + | * WebSecurity : final class | ||
| + | |||
| + | < | ||
| + | classDiagram | ||
| + | class SecurityConfigurer~O, | ||
| + | init(B builder) | ||
| + | configure(B builder) | ||
| + | } | ||
| + | | ||
| + | class WebSecurityConfigurer~T extends SecurityBuilder<Filter>~ | ||
| + | | ||
| + | class SecurityBuilder~O~ { | ||
| + | build() O | ||
| + | } | ||
| + | | ||
| + | class AbstractSecurityBuilder~O~ | ||
| + | | ||
| + | class AbstractConfiguredSecurityBuilder~O, | ||
| + | | ||
| + | class WebSecurity | ||
| + | | ||
| + | SecurityConfigurer <|-- WebSecurityConfigurer : <Filter, | ||
| + | WebSecurityConfigurer | ||
| + | | ||
| + | SecurityBuilder <|-- AbstractSecurityBuilder | ||
| + | AbstractSecurityBuilder <|-- AbstractConfiguredSecurityBuilder | ||
| + | AbstractConfiguredSecurityBuilder <|-- WebSecurity : <Filter, WebSecurity> | ||
| + | | ||
| + | Aware <|-- ApplicationContextAware | ||
| + | SecurityBuilder <|-- WebSecurity : <Filter> | ||
| + | ApplicationContextAware <|-- WebSecurity | ||
| + | </ | ||
| + | |||
| + | |||
| == Authorization == | == Authorization == | ||