spring-authorization-server 和 OpenId Connect 和 angular-oauth2-oidc

spring-authorization-server and OpenId Connect and angular-oauth2-oidc

在我的项目中,我有一个 angular 应用程序,我在其中使用 https://github.com/manfredsteyer/angular-oauth2-oidc 和一个 SpringBoot 后端。 在 UI 中,我从这里 https://github.com/jeroenheijmans/sample-angular-oauth2-oidc-with-auth-guards.

复制了大部分内容

我的代码适用于 https://demo.identityserver.io 和本地 Keycloak。

我只需要改唯一的:

我的“梦想”是使用 spring-authorization-server。在我的应用程序中,我可以动态创建用户,因此我需要能够通过 REST 调用将此用户添加到授权服务器。据我了解,spring-authorization-server 代码应该很容易扩展。

我从 https://www.baeldung.com/spring-security-oauth-auth-server 复制了 spring-authorization-server 代码,基础 spring-authorization-server 版本:0.2.0。 服务器启动,我的应用程序将重定向到登录页面。当它从 spring-authorization-server 返回时,angular UI OIDC 代码检测到“Nonce”有问题,有时会丢失,有时会不匹配。不幸的是我找不到这种行为的原因:-( 由于我的代码与其他两个实现一起使用,我怀疑 spring-authorization-server.

中的错误配置或错误

spring-authorization-server 上的文档非常薄。

问题:有人知道 spring-authorization-server 与 Web 客户端和 OpenId Connect 一起使用的地方吗?

2.3.2022 更新:我在 spring-authorization-server https://github.com/spring-projects/spring-authorization-server/issues/640 上开了一个 Issue 我希望这会带来更多信息。

最好的问候 T

我不熟悉 angular-oauth2-oidc。但是,我会推荐 angular-auth-oidc-client.

参见this branch containing a working sample that uses this client. The sample demonstrates obtaining an access token as a public client as well as authenticating to a backend for frontend application (or BFF, which is the recommended choice) without using any client-side library. We will be presenting a webinar on March 10, 2022 on this topic. You can register here

您还可以从 SpringOne 2021 查看 this sample,它还演示了一个 Angular 应用程序利用 BFF 并从资源服务器检索数据。

经过几天的痛苦,我放弃了 angular-oauth2-oidc。使用 angular-auth-oidc-client 它在 2 小时后工作 :-) 他们有更好的文档和更多不同场景的示例。我真的可以推荐它:-)

@Steve 感谢库 angular-auth-oidc-client.

的提示