public class UserInfoIssueResponse extends ApiResponse
/auth/userinfo/issue API.
Authlete's /auth/userinfo/issue API returns JSON which can be
mapped to this class. The service implementation should retrieve the
value of "action" from the response and take the following
steps according to the value.
INTERNAL_SERVER_ERROR
When the value of "action" is "INTERNAL_SERVER_ERROR",
it means that the request from the service implementation was wrong or
that an error occurred in Authlete.
In either case, from the viewpoint of the client application, it is an
error on the server side. Therefore, the service implementation should
generate a response to the client application with the HTTP status of
"500 Internal Server Error".
getResponseContent() returns a string which describes the error
in the format of RFC 6750
(OAuth 2.0 Bearer Token Usage), so the UserInfo
Endpoint implementation of your service can use the string returned
from the method as the value of WWW-Authenticate header.
The following is an example response which complies with RFC 6750. Note that OpenID Connect Core 1.0 requires that an error response from UserInfo endpoint comply with RFC 6750. See 5.3.3. UserInfo Response for details.
HTTP/1.1 500 Internal Server Error
WWW-Authenticate: (The value returned from getResponseContent())
Cache-Control: no-store
Pragma: no-cache
BAD_REQUEST
When the value of "action" is "BAD_REQUEST", it means
that the request from the client application does not contain an access
token (= the request from the service implementation to Authlete does
not contain "token" parameter).
getResponseContent() returns a string which describes the error
in the format of RFC 6750
(OAuth 2.0 Bearer Token Usage), so the UserInfo
Endpoint implementation of your service can use the string returned
from the method as the value of WWW-Authenticate header.
The following is an example response which complies with RFC 6750. Note that OpenID Connect Core 1.0 requires that an error response from UserInfo endpoint comply with RFC 6750. See 5.3.3. UserInfo Response for details.
HTTP/1.1 400 Bad Request
WWW-Authenticate: (The value returned from getResponseContent())
Cache-Control: no-store
Pragma: no-cache
UNAUTHORIZED
When the value of "action" is "UNAUTHORIZED", it means
that the access token does not exist, has expired, or is not associated
with any subject (= any user account).
getResponseContent() returns a string which describes the error
in the format of RFC 6750
(OAuth 2.0 Bearer Token Usage), so the UserInfo
Endpoint implementation of your service can use the string returned
from the method as the value of WWW-Authenticate header.
The following is an example response which complies with RFC 6750. Note that OpenID Connect Core 1.0 requires that an error response from UserInfo endpoint comply with RFC 6750. See 5.3.3. UserInfo Response for details.
HTTP/1.1 401 Unauthorized
WWW-Authenticate: (The value returned from getResponseContent())
Cache-Control: no-store
Pragma: no-cache
FORBIDDEN
When the value of "action" is "FORBIDDEN", it means
that the access token does not include the "openid" scope.
getResponseContent() returns a string which describes the error
in the format of RFC 6750
(OAuth 2.0 Bearer Token Usage), so the UserInfo
Endpoint implementation of your service can use the string returned
from the method as the value of WWW-Authenticate header.
The following is an example response which complies with RFC 6750. Note that OpenID Connect Core 1.0 requires that an error response from UserInfo endpoint comply with RFC 6750. See 5.3.3. UserInfo Response for details.
HTTP/1.1 403 Forbidden
WWW-Authenticate: (The value returned from getResponseContent())
Cache-Control: no-store
Pragma: no-cache
JSON
When the value of "action" is "JSON", it means that the
access token which the client application presented is valid and an ID
token was successfully generated in the format of JSON.
The UserInfo Endpoint of your service is expected to generate a response
to the client application. The content type of the response must be "application/json" and the response body must be an ID token in JSON format.
getResponseContent() returns the ID token in JSON format when
"action" is "JSON", so a response to the client can be
built like below.
HTTP/1.1 200 OK
Cache-Control: no-store
Pragma: no-cache
Content-Type: application/json;charset=UTF-8
(The value returned from getResponseContent())
JWT
When the value of "action" is "JWT", it means that the
access token which the client application presented is valid and an ID
token was successfully generated in the format of JWT (JSON Web Token)
(RFC 7519).
The UserInfo Endpoint of your service is expected to generate a response
to the client application. The content type of the response must be "application/jwt" and the response body must be an ID token in JWT format.
getResponseContent() returns the ID token in JWT format when
"action" is "JWT", so a response to the client can be
built like below.
HTTP/1.1 200 OK
Cache-Control: no-store
Pragma: no-cache
Content-Type: application/jwt
(The value returned from getResponseContent())
| Modifier and Type | Class and Description |
|---|---|
static class |
UserInfoIssueResponse.Action
The next action the service implementation should take.
|
| Constructor and Description |
|---|
UserInfoIssueResponse() |
| Modifier and Type | Method and Description |
|---|---|
UserInfoIssueResponse.Action |
getAction()
Get the next action that the service implementation should take.
|
String |
getResponseContent()
Get the response content which can be used as the entity body
of the response returned to the client application.
|
void |
setAction(UserInfoIssueResponse.Action action)
Set the next action that the service implementation should take.
|
void |
setResponseContent(String content)
Set the response content which can be used as the entity body
of the response returned to the client application.
|
String |
summarize()
Get the summary of this instance.
|
getResultCode, getResultMessage, setResultCode, setResultMessagepublic UserInfoIssueResponse.Action getAction()
public void setAction(UserInfoIssueResponse.Action action)
public String getResponseContent()
public void setResponseContent(String content)
public String summarize()
Copyright © 2017. All rights reserved.