当前位置:网站首页>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").

边栏推荐
- Wechat applet development tool post net:: err_ PROXY_ CONNECTION_ Failed agent problem
- GBase 8c系统表-pg_conversion
- Deep learning notes (constantly updating...)
- stm32F407-------ADC
- Socket编程
- 微信小程序開發工具 POST net::ERR_PROXY_CONNECTION_FAILED 代理問題
- GBase 8c 函数/存储过程参数(一)
- [Yu Yue education] reference materials of love psychology of China University of mining and technology
- Awk from introduction to earth (0) overview of awk
- 人脸识别6- face_recognition_py-基于OpenCV使用Haar级联与dlib库进行人脸检测及实时跟踪
猜你喜欢

Redis: simple use of redis

Detailed introduction to the deployment and usage of the Nacos registry

Distributed transaction solution

awk从入门到入土(0)awk概述

使用Go语言实现try{}catch{}finally

微服务组件Sentinel (Hystrix)详细分析

RestCloud ETL 跨库数据聚合运算
![[shutter] pull the navigation bar sideways (drawer component | pageview component)](/img/6f/dfc9dae5f890125d0cebdb2a0f4638.gif)
[shutter] pull the navigation bar sideways (drawer component | pageview component)

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

elastic stack
随机推荐
Gbase 8C system table PG_ authid
【CodeForces】CF1338A - Powered Addition【二进制】
Exception handling in kotlin process
[shutter] top navigation bar implementation (scaffold | defaulttabcontroller | tabbar | tab | tabbarview)
COM and cn
Stm32f407 ------- IIC communication protocol
Face recognition 6-face_ recognition_ Py based on OpenCV, face detection and real-time tracking using Haar cascade and Dlib Library
詳細些介紹如何通過MQTT協議和華為雲物聯網進行通信
Machine learning process and method
Detailed introduction to the usage of Nacos configuration center
File class (add / delete)
[Flutter] dart: class; abstract class; factory; Class, abstract class, factory constructor
GBase 8c系统表-pg_collation
Restcloud ETL cross database data aggregation operation
File class (check)
Return a tree structure data
创建+注册 子应用_定义路由,全局路由与子路由
Machine learning notes (constantly updating...)
Solution for processing overtime orders (Overtime unpaid)
Kotlin middle process understanding and Practice (II)
https://www.qvdv.com/tools/qvdv-base64.html