Commit 0a14641e authored by Jacob Priddy's avatar Jacob Priddy 👌
Browse files

api doc updates

parent d4e24e69
Pipeline #13230 passed with stages
in 9 minutes and 21 seconds
...@@ -69,12 +69,6 @@ generate_api_docs: ...@@ -69,12 +69,6 @@ generate_api_docs:
- cd src/backend - cd src/backend
- sed -i 's/\(^APP_ENV=\).*/\1memory/' .env - sed -i 's/\(^APP_ENV=\).*/\1memory/' .env
- sed -i "s/\(^APP_URL=\).*/\1https:\/\/${DEPLOY_ADDRESS}/" .env - sed -i "s/\(^APP_URL=\).*/\1https:\/\/${DEPLOY_ADDRESS}/" .env
# TEMPORARY UNTIL THIS BRANCH GETS MERGED INTO THE SCRIBE PROJECT
# PHP 8 came out less than a month ago and not everything supports it yet T_T
- cd vendor/knuckleswtf
- rm -rf scribe
- git clone --branch php8 https://github.com/knuckleswtf/scribe.git
- cd ../..
- "if (php artisan scribe:generate | grep \"Exception\") then echo \"Failed to generate API docs.\" && false; else true; fi" - "if (php artisan scribe:generate | grep \"Exception\") then echo \"Failed to generate API docs.\" && false; else true; fi"
artifacts: artifacts:
paths: paths:
...@@ -113,7 +107,7 @@ deploy application: ...@@ -113,7 +107,7 @@ deploy application:
- docker build --build-arg APP_IMAGE=$DOORCODE_IMAGE_NAME -t $NGINX_IMAGE_NAME -f nginx.Dockerfile . - docker build --build-arg APP_IMAGE=$DOORCODE_IMAGE_NAME -t $NGINX_IMAGE_NAME -f nginx.Dockerfile .
- docker stack deploy -c docker-compose.prod.yml doorcode --prune - docker stack deploy -c docker-compose.prod.yml doorcode --prune
# Give it some time to spin up... # Give it some time to spin up...
- sleep 60 - sleep 120
# Make sure app is running # Make sure app is running
- "curl --fail --insecure --silent --location https://${DEPLOY_ADDRESS}/api > /dev/null" - "curl --fail --insecure --silent --location https://${DEPLOY_ADDRESS}/api > /dev/null"
- "curl --fail --insecure --silent --location https://${DEPLOY_ADDRESS}/api/docs > /dev/null" - "curl --fail --insecure --silent --location https://${DEPLOY_ADDRESS}/api/docs > /dev/null"
......
...@@ -29,6 +29,9 @@ class BodyAuthenticationStrategy extends Strategy ...@@ -29,6 +29,9 @@ class BodyAuthenticationStrategy extends Strategy
if ($controller->getShortName() === 'MeController') { if ($controller->getShortName() === 'MeController') {
$token = 'token_string_engr'; $token = 'token_string_engr';
} }
if ($controller->getShortName() === 'DoorController') {
$token = 'door_1_api_token';
}
return [ return [
'api_token' => [ 'api_token' => [
......
...@@ -21,13 +21,19 @@ class UnauthenticatedResponseStrategy extends Strategy ...@@ -21,13 +21,19 @@ class UnauthenticatedResponseStrategy extends Strategy
return null; return null;
} }
return [ $unauthenticated = [
[
'content' => [ 'content' => [
'message' => 'Unauthenticated', 'message' => 'Unauthenticated',
], ],
'status' => 401, 'status' => 401,
], ];
if ($controller->getShortName() === 'DoorController') {
return [$unauthenticated];
}
return [
$unauthenticated,
[ [
'content' => [ 'content' => [
'message' => 'Unauthorized', 'message' => 'Unauthorized',
......
{ {
"name": "laravel/laravel", "name": "wwu/elock",
"type": "project", "type": "project",
"description": "The Laravel Framework.", "description": "Elock doorcode protection system.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT", "license": "MIT",
"require": { "require": {
"php": "^8.0", "php": "^8.0",
...@@ -14,6 +10,7 @@ ...@@ -14,6 +10,7 @@
"fruitcake/laravel-cors": "^1.0", "fruitcake/laravel-cors": "^1.0",
"laravel/framework": "^8.0", "laravel/framework": "^8.0",
"laravel/tinker": "^2.0", "laravel/tinker": "^2.0",
"guzzlehttp/guzzle": "^7.0.1",
"laravel/ui": "^3.0", "laravel/ui": "^3.0",
"rlanvin/php-rrule": "^2.2", "rlanvin/php-rrule": "^2.2",
"ext-json": "*" "ext-json": "*"
...@@ -22,8 +19,8 @@ ...@@ -22,8 +19,8 @@
"bamarni/composer-bin-plugin": "^1.4", "bamarni/composer-bin-plugin": "^1.4",
"facade/ignition": "^2.3.6", "facade/ignition": "^2.3.6",
"friendsofphp/php-cs-fixer": "^2.16", "friendsofphp/php-cs-fixer": "^2.16",
"fzaninotto/faker": "^1.9.1", "fakerphp/faker": "^1.9.1",
"knuckleswtf/scribe": "^2.0.0", "knuckleswtf/scribe": "^2.5.0",
"mockery/mockery": "^1.0", "mockery/mockery": "^1.0",
"nunomaduro/collision": "^5.0", "nunomaduro/collision": "^5.0",
"phpunit/phpunit": "^9.5", "phpunit/phpunit": "^9.5",
......
This diff is collapsed.
...@@ -98,7 +98,8 @@ return [ ...@@ -98,7 +98,8 @@ return [
* Any extra authentication-related info for your users. For instance, you can describe how to find or generate their auth credentials. * Any extra authentication-related info for your users. For instance, you can describe how to find or generate their auth credentials.
* Markdown and HTML are supported. * Markdown and HTML are supported.
*/ */
'extra_info' => 'You can retrieve receive a temporary token by using the login api, or by requesting a permanent API token from an ELock Admin.', 'extra_info' => 'This API can also be authenticated using a Bearer token (required in the case of doors), or using a session cookie.' .
'You can retrieve receive a temporary token by using the login api, or by requesting a permanent API token from an Elock Admin.',
], ],
/* /*
...@@ -131,7 +132,7 @@ INTRO ...@@ -131,7 +132,7 @@ INTRO
* The base URL to be used in examples. * The base URL to be used in examples.
* If this is null, Scribe will use the value of config('app.url'). * If this is null, Scribe will use the value of config('app.url').
*/ */
'base_url' => 'https://elock.cs.wallawalla.edu', 'base_url' => null,
/* /*
* Generate a Postman collection in addition to HTML docs. * Generate a Postman collection in addition to HTML docs.
...@@ -266,8 +267,7 @@ INTRO ...@@ -266,8 +267,7 @@ INTRO
'headers' => [ 'headers' => [
'Content-Type' => 'application/json', 'Content-Type' => 'application/json',
'Accept' => 'application/json', 'Accept' => 'application/json',
'Authorization' => 'Bearer token_string_engr', // 'Authorization' => 'Bearer token_string_engr',
// 'Api-Version' => 'v2',
], ],
/* /*
...@@ -454,7 +454,7 @@ INTRO ...@@ -454,7 +454,7 @@ INTRO
'headers' => [ 'headers' => [
'Content-Type' => 'application/json', 'Content-Type' => 'application/json',
'Accept' => 'application/json', 'Accept' => 'application/json',
'Authorization' => 'Bearer token_string_admin', // 'Authorization' => 'Bearer token_string_admin',
], ],
/* /*
......
Supports Markdown
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