From 28046fa65d1ad89cd342a901db659b9492d913e0 Mon Sep 17 00:00:00 2001 From: Hyeonjun Park <55674648+phjppo0918@users.noreply.github.com> Date: Sat, 24 Jun 2023 17:52:27 +0900 Subject: [PATCH] =?UTF-8?q?docs=20:=20README=20=EC=9E=91=EC=84=B1=20(#5)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..7793fe5 --- /dev/null +++ b/README.md @@ -0,0 +1,53 @@ +# spring-security-authorization-manager + +![spring-security-authorization-manager](https://socialify.git.ci/SWM-KAWAI-MANS/spring-security-authorization-manager/image?description=1&descriptionEditable=&font=Raleway&language=1&name=1&owner=1&pattern=Floating%20Cogs&stargazers=1&theme=Light) + +### Description +Spring security 인가 설정을 편리하게 지원하는 라이브러리입니다. + +### Features +- JWT를 통한 인가 필터 +- RequestMatcher에 허용되는 Role 구성에 따른 인가권한 부여 +- Filter를 예외하는 exclusions 설정 + +### Getting Started +To get started with spring-security-authorization-manager, follow these steps: + +1. Add the jitpack.io repository to your project's build.gradle file: +```gradle +repositories { + ... + maven { url 'https://jitpack.io' } +} +``` + +2. Add the spring-security-authorization-manager dependency to your app-level build.gradle file: +``` +dependencies { + implementation 'com.github.SWM-KAWAI-MANS:spring-security-authorization-manager:1.0.0' +} +``` + +## 사용법 +1. filter 처리를 안하는 엔드포인트를 설정합니다. application.yml 혹은 properties로 설정하면 됩니다. 만약 처리를 안하는 앤드포인트가 없으면 빈 값으로 두어도 상관 없습니다. +``` +auth: + filter: + exclusions: + - hello + - world +``` + +2. AuthorizationRegistry를 설정합니다. 기본값은 anyRequest().authenticated() 로 설정되어있습니다. +```java +public class CustomAuthorizationRegistry implements AuthorizationRegistry { + @Override + public AuthorizeHttpRequestsConfigurer.AuthorizationManagerRequestMatcherRegistry + match( + AuthorizeHttpRequestsConfigurer + .AuthorizationManagerRequestMatcherRegistry + r) { + return r.anyRequest().authenticated(); + } +} +```