it-honghui / spring-cloud-gateway-oauth2 Goto Github PK
View Code? Open in Web Editor NEW我们理想的微服务权限解决方案应该是这样的,认证服务负责认证,网关负责校验认证和鉴权,其他API服务负责处理自己的业务逻辑。安全相关的逻辑只存在于认证服务和网关服务中,其他服务只是单纯地提供服务而没有任何安全相关逻辑。
我们理想的微服务权限解决方案应该是这样的,认证服务负责认证,网关负责校验认证和鉴权,其他API服务负责处理自己的业务逻辑。安全相关的逻辑只存在于认证服务和网关服务中,其他服务只是单纯地提供服务而没有任何安全相关逻辑。
您好 大佬 ,能不能整个教学视频,上b站。谢谢
大哥 按照你上面的写法通过网关访问auth服务是可以了 但是怎么通过nginx代理的网关访问auth完成授权码过程 我通过nginx访问的id+ auth/oauth/authorize?client_id=social-security-card&response_type=code&scope=all&redirect_uri=http://www.baidu.com 跳转到登录页,登陆之后就报404了
按照readme.md
中得操作,尝试通过密码获取jwt令牌,请求格式如下
POST http://localhost:9201/oauth/token
Content-Type: application/json
{
"grant_type": "password",
"client_id": "client-app",
"client_secret": "123456",
"username": "admin",
"password": "123456"
}
直接响应401,请问是哪里需要做额外配置吗?
HTTP/1.1 401 Unauthorized
transfer-encoding: chunked
WWW-Authenticate: Basic realm="oauth2/client"
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: 0
X-Frame-Options: DENY
Content-Type: application/json
Date: Thu, 10 Feb 2022 05:31:26 GMT
Referrer-Policy: no-referrer
{
"timestamp": "2022-02-10 05:31:26",
"status": 401,
"error": "Unauthorized",
"message": "",
"path": "/oauth/token"
}
使用授码模式登录时,先访问地址获取授权码:http://localhost:9201/oauth/authorize?response_type=code&client_id=client-app-2&redirect_uri=https://www.baidu.com
但是很多时候,我们都需要通过网关访问后面的服务,你可以试试经过网关访问,因为spring cloud gateway处理数据时会丢掉session信息,经过网关,登陆后无法转向/oauth/authorize的。
http://localhost:9999/auth/oauth/authorize?response_type=code&client_id=client-app-2&redirect_uri=https://www.baidu.com
不经过网关,你网关后面的服务的ip,端口什么全都暴露的。防止cloud gateway,理论上所有外部调用API应该都要走gateway,内部feign互调才不需要走gateway。
大哥,在这个基础上client_credentials客户端模式一直没成功,能搞个客户端模式的示例吗?谢谢。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.