/** * Construct an instance of a HmacScheme. */ public function __construct() { parent::__construct(); $this->description = 'This API supports HMAC for authenticating ' . 'requests.'; $this->type = 'x-HMAC'; $this->headers = ['Authorization' => (new RamlParameter())->setDescription('Used to send a valid signature hash of the request ' . 'body. Expected format: `Hash <hash>`')->setType(RamlTypes::TYPE_STRING)]; }
/** * Construct an instance of a OAuth2Scheme. */ public function __construct() { parent::__construct(); $this->description = 'This API supports OAuth 2.0 for authenticating ' . 'requests.'; $this->type = 'OAuth 2.0'; $this->headers = ['Authorization' => (new RamlParameter())->setDescription('Used to send a valid OAuth 2 access token.')->setType(RamlTypes::TYPE_STRING)]; $this->responses = (new RamlResponseGroup())->addResponse(401, (new RamlResponse())->setDescription('Bad or expired token. This can happen if the user or ' . 'the API revoked or expired an access token. To fix, you ' . 'should re-authenticate the user.'))->addResponse(403, (new RamlResponse())->setDescription('Bad OAuth request (wrong consumer key, bad nonce, ' . 'expired timestamp...). Unfortunately, ' . 're-authenticating the user won\'t help here.')->setBody((new RamlMessageBody())->addType('application/json', (new RamlBody())->setExample(json_encode(['code' => '403', 'status' => 'forbidden', 'messages' => ['Authorization is required']]))))); $this->settings = ['authorizationUri' => 'https://localhost/oauth/auth', 'accessTokenUri' => 'https://localhost/oauth/token', 'authorizationGrants' => ['code'], 'scopes' => ['global']]; }