{"id":18032842,"url":"https://github.com/syakuis/spring-security-oauth","last_synced_at":"2026-05-09T09:54:28.115Z","repository":{"id":45721119,"uuid":"342989169","full_name":"syakuis/spring-security-oauth","owner":"syakuis","description":"Authorization Server and Resource server with Spring Security. (JWT for OAuth 2.0)","archived":false,"fork":false,"pushed_at":"2022-07-25T01:12:23.000Z","size":620,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-10T06:41:39.774Z","etag":null,"topics":["authentication","authorization","authorization-server","jwt","oauth","oauth2","resource-server","security","spring","spring-boot","spring-security","spring-security-oauth2"],"latest_commit_sha":null,"homepage":"https://syaku.tistory.com/397","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/syakuis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-02-28T00:36:07.000Z","updated_at":"2022-07-28T07:39:40.000Z","dependencies_parsed_at":"2022-09-08T15:12:14.141Z","dependency_job_id":null,"html_url":"https://github.com/syakuis/spring-security-oauth","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":"syakuis/spring-gradle-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syakuis%2Fspring-security-oauth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syakuis%2Fspring-security-oauth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syakuis%2Fspring-security-oauth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syakuis%2Fspring-security-oauth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/syakuis","download_url":"https://codeload.github.com/syakuis/spring-security-oauth/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247256116,"owners_count":20909240,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["authentication","authorization","authorization-server","jwt","oauth","oauth2","resource-server","security","spring","spring-boot","spring-security","spring-security-oauth2"],"created_at":"2024-10-30T10:15:59.183Z","updated_at":"2026-05-09T09:54:23.089Z","avatar_url":"https://github.com/syakuis.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Spring Security OAuth2 - Authorization Server\n\nSpring Security OAuth2를 기반으로 인증/인가를 제공하기 위한 목적으로 개발된 Identity Provider(IDP) Service 입니다.\n\nSpring Security팀에서 [spring security oauth](https://github.com/spring-attic/spring-security-oauth) 프로젝트를 더 이상 지원하지 않기로 하였습니다. 하지만 사용하는 데에 문제가 없고 많은 커뮤니티 정보를 보유하고 있는 프로젝트라서 판단하여 레거시 버전으로 IDP를 개발하게 되었습니다.\n\n추후 고도화된 [Spring Security Authorization](https://github.com/spring-projects/spring-authorization-server) 버전으로 제공할 계획입니다.\n\n## 서비스 소개\n\n### Account\n\n계정을 관리하는 API 서비스입니다. 사용사가 인증을 받기 위한 최소한의 필수 정보를 담고있습니다. `username`이 일반적으로 `id` 정보에 해당합니다.\n\n`account-core` 모듈은 다른 서비스에서도 사용될 클래스를 제공하기 위한 공통적인 모듈입니다.\n\n### Client Registration\n\n특정 애플리케이션(이하 웹서비스, 모바일 애플리케이션, 클라이언트 애플리케이션)에서 인증과 인가를 받기 위해서는 사전에 애플리케이션 정보를 등록해야 합니다.\n애플리케이션 정보를 관리하는 API 서비스입니다.\n\n`client-registration-core` 모듈은 다른 서비스에서도 사용될 클래스를 제공하기 위한 공통적인 모듈입니다.\n\n### Authorization\n\n인증/인가를 제공하는 API 서비스입니다. 인증 방식은 `authorization code`, `client credentials`, `password` 총 3가지를 제공합니다.\n\n## 개발 사양\n\n- java 17\n- gradle 7\n- spring boot\n- spring security oauth 2.5.2\n- spring data jpa \u0026 mysql 8\n- redis 7\n\n## 설치\n\n## 자원 서버 인증 설정\n\nSpring Configuration\n\n```java\n@EnableResourceServer\n@SpringBootApplication\npublic class Application {\n}\n\nor\n\n@EnableResourceServer\n@EnableWebSecurity\npublic class WebMvcSecurityConfiguration extends WebSecurityConfigurerAdapter implements ResourceServerConfigurer {\n    @Override\n    public void configure(HttpSecurity http) throws Exception {\n        http\n            .authorizeRequests(\n                authorize -\u003e authorize\n                    .anyRequest().authenticated());\n    }\n}\n```\n\n### 불투명 토큰(opaque token) 인증 설정\n\nhttps://docs.spring.io/spring-security/reference/servlet/oauth2/resource-server/opaque-token.html\n\napplication.yml\n\n```yaml\nspring:\n  security:\n    oauth2:\n      resourceserver:\n        opaque-token:\n          introspection-uri: https://idp.example.com/introspect\n          client-id: client\n          client-secret: secret\n```\n\n### jwt 토큰 인증 설정\n\nhttps://docs.spring.io/spring-security/reference/servlet/oauth2/resource-server/jwt.html\n\napplication.yml\n\n```yaml\nspring:\n  security:\n    oauth2:\n      resourceserver:\n        jwt:\n          jwk-set-uri:\n```\n\n### 인증 후 인증 속성 조회\n\nhttps://docs.spring.io/spring-security/reference/servlet/oauth2/resource-server/opaque-token.html#oauth2resourceserver-opaque-attributes\n\n```java\n@GetMapping(\"/foo\")\npublic String foo(BearerTokenAuthentication authentication) {\n    return authentication.getTokenAttributes().get(\"sub\") + \" is the subject\";\n}\n\n--- loggin ---\nBearerTokenAuthentication [Principal=org.springframework.security.oauth2.server.resource.introspection.OAuth2IntrospectionAuthenticatedPrincipal@695466d8, Credentials=[PROTECTED], Authenticated=true, Details=WebAuthenticationDetails [RemoteIpAddress=127.0.0.1, SessionId=null], Granted Authorities=[]]\n\nor\n\n@GetMapping(\"/foo\")\npublic String foo(@AuthenticationPrincipal OAuth2AuthenticatedPrincipal principal) {\n    return principal.getAttribute(\"sub\") + \" is the subject\";\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsyakuis%2Fspring-security-oauth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsyakuis%2Fspring-security-oauth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsyakuis%2Fspring-security-oauth/lists"}