{"id":13694656,"url":"https://github.com/jobmission/oauth2-server","last_synced_at":"2026-02-03T05:45:56.674Z","repository":{"id":42949881,"uuid":"124733764","full_name":"jobmission/oauth2-server","owner":"jobmission","description":"spring boot  (springboot 3+) oauth2 server sso 单点登录 认证中心 JWT,独立部署,用户管理 客户端管理","archived":false,"fork":false,"pushed_at":"2025-04-29T06:46:06.000Z","size":8860,"stargazers_count":523,"open_issues_count":1,"forks_count":227,"subscribers_count":23,"default_branch":"master","last_synced_at":"2025-04-29T07:42:01.043Z","etag":null,"topics":["oauth2-provider","oauth2-server","single-sign-on","sso"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jobmission.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-03-11T07:32:36.000Z","updated_at":"2025-04-29T06:46:04.000Z","dependencies_parsed_at":"2024-04-22T17:16:37.879Z","dependency_job_id":"b5bf6008-d5df-4151-ab58-bec83cdcc140","html_url":"https://github.com/jobmission/oauth2-server","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jobmission%2Foauth2-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jobmission%2Foauth2-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jobmission%2Foauth2-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jobmission%2Foauth2-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jobmission","download_url":"https://codeload.github.com/jobmission/oauth2-server/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252144385,"owners_count":21701399,"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":["oauth2-provider","oauth2-server","single-sign-on","sso"],"created_at":"2024-08-02T17:01:36.658Z","updated_at":"2026-02-03T05:45:56.668Z","avatar_url":"https://github.com/jobmission.png","language":"Java","funding_links":[],"categories":["Java"],"sub_categories":[],"readme":"\n## SpringBoot 4.0+ oauth2 server\n\n#### oauth2 openid 端点\n````\nGet /.well-known/openid-configuration\n````\n\n#### 支持的授权模式grant_type\u003c/br\u003e\n````\nauthorization_code, refresh_token\n````\n#### 接口调用\n````\n1. 获取code，需要 PKCE 方式\nGet /oauth2/authorize\nclient_id=SampleClientId\nresponse_type=code\nredirect_uri=http://localhost:10480/login/oauth2/code/sso-login\nscope=openid profile\ncode_challenge=6bQSbd4AdLzLhBvSPjUjthOJOt5AZcV19-pbjpeRM64\ncode_challenge_method=S256\n\n用户同意授权后服务端响应,浏览器重定向到：http://localhost:10480/login?code=xxxxxxxxxxx，接收code,然后后端调用步骤2获取token\n\n2. 获取token\nPost /oauth2/token\n表单数据, Content-Type: application/x-www-form-urlencoded\nclient_id=SampleClientId\nclient_secret=tgb.258\ngrant_type=authorization_code\nredirect_uri=http://localhost:10480/login/oauth2/code/sso-login\ncode=UqkOyZ1vLRSjpwcZpUcHJYvvGlsenAvk7CH5LsW3oOSE-rE3znA834YrJYSuJKzs25UnxoLIL47W2GA2BuEyK8GZG2qnDkqsaoaASJWd1IgUQ1x3d1XBL6lO-SQGiqZ7\ncode_verifier=UWxD3NZtmkuitGkVdZnbkjjHgolTxOXrMpxesbGYUV3vVHYNo6yLyKGm4rzOaTUAT2phuwzXVfh-ozdulmoXrse10IHlWdj5jf7PdQR0YWFcPvHuOTwGsbTuphpMGCna\n\n响应：\n{\n    \"access_token\": \"a.b.c\",\n    \"refresh_token\": \"d.e.f\",\n    \"scope\": \"openid profile\",\n    \"id_token\": \"h.i.j\",\n    \"token_type\": \"Bearer\",\n    \"expires_in\": 7199\n}\n````\n\n#### 访问受保护资源，请求时携带token\n````\nGet /userinfo?access_token=a.b.c\n或者http header中加入Authorization,如下\nAuthorization: Bearer a.b.c\n````\n\n#### 刷新token\u003c/br\u003e\n````\nPost /oauth2/token?client_id=SampleClientId\u0026client_secret=tgb.258\u0026grant_type=refresh_token\u0026refresh_token=d.e.f\n````\n\n#### 启动方法\u003c/br\u003e\n````\njava -jar oauth2-server-x.y.z.jar\n或者指定配置文件覆盖默认配置\njava -jar oauth2-server-x.y.z.jar --spring.config.additional-location=/path/to/override.properties\n````\n\n#### 管理员角色登录后，可以对用户和client进行管理\u003c/br\u003e\n#### 效果图\n![登录页](https://raw.githubusercontent.com/jobmission/oauth2-server/master/src/test/resources/static/imgs/login.png)\n![用户管理](https://raw.githubusercontent.com/jobmission/oauth2-server/master/src/test/resources/static/imgs/users.png)\n![client管理](https://raw.githubusercontent.com/jobmission/oauth2-server/master/src/test/resources/static/imgs/clients.png)\n\n\n#### 注意！！！当Server和Client在一台机器上时，请配置域名代理，避免cookie相互覆盖，或者修改默认的session id\n````\n#修改默认的JSESSIONID为my_session_id\nserver.servlet.session.cookie.name=oauth2_session_id\n````\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjobmission%2Foauth2-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjobmission%2Foauth2-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjobmission%2Foauth2-server/lists"}