54 lines
1.4 KiB
PHP
54 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace oauth2\responses;
|
|
|
|
abstract class OAuth2IndirectResponse extends OAuth2Response {
|
|
|
|
protected $return_to;
|
|
|
|
const IndirectResponseContentType = "application/x-www-form-urlencoded";
|
|
const OAuth2IndirectResponse ='OAuth2IndirectResponse';
|
|
|
|
public function __construct()
|
|
{
|
|
// Successful Responses: A server receiving a valid request MUST send a
|
|
// response with an HTTP status code of 200.
|
|
parent::__construct(self::HttpOkResponse, self::IndirectResponseContentType);
|
|
|
|
}
|
|
|
|
public function getType()
|
|
{
|
|
return self::OAuth2IndirectResponse;
|
|
}
|
|
|
|
public function setReturnTo($return_to){
|
|
$this->return_to = $return_to;
|
|
}
|
|
|
|
public function getReturnTo(){
|
|
return $this->return_to;
|
|
}
|
|
|
|
public function getContent()
|
|
{
|
|
$url_encoded_format = "";
|
|
if ($this->container !== null) {
|
|
ksort($this->container);
|
|
foreach ($this->container as $key => $value) {
|
|
if (is_array($value)) {
|
|
list($key, $value) = array($value[0], $value[1]);
|
|
}
|
|
$value = urlencode($value);
|
|
$url_encoded_format .= "$key=$value&";
|
|
}
|
|
$url_encoded_format = rtrim($url_encoded_format, '&');
|
|
}
|
|
return $url_encoded_format;
|
|
}
|
|
|
|
public function getContentType()
|
|
{
|
|
return self::IndirectResponseContentType;
|
|
}
|
|
}
|