ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5
Auth_OpenID_Encoder Class Reference
+ Inheritance diagram for Auth_OpenID_Encoder:
+ Collaboration diagram for Auth_OpenID_Encoder:

Public Member Functions

 encode ($response)
 Encode an Auth_OpenID_ServerResponse and return an Auth_OpenID_WebResponse. More...
 

Data Fields

 $responseFactory = 'Auth_OpenID_WebResponse'
 

Detailed Description

Definition at line 1443 of file Server.php.

Member Function Documentation

◆ encode()

Auth_OpenID_Encoder::encode (   $response)

Encode an Auth_OpenID_ServerResponse and return an Auth_OpenID_WebResponse.

Definition at line 1451 of file Server.php.

References $location, Auth_OpenID_ENCODE_HTML_FORM, Auth_OpenID_ENCODE_KVFORM, Auth_OpenID_ENCODE_URL, AUTH_OPENID_HTTP_ERROR, AUTH_OPENID_HTTP_OK, and AUTH_OPENID_HTTP_REDIRECT.

1452  {
1453  $cls = $this->responseFactory;
1454 
1455  $encode_as = $response->whichEncoding();
1456  if ($encode_as == Auth_OpenID_ENCODE_KVFORM) {
1457  $wr = new $cls(null, null, $response->encodeToKVForm());
1458  if (is_a($response, 'Auth_OpenID_ServerError')) {
1459  $wr->code = AUTH_OPENID_HTTP_ERROR;
1460  }
1461  } else if ($encode_as == Auth_OpenID_ENCODE_URL) {
1462  $location = $response->encodeToURL();
1463  $wr = new $cls(AUTH_OPENID_HTTP_REDIRECT,
1464  array('location' => $location));
1465  } else if ($encode_as == Auth_OpenID_ENCODE_HTML_FORM) {
1466  $wr = new $cls(AUTH_OPENID_HTTP_OK, array(),
1467  $response->toHTML());
1468  } else {
1469  return new Auth_OpenID_EncodingError($response);
1470  }
1471  /* Allow the response to carry a custom error code (ex: for Association errors) */
1472  if(isset($response->code)) {
1473  $wr->code = $response->code;
1474  }
1475  return $wr;
1476  }
const AUTH_OPENID_HTTP_ERROR
Definition: Server.php:108
const Auth_OpenID_ENCODE_KVFORM
private
Definition: Server.php:120
$location
Definition: buildRTE.php:44
const Auth_OpenID_ENCODE_HTML_FORM
private
Definition: Server.php:130
const Auth_OpenID_ENCODE_URL
private
Definition: Server.php:125
const AUTH_OPENID_HTTP_REDIRECT
Definition: Server.php:107
const AUTH_OPENID_HTTP_OK
Required imports.
Definition: Server.php:106

Field Documentation

◆ $responseFactory

Auth_OpenID_Encoder::$responseFactory = 'Auth_OpenID_WebResponse'

Definition at line 1445 of file Server.php.


The documentation for this class was generated from the following file: