Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

springboot3 + 网关统一鉴权 + oauth2 无法正确访问/oauth/** 以及 /user/doLogin接口 #652

Open
silent-night-no-trace opened this issue Jul 4, 2024 · 0 comments

Comments

@silent-night-no-trace
Copy link

使用版本:

1.37.0

涉及的功能模块:

网关统一鉴权 + oauth2
完整的pom依赖如下

<dependencies>

    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-gateway</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>cn.dev33</groupId>
        <artifactId>sa-token-reactor-spring-boot3-starter</artifactId>
        <version>1.37.0</version>
    </dependency>

    <!-- Sa-Token 整合 Redis (使用 jackson 序列化方式) -->
    <dependency>
        <groupId>cn.dev33</groupId>
        <artifactId>sa-token-redis-fastjson2</artifactId>
        <version>1.37.0</version>
    </dependency>

    <!-- Sa-Token-OAuth2.0 模块 -->
    <dependency>
        <groupId>cn.dev33</groupId>
        <artifactId>sa-token-oauth2</artifactId>
        <version>1.37.0</version>
    </dependency>

    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-pool2</artifactId>
    </dependency>

</dependencies>

测试步骤:

  • 我经过以下步骤测试:
    项目启动后 请求 http://localhost:9999/oauth2/authorize?response_type=code&client_id=1001&redirect_uri=http://localhost:9999
    提示
    {
    "code": 500,
    "msg": "未能获取有效的上下文",
    "data": null
    }
    同时访问 /user/doLogin 提示404

  • 得出以下结果:

  • 其中第 xx 行的代码输出表现 和文档上描述的不一致:

  • 我的理解是:
    这二者是不能结合使用么 期望是 网关提供统一鉴权 同时暴露出 /oauth2 的相关接口 还是说这二者 必须分开 网关仅支持鉴权,oauth 或者sso 需要单独项目

请问,是我的理解不对,还是文档出了问题?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant