스프링 시큐리티
Spring 기반 애플리케이션을 보호하기 위한 사실상의 표준
아파치 2 라이선스
Spring Security는 Apache 2.0 라이센스 하에 출시된 오픈 소스 소프트웨어 입니다.
시작하기
애플리케이션 보안을 시작할 준비가 되었다면 servlet 및 react 에 대한 시작하기 섹션을 참조하십시오 . 이 섹션에서는 첫 번째 Spring Security 애플리케이션을 만드는 과정을 안내합니다.
Spring Security의 작동 방식을 이해하려면 아키텍처 섹션을 참조하십시오.
질문이 있으시면 기꺼이 도와줄 멋진 커뮤니티 가 있습니다!
전제 조건
Spring Security에는 Java 8 이상의 런타임 환경이 필요합니다.
도움을 받다
Spring Security에 대한 도움이 필요하시면 저희가 도와드리겠습니다. 다음은 도움을 받는 가장 좋은 방법입니다.
- 이 문서를 읽으십시오.
- 많은 샘플 응용 프로그램 중 하나를 사용해 보십시오 .
- 태그 와 함께 https://stackoverflow.com 에서 질문 하세요.
spring-security
- https://github.com/spring-projects/spring-security/issues 에서 버그 및 개선 요청을 보고 하세요.
참여하기
Spring Security 프로젝트에 여러분의 참여를 환영합니다. 스택 오버플로에 대한 질문에 답하고, 새 코드를 작성하고, 기존 코드를 개선하고, 문서를 지원하고, 샘플 또는 자습서를 개발하고, 버그를 보고하거나, 단순히 제안하는 등 다양한 방법으로 기여할 수 있습니다. 자세한 내용은 기여 문서를 참조하십시오.
스프링 시큐리티 5.7의 새로운 기능
Spring Security 5.7은 많은 새로운 기능을 제공합니다. 다음은 릴리스의 주요 내용입니다.
Servlet
- Web
- Introduced
RequestAttributeSecurityContextRepository
- Introduced
SecurityContextHolderFilter
- Ability to require explicit saving of theSecurityContext
- Added DSL support for Cross Origin Policies headers
- OAuth 2.0 Client
- Allow configuring PKCE for confidential clients
- Allow configuring a JWT assertion resolver in
JwtBearerOAuth2AuthorizedClientProvider
- Allow customizing claims on JWT client assertions
- SAML 2.0
WebFlux
- Web
- Allow customizing charset in
ServerHttpBasicAuthenticationConverter
- Added DSL support for Cross Origin Policies headers
- OAuth 2.0 Client
- Allow configuring PKCE for confidential clients
- Allow configuring a JWT assertion resolver in
JwtBearerReactiveOAuth2AuthorizedClientProvider
Getting-Spring-Security
Gradle을 사용한 스프링 부트
dependencies { compile "org.springframework.boot:spring-boot-starter-security" }
특징
Spring Security는 인증 , 권한 부여 및 일반적인 악용 에 대한 보호를 위한 포괄적인 지원을 제공 합니다 . 또한 다른 라이브러리와의 통합을 제공하여 사용을 단순화합니다.
Section Summary
Authentication
Spring Security는 인증 에 대한 포괄적인 지원을 제공 합니다 . 인증은 특정 리소스에 액세스하려는 사람의 신원을 확인하는 방법입니다. 사용자를 인증하는 일반적인 방법은 사용자에게 사용자 이름과 암호를 입력하도록 요구하는 것입니다. 인증이 수행되면 우리는 신원을 알고 승인을 수행할 수 있습니다.
Spring Security는 사용자 인증을 위한 내장 지원을 제공합니다. 이 섹션은 Servlet 및 WebFlux 환경 모두에 적용되는 일반 인증 지원에 전념합니다. 각 스택에서 지원되는 항목에 대한 자세한 내용은 Servlet 및 WebFlux에 대한 인증 섹션을 참조하세요 .
비밀번호 저장

Protection Against Exploits(취약점)
Spring Security는 일반적인 악용에 대한 보호를 제공합니다. 가능한 경우 보호는 기본적으로 활성화됩니다. 아래에서 Spring Security가 보호하는 다양한 익스플로잇에 대한 높은 수준의 설명을 찾을 수 있습니다.
Section Summary
Cross Site Request Forgery (CSRF)

보안 HTTP 응답 헤더
문서의 이 부분에서는 보안 HTTP 응답 헤더의 일반적인 주제에 대해 설명합니다. 보안 HTTP 응답 헤더 서블릿 및 WebFlux 기반 응용 프로그램 에 대한 특정 정보는 관련 섹션을 참조하십시오 .
웹 애플리케이션의 보안을 강화하는 데 사용할 수 있는 많은 HTTP 응답 헤더 가 있습니다. 이 섹션은 Spring Security가 명시적으로 지원하는 다양한 HTTP 응답 헤더 전용입니다. 필요한 경우 사용자 정의 헤더 를 제공하도록 Spring Security를 구성할 수도 있습니다 .
3

HTTP
프레임워크로서 Spring Security는 HTTP 연결을 처리하지 않으므로 HTTPS에 대한 지원을 직접 제공하지 않습니다. 그러나 HTTPS 사용에 도움이 되는 여러 기능을 제공합니다.

통합
Spring Security는 수많은 프레임워크 및 API와의 통합을 제공합니다. 이 섹션에서는 Servlet 또는 Reactive 환경에만 국한되지 않는 일반적인 통합에 대해 설명합니다. 특정 통합을 보려면 서블릿 및 반응성 통합 섹션을 참조하십시오.
Section Summary
서블릿 애플리케이션
Spring Security는 표준 Servlet
Filter
을 사용하여 Servlet Container와 통합됩니다. 이것은 서블릿 컨테이너에서 실행되는 모든 애플리케이션과 함께 작동한다는 것을 의미합니다. 보다 구체적으로, Spring Security를 활용하기 위해 서블릿 기반 애플리케이션에서 Spring을 사용할 필요가 없습니다.
반응성 애플리케이션
반응형 응용 프로그램은 서블릿 응용 프로그램 과 매우 다르게 작동 합니다. 이 섹션에서는 Spring Security가 일반적으로 Spring의 WebFlux를 사용하여 작성된 반응 애플리케이션과 어떻게 작동하는지 논의합니다.
Below is a comprehensive list of Spring Security Filter ordering:
- ChannelProcessingFilter
- WebAsyncManagerIntegrationFilter
- SecurityContextPersistenceFilter
- HeaderWriterFilter
- CorsFilter
- CsrfFilter
- LogoutFilter
- OAuth2AuthorizationRequestRedirectFilter
- Saml2WebSsoAuthenticationRequestFilter
- X509AuthenticationFilter
- AbstractPreAuthenticatedProcessingFilter
- CasAuthenticationFilter
- OAuth2LoginAuthenticationFilter
- Saml2WebSsoAuthenticationFilter
- OpenIDAuthenticationFilter
- DefaultLoginPageGeneratingFilter
- DefaultLogoutPageGeneratingFilter
- ConcurrentSessionFilter
- BearerTokenAuthenticationFilter
- RequestCacheAwareFilter
- SecurityContextHolderAwareRequestFilter
- JaasApiIntegrationFilter
- RememberMeAuthenticationFilter
- AnonymousAuthenticationFilter
- OAuth2AuthorizationCodeGrantFilter
- SessionManagementFilter
- SwitchUserFilter
Authentication Mechanisms
- Username and Password - how to authenticate with a username/password
- OAuth 2.0 Login - OAuth 2.0 Log In with OpenID Connect and non-standard OAuth 2.0 Login (i.e. GitHub)
- SAML 2.0 Login - SAML 2.0 Log In
- Central Authentication Server (CAS) - Central Authentication Server (CAS) Support
- Remember Me - how to remember a user past session expiration
- JAAS Authentication - authenticate with JAAS
- OpenID - OpenID Authentication (not to be confused with OpenID Connect)
- Pre-Authentication Scenarios - authenticate with an external mechanism such as SiteMinder or Java EE security but still use Spring Security for authorization and protection against common exploits.
- X509 Authentication - X509 Authentication