当前位置:网站首页>Oauth2.0 authentication, login and access "/oauth/token", how to get the value of request header authorization (basictoken)???
Oauth2.0 authentication, login and access "/oauth/token", how to get the value of request header authorization (basictoken)???
2022-07-03 02:18:00 【King in the world TJM】
springcloud Projects usually use oauth2.0 Do authentication management micro service module , When using grantType="password" and jwt Storage token when , Need to set up clientId and clientSecret, These two values can be taken arbitrarily , Configure in application.yml In the document . visit “/oauth/token”, Parameters @RequestHeader("Authorization") The value is Basic start , Add space , Add clientId:clientSecret Format base64 The encrypted string .


When doing user login , Need to username and password, And then through openfeign visit oauth2.0 Inside the entrance "/oauth/token" Method , obtain token,token Can be saved to redis( When the gateway filters / verification token When , Inquire about redis, Judge token Whether it works , If it is valid, it will be released ), Right again token After the parsing , Can get jwtJson, Then get "user_name" and "authorities", according to user_name Search for the information you need , Back to the front end .
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-oauth2</artifactId>
</dependency>




adopt openfeign visit oauth2.0 Acquisition token entrance @PostMapping("/oauth/token").

边栏推荐
- The data in servlet is transferred to JSP page, and the problem cannot be displayed using El expression ${}
- Return a tree structure data
- stm32F407-------DMA
- 微服务组件Sentinel (Hystrix)详细分析
- Distributed transaction solution
- 基于线程池的生产者消费者模型(含阻塞队列)
- require. context
- stm32F407-------DMA
- Recommendation letter of "listing situation" -- courage is the most valuable
- Kotlin middle process understanding and Practice (II)
猜你喜欢
![[shutter] top navigation bar implementation (scaffold | defaulttabcontroller | tabbar | tab | tabbarview)](/img/f1/b17631639cb4f0f58007b86476bcc2.gif)
[shutter] top navigation bar implementation (scaffold | defaulttabcontroller | tabbar | tab | tabbarview)

微信小程序開發工具 POST net::ERR_PROXY_CONNECTION_FAILED 代理問題

4. 类和对象

The data in servlet is transferred to JSP page, and the problem cannot be displayed using El expression ${}

Redis: simple use of redis

udp接收队列以及多次初始化的测试

Stm32f407 ------- IIC communication protocol

MySQL学习03
![[shutter] shutter debugging (debugging control related functions | breakpoint management | code operation control)](/img/fe/c053f8d116eb307733177283a26318.png)
[shutter] shutter debugging (debugging control related functions | breakpoint management | code operation control)

RestCloud ETL 跨库数据聚合运算
随机推荐
Memory pool (understand the process of new developing space from the perspective of kernel)
easyPOI
require. context
Visual yolov5 format data set (labelme JSON file)
awk从入门到入土(0)awk概述
[shutter] hero animation (hero realizes radial animation | hero component createrecttween setting)
stm32F407-------DMA
Cancellation of collaboration in kotlin, side effects of cancellation and overtime tasks
y54.第三章 Kubernetes从入门到精通 -- ingress(二七)
Tongda OA V12 process center
Startup mode and scope builder of collaboration in kotlin
How can retail enterprises open the second growth curve under the full link digital transformation
各国Web3现状与未来
GBase 8c 函数/存储过程定义
5. File operation
Y54. Chapter III kubernetes from introduction to mastery -- ingress (27)
Distributed transaction solution
[Flutter] dart: class; abstract class; factory; Class, abstract class, factory constructor
[Yu Yue education] Jiujiang University material analysis and testing technology reference
COM and cn
https://www.qvdv.com/tools/qvdv-base64.html