PushedAuthReqResponse extends ApiResponse
Response from Authlete's /api/pushed_auth_req API.
Authlete's /api/pushed_auth_req
API returns JSON which can be mapped
to this class. The authorization server implementation should retrieve
the value of the action
parameter (which can be obtained by
getAction()
method of this class) from the response and the take the
following steps according to the value.
When the value returned from getAction()
method is
PushedAuthReqAction::$CREATED
, it means that the authorization request
has been registered successfully.
The authorization server implementation should generate a response to the
client application with 201 Created
and application/json
.
The getResponseContent()
method returns a JSON string which can be used
as the entity body of the response.
The following illustrates the response which the authorization server implementation should generate and return to the client application.
HTTP/1.1 201 Created
Content-Type: application/json
Cache-Control: no-store
Pragma: no-cache
(The value returned from getResponseContent())
When the value returned from getAction()
method is
PushedAuthReqAction::$BAD_REQUEST
, it means that the request was wrong.
The authorization server implementation should generate a response to the
client application with 400 Bad Request
and application/json
.
The getResponseContent()
method returns a JSON string which describes the
error, so it can be used as the entity body of the response.
The following illustrates the response which the authorization server implementation should generate and return to the client application.
HTTP/1.1 400 Bad Request
Content-Type: application/json
Cache-Control: no-store
Pragma: no-cache
(The value returned from getResponseContent())
When the value returned from getAction()
method is
PushedAuthReqAction::$UNAUTHORIZED
, it means that client authentication
of the request failed.
The authorization server implementation should generate a response to the
client application with 401 Unauthorized
and application/json
.
The getResponseContent()
method returns a JSON string which describes the
error, so it can be used as the entity body of the response.
The following illustrates the response which the authorization server implementation should generate and return to the client application.
HTTP/1.1 401 Unauthorized
WWW-Authenticate: (challenge)
Content-Type: application/json
Cache-Control: no-store
Pragma: no-cache
(The value returned from getResponseContent())
When the value returned from getAction()
method is
PushedAuthReqAction::$FORBIDDEN
, it means that the client application
is not allowed to use the pushed authorization request endpoint.
The authorization server implementation should generate a response to the
client application with 403 Forbidden
and application/json
.
The getResponseContent()
method returns a JSON string which describes the
error, so it can be used as the entity body of the response.
The following illustrates the response which the authorization server implementation should generate and return to the client application.
HTTP/1.1 403 Forbidden
Content-Type: application/json
Cache-Control: no-store
Pragma: no-cache
(The value returned from getResponseContent())
When the value returned from getAction()
method is
PushedAuthReqAction::$PAYLOAD_TOO_LARGE
, it means that the size of the
pushed authorization request is too large.
The authorization server implementation should generate a response to the
client application with 413 Payload Too Large
and application/json
.
The getResponseContent()
method returns a JSON string which describes the
error, so it can be used as the entity body of the response.
The following illustrates the response which the authorization server implementation should generate and return to the client application.
HTTP/1.1 413 Payload Too Large
Content-Type: application/json
Cache-Control: no-store
Pragma: no-cache
(The value returned from getResponseContent())
When the value returned from getAction()
method is
PushedAuthReqAction::$INTERNAL_SERVER_ERROR
, it means that the API call
from the authorization server implementation was wrong or that an error
occurred in Authlete.
In either case, from a viewpoint of the client application, it is an error
on the server side. Therefore, the authorization server implementation
should generate a response to the client application with
500 Internal Server Error
and application/json
.
The getResponseContent()
method returns a JSON string which describes the
error, so it can be used as the entity body of the response.
The following illustrates the response which the authorization server implementation should generate and return to the client application.
HTTP/1.1 500 Internal Server Error
Content-Type: application/json
Cache-Control: no-store
Pragma: no-cache
(The value returned from getResponseContent())
However, it is up to the authorization server's policy whether to return
500
actually.
Tags
Table of Contents
- copyFromArray() : mixed
- Copy the content of the given array into this object.
- copyToArray() : mixed
- Copy the content of this object into the given array.
- fromArray() : static
- Convert an array into an instance of this class.
- fromJson() : static
- Convert a JSON string into an instance of this class.
- getAction() : PushedAuthReqAction
- Get the next action that the authorization server should take.
- getRequestUri() : string
- Get the request URI created to represent the pushed authorization request. This can be sent by the client as the `request_uri` request parameter in an authorization request.
- getResponseContent() : string
- Get the response content which can be used as the entity body of the response returned to the client application.
- getResultCode() : string
- Get the code of the result of an Authlete API call.
- getResultMessage() : string
- Get the message of the result of an Authlete API call.
- setAction() : PushedAuthReqResponse
- Set the next action that the authorization server should take.
- setRequestUri() : PushedAuthReqResponse
- Set the request URI created to represent the pushed authorization request. This can be sent by the client as the `request_uri` request parameter in an authorization request.
- setResponseContent() : PushedAuthReqResponse
- Set the response content which can be used as the entity body of the response returned to the client application.
- setResultCode() : ApiResponse
- Set the code of the result of an Authlete API call.
- setResultMessage() : ApiResponse
- Set the message of the result of an Authlete API call.
- toArray() : array<string|int, mixed>
- Convert this object into an array.
- toJson() : string
- Convert this object into a JSON string.
Methods
copyFromArray()
Copy the content of the given array into this object.
public
copyFromArray(array<string|int, mixed> &$array) : mixed
Parameters
- $array : array<string|int, mixed>
Return values
mixed —copyToArray()
Copy the content of this object into the given array.
public
copyToArray(array<string|int, mixed> &$array) : mixed
Parameters
- $array : array<string|int, mixed>
Return values
mixed —fromArray()
Convert an array into an instance of this class.
public
static fromArray([array<string|int, mixed> $array = null ]) : static
This static function returns a new instance of this class.
If $array
is null
, null
is returned.
Parameters
- $array : array<string|int, mixed> = null
-
An array
Return values
static —An instance of this class.
fromJson()
Convert a JSON string into an instance of this class.
public
static fromJson(string $json) : static
This static function returns a new instance of this class.
If $json
is null
or the type of $json
is not string
,
null
is returned.
Parameters
- $json : string
-
A JSON string.
Return values
static —An instance of this class.
getAction()
Get the next action that the authorization server should take.
public
getAction() : PushedAuthReqAction
Return values
PushedAuthReqAction —The next action that the authorization server should take.
getRequestUri()
Get the request URI created to represent the pushed authorization request. This can be sent by the client as the `request_uri` request parameter in an authorization request.
public
getRequestUri() : string
Return values
string —The request URI.
getResponseContent()
Get the response content which can be used as the entity body of the response returned to the client application.
public
getResponseContent() : string
Return values
string —The response content.
getResultCode()
Get the code of the result of an Authlete API call.
public
getResultCode() : string
Return values
string —The result code.
getResultMessage()
Get the message of the result of an Authlete API call.
public
getResultMessage() : string
Return values
string —The result message.
setAction()
Set the next action that the authorization server should take.
public
setAction([PushedAuthReqAction $action = null ]) : PushedAuthReqResponse
Parameters
- $action : PushedAuthReqAction = null
-
The next action that the authorization server should take.
Return values
PushedAuthReqResponse —$this
object.
setRequestUri()
Set the request URI created to represent the pushed authorization request. This can be sent by the client as the `request_uri` request parameter in an authorization request.
public
setRequestUri(string $uri) : PushedAuthReqResponse
Parameters
- $uri : string
-
The response content.
Return values
PushedAuthReqResponse —$this
object.
setResponseContent()
Set the response content which can be used as the entity body of the response returned to the client application.
public
setResponseContent(string $responseContent) : PushedAuthReqResponse
Parameters
- $responseContent : string
-
The response content.
Return values
PushedAuthReqResponse —$this
object.
setResultCode()
Set the code of the result of an Authlete API call.
public
setResultCode(string $resultCode) : ApiResponse
Parameters
- $resultCode : string
-
The result code.
Return values
ApiResponse —$this
object.
setResultMessage()
Set the message of the result of an Authlete API call.
public
setResultMessage(string $resultMessage) : ApiResponse
Parameters
- $resultMessage : string
-
The result message.
Return values
ApiResponse —$this
object.
toArray()
Convert this object into an array.
public
toArray() : array<string|int, mixed>
Return values
array<string|int, mixed> —An array.
toJson()
Convert this object into a JSON string.
public
toJson(int $options) : string
Parameters
- $options : int
-
Options passed to
json_encode()
. This parameter is optional and its default value is 0.
Return values
string —A JSON string.