spring boot security oauth2 jwt


项目源码下载:

https://github.com/alexleolab/spring-oauth.git


测试过程
步骤一:打开浏览器,输入地址

http://localhost:1130/oauth/authorize?client_id=normal-app&response_type=code&scope=read&redirect_uri=/resources/user


用户名alex

密码test





点击Authorize获取code




 打开工具postman,输入以下地址获取授权token,Authorization那一栏选择Basic Auth ,用户名填入normal-app,密码不填
localhost:1130/oauth/token?code=Yourcode&grant_type=authorization_code&client_id=normal-app&redirect_uri=/resources/user








这时候拿到token就可以访问受保护的资源信息了,如下

localhost:8081//resources/user?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOlsic3ByaW5nLWJvb3QtYXBwbGljYXRpb24iXSwidXNlcl9uYW1lIjoibGVmdHNvIiwic2NvcGUiOlsicmVhZCJdLCJyb2xlcyI6W3siYXV0aG9yaXR5IjoiUk9MRV9VU0VSIn1dLCJleHAiOjE0OTEzNTkyMjksInVzZXJOYW1lIjoibGVmdHNvIiwiYXV0aG9yaXRpZXMiOlsiUk9MRV9VU0VSIl0sImp0aSI6IjgxNjI5NzQwLTRhZWQtNDM1Yy05MmM3LWZhOWIyODk5NmYzMiIsImNsaWVudF9pZCI6Im5vcm1hbC1hcHAifQ.YhDJkMSlyIN6uPfSFPbfRuufndvylRmuGkrdprUSJIM




阅读更多
换一批

没有更多推荐了,返回首页