简体   繁体   English

使用 oauth2 进行静默身份验证(提示 = 无)

[英]Silent authentification with oauth2 (prompt=none)

Hi I have SPA(Single page application) where I use oauth2 implicit grant for authorization.嗨,我有 SPA(单页应用程序),我使用 oauth2 隐式授权进行授权。 As Identity server I have Wso2 identity server 5.4.1.作为身份服务器,我有 Wso2 身份服务器 5.4.1。

I am able to authorize the app and everything works as desired - also I configured to skip the consent.我能够授权应用程序,一切都按预期工作 - 我也配置为跳过同意。

Here goes the problem: I am trying to silently reauthenticate logged user with following link with help of .../oauth2/authorize service and attribute prompt=none:问题来了:我试图在 .../oauth2/authorize 服务和属性 prompt=none 的帮助下,通过以下链接以静默方式重新验证登录用户:

https://xxx:9447/oauth2/authorize?response_type=id_token token&nonce=123&prompt=none&client_id=xxxx&scope=openid&redirect_uri=http://localhost:63342/myapp/www/index.html&id_token_hint=previous_user_token

With promp=none as written here:使用 promp=none 写在这里:

http://openid.net/specs/openid-connect-core-1_0.html#AuthorizationEndpoint I should be able to authenticate user when he is logged and the consent is configured to be skipped or always approve. http://openid.net/specs/openid-connect-core-1_0.html#AuthorizationEndpoint当用户登录并且同意配置为跳过或始终批准时,我应该能够对用户进行身份验证。

But I always get the same error back in URI:但我总是在 URI 中得到同样的错误:

http://localhost:63342/myapp/www/index.html#error_description=Authentication+required&error=login_required&session_state=state124124125125.1251512

This error login_required means that your user is not logged in on the IP.此错误 login_required 表示您的用户未登录 IP。 You must first ask him to connect by redirecting it to the authorization endpoint without the prompt parameter set to none.您必须首先通过将它重定向到授权端点来要求他进行连接,而没有将 prompt 参数设置为 none。

See : http://openid.net/specs/openid-connect-core-1_0.html#AuthError见: http : //openid.net/specs/openid-connect-core-1_0.html#AuthError

login_required The Authorization Server requires End-User authentication. login_required 授权服务器需要最终用户身份验证。 This error MAY be returned when the prompt parameter value in the Authentication Request is none, but the Authentication Request cannot be completed without displaying a user interface for End-User authentication.当Authentication Request中的prompt参数值为none时,可能会返回此错误,但如果不显示End-User认证的用户界面,则无法完成Authentication Request。

According to the documentation, it seems that the user must choose the option on the consent page: Approve Always.根据文档,似乎用户必须选择同意页面上的选项:始终批准。 Have you tested with this option?你测试过这个选项吗?

Docs: https://docs.wso2.com/display/IS530/Basic+Client+Profile+with+Playground文档: https : //docs.wso2.com/display/IS530/Basic+Client+Profile+with+Playground

Click Approve to provide consent to this action.单击批准以同意此操作。 The screen mentions the service provider by name and requests for user consent to provide user information to that particular service provider.该屏幕按名称提及服务提供商,并请求用户同意向该特定服务提供商提供用户信息。 The user can either Deny to provide information to the service provider.用户可以拒绝向服务提供商提供信息。 Approve to provide user profile information to this service provider only for this time.同意仅在此次​​向该服务提供商提供用户个人资料信息。

Approve Always to provide approval to share user profile information with the service provider even in the future without prompting for consent again.始终批准以批准与服务提供商共享用户配置文件信息,即使在将来也不会再次提示同意。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM