Commit 60aa176e authored by Jacob Priddy's avatar Jacob Priddy 👌

fix apidoc generation with authentication

parent b008caab
Pipeline #13232 passed with stages
in 1 minute and 58 seconds
......@@ -29,6 +29,9 @@ class GetAuthenticationStrategy extends Strategy
if ($controller->getShortName() === 'MeController') {
$token = 'token_string_engr';
}
if ($controller->getShortName() === 'DoorController') {
$token = 'door_1_api_token';
}
return [
'api_token' => [
......
......@@ -95,10 +95,10 @@ class DoorGuard implements Guard
*/
protected function getTokenForRequest(): ?string
{
$token = $this->request->bearerToken();
$token = $this->request->input($this->inputKey);
if (empty($token)) {
$token = $this->request->input($this->inputKey);
$token = $this->request->bearerToken();
}
return $token;
......
......@@ -108,7 +108,7 @@ class DoorController extends ApiController
* key press as a valid door unlock. Retrieves the open mode times for the next interval. Includes open mode
* schedules as well as overrides. The door to get the times for is based off of the authenticated door.
*
* @queryParam foresight Number of minutes ahead of now to get the open mode times for. Example: 720
* @queryParam foresight int Number of minutes ahead of now to get the open mode times for. Example: 720
*
* @response 422
* {"message":"The given data was invalid.","errors":{"foresight":["The foresight must be an integer."]}}
......
......@@ -78,7 +78,7 @@ class MeController extends ApiController
* @bodyParam password string The user's new password. Minimum of 20 characters. Example: My Super Secret P455w0rd
* @bodyParam doorcode string The user's new doorcode, minimum of 4 digits. Users 'emplid' is prepended. Example: 292889311069
*
* @response 422 {"message":"The given data was invalid.","errors":{"display_name":["The display name must be a string."],"password":["The password must be a string.","The password must be at least 20 characters."],"doorcode":["The doorcode must be a string.","The doorcode must be a number.","The doorcode must be between 11 and 255 digits."]}}
* @response 422 {"message":"The given data was invalid.","errors":{"display_name":["The display name must be a string."],"password":["The password must be a string.","The password must be at least 20 characters."],"doorcode":["The doorcode must be a string.","The doorcode must be a number.","The doorcode must be between 4 and 248 digits."]}}
*
* @param \Source\UseCases\Users\UpdateUser\UpdateCurrentUser $useCase
* @return \Illuminate\Http\JsonResponse
......
......@@ -74,7 +74,7 @@ return [
* Where is the auth value meant to be sent in a request?
* Options: query, body, query_or_body, basic, bearer, header (for custom header)
*/
'in' => 'query_or_body',
'in' => 'bearer',
/*
* The name of the parameter (eg token, key, apiKey) or header (eg Authorization, Api-Key).
......@@ -106,7 +106,7 @@ return [
* Text to place in the "Introduction" section, right after the `description`. Markdown and HTML are supported.
*/
'intro_text' => <<<INTRO
This documentation aims to provide all the information you need to work with our API.
This documentation aims to provide all the information you need to work with our API. But let's be honest, it probably won't and you'll end up having more questions than answers.
<aside>As you scroll, you'll see code examples for working with the API in different programming languages in the dark area to the right (or as part of the content on mobile).
You can switch the language used with the tabs at the top right (or from the nav menu at the top left on mobile).</aside>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment