# SpringSecurityOauth2Demo **Repository Path**: HollowTree/spring-security-oauth2-demo ## Basic Information - **Project Name**: SpringSecurityOauth2Demo - **Description**: https://www.bilibili.com/video/BV1gb4y1b7XE?p=38&spm_id_from=pageDriver 对应源码第二部分 - **Primary Language**: Java - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2022-02-11 - **Last Updated**: 2022-12-21 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # authorization_code 模式 http://localhost:8080/showLogin ### 1 GET请求当前链接,拿取授权码 http://localhost:8080/oauth/authorize?response_type=code&client_id=admin&redirect_uri=http://www.baidu.com&scope=all ### 2 POST请求当前链接,拿取TOKEN http://localhost:8080/oauth/token 注意验证信息需要填写 类型 :basic auth [{"previewInfoTooltip":{"header":"This header was automatically added","body":"This header is added because of the authorization method used for this request.\n\nThe value of this header is tentative. You can find the exact value in the console once the request is sent.\n\nUse the authorization tab to remove authorization or to change the value of this header."},"disableEdit":true,"sortOrder":1,"overridden":false,"key":"Authorization","value":"Basic YWRtaW46MTIz","system":true,"auth":true,"enabled":true,"enableSettingToTurnOffPreviewEntity":false,"previewEntityWithHelper":"Go to authorization"}] 需要填写参数 [{"key":"grant_type","value":"authorization_code","description":"","type":"default","enabled":true},{"key":"code","value":"VoTdDE","description":"","type":"default","enabled":true},{"key":"client_id","value":"admin","description":"","type":"default","enabled":true},{"key":"redirect_uri","value":"http://www.baidu.com","description":"","type":"default","enabled":true}] ### 3 GET请求当前链接,获取资源 http://localhost:8080/user/getCurrentUser # password 模式 ### 1 POST请求当前链接,拿取TOKEN http://localhost:8080/oauth/token 注意验证信息需要填写 类型 :basic auth 账户密码来自AuthorizationServerConfig中的ClientDetailsServiceConfigurer配置 而body中的账户密码,是实际登陆者,来自UserService.loadUserByUsername中请求的用户数据 ### 2 GET请求当前链接,获取资源 http://localhost:8080/user/getCurrentUser