简体   繁体   English

无法通过OASO2 / OpenID验证访问令牌在WSO2 Identity Server上使用prompt = none参数进行验证

[英]Can't validate access token via OAuth2/OpenID Connect with prompt=none parameter on WSO2 Identity Server

An according to OpenID Connect Core 1.0 specification , if authentication request contains parameter prompt with value none , server must process it the following way: 根据OpenID Connect Core 1.0规范 ,如果身份验证请求包含值为none参数prompt ,则服务器必须按以下方式处理:

The Authorization Server MUST NOT display any authentication or consent user interface pages. 授权服务器不得显示任何身份验证或同意用户界面页面。 An error is returned if an End-User is not already authenticated or the Client does not have pre-configured consent for the requested Claims or does not fulfill other conditions for processing the request. 如果最终用户尚未经过身份验证,或者客户端没有对所请求的声明进行预先配置的同意,或者不满足处理请求的其他条件,则会返回错误。 The error code will typically be login_required, interaction_required, or another code defined in Section 3.1.2.6. 错误代码通常是login_required,interaction_required或第3.1.2.6节中定义的其他代码。 This can be used as a method to check for existing authentication and/or consent. 这可以用作检查现有身份验证和/或同意的方法。

My problem is that whenever I try to validate access token received before this way (passing prompt=none pair along with other required parameters), WSO2 IS server always replies with code 302 and redirect to login page. 我的问题是,每当我尝试验证以这种方式接收的访问令牌(传递prompt=none对以及其他必需参数)时,WSO2 IS服务器总是回复代码302并重定向到登录页面。 Below is the corresponding output from following cURL command: 以下是来自以下cURL命令的相应输出:

curl -v -k -X GET "https://localhost:9443/oauth2/authorize?prompt=none&scope=openid&client_id=BpMCycs5nBuZCpVLwSE5f6Hf5CYa&response_type=code&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Fmy-app%2Fmy-ctx" --header "Authorization: Bearer a65544593fg9c67rbf95fc24a6953cb4"

> GET /oauth2/authorize?prompt=none&scope=openid&client_id=BpMCycs5nBuZCpVLwSE5f
6Hf5CYa&response_type=code&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Fmy-app%2Fmy-ctx HTTP/1.1
> User-Agent: curl/7.30.0
> Host: localhost:9443
> Accept: */*
> Authorization: Bearer a65544593fg9c67rbf95fc24a6953cb4
>
< HTTP/1.1 302 Found
< Date: Thu, 14 Aug 2014 17:01:17 GMT
< Location: https://localhost:9443/commonauth/?sessionDataKey=bf5be153-4j31-429b
-9fa6-97rr27da213&type=oidc&commonAuthCallerPath=/oauth2/authorize&forceAuthent
icate=false&checkAuthentication=false&relyingParty=BpKCycd5dBfZdpVswSE5f6Hf5CYa&
tenantId=-1234&prompt%3Dnone%26scope%3Dopenid%26client_id%3DBpKCycr5dBuZCpVBwSE5
f6Hf5CYa%26response_type%3Dcode%26redirect_uri%3Dhttp%253A%252F%252Flocalhost%25
3A8080%252Fmy-app%252Fmy-ctx

Could someone tell me - it's problem in authentication request itself and I did something wrong or WSO2 IS server behaviour in this case doesn't conform to the specification? 有人可以告诉我 - 这是认证请求本身的问题,我做错了或WSO2 IS服务器行为在这种情况下不符合规范?

I work with WSO2 Identity Server 5.0.0 我使用WSO2 Identity Server 5.0.0

Thanks in advance for your answers! 提前感谢您的回答!

According to the spec The prompt parameter can be used by the Client to make sure that the End-User is still present for the current session or to bring attention to the request. 根据规范,客户端可以使用prompt参数来确保最终用户仍然存在于当前会话中或引起对请求的注意。 If this parameter contains none with any other value , an error is returned. 如果此参数包含none而没有任何其他值 ,则返回错误。

But in this request only send none as prompt value, So prompt value is set to none with any other value it gives an error. 但是在这个请求中只发送no作为提示值,因此提示值设置为none,其他任何值都会给出错误。

Example: 例:

curl -v -k -X GET "https://localhost:9444/oauth2/authorize?prompt=none+login&scope=openid..."

Maybe you can use following request to validate token: 也许您可以使用以下请求来验证令牌:

curl -k -H "Authorization: Bearer <token>" \
https://localhost:9443/oauth2/userinfo?schema=openid

It returns user info if user is authenticated. 如果用户通过身份验证,则返回用户信息。 I know that this is workaround and you cannot get token expire data, but in some case can be useful. 我知道这是解决方法,你不能获得令牌过期数据,但在某些情况下可能是有用的。 I came here with the similar problem and your question gave me idea how to solve it. 我带着类似的问题来到这里,你的问题让我知道如何解决它。

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

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