openstackid/app/libs/oauth2/responses/OAuth2IndirectResponse.php
smarcet ad1844984e Implements: blueprint openid-oauth2-implicit-client-flow
Change-Id: Iee3c9412a3f75a4aba5421e8c5f881a60b396df0
2014-01-06 18:07:55 -03:00

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;
}
}