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

api doc updates

parent d4e24e69
Pipeline #13230 passed with stages
in 9 minutes and 21 seconds
......@@ -69,12 +69,6 @@ generate_api_docs:
- cd src/backend
- sed -i 's/\(^APP_ENV=\).*/\1memory/' .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"
artifacts:
paths:
......@@ -113,7 +107,7 @@ deploy application:
- 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
# Give it some time to spin up...
- sleep 60
- sleep 120
# 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/docs > /dev/null"
......
......@@ -29,6 +29,9 @@ class BodyAuthenticationStrategy extends Strategy
if ($controller->getShortName() === 'MeController') {
$token = 'token_string_engr';
}
if ($controller->getShortName() === 'DoorController') {
$token = 'door_1_api_token';
}
return [
'api_token' => [
......
......@@ -21,13 +21,19 @@ class UnauthenticatedResponseStrategy extends Strategy
return null;
}
return [
[
$unauthenticated = [
'content' => [
'message' => 'Unauthenticated',
],
'status' => 401,
],
];
if ($controller->getShortName() === 'DoorController') {
return [$unauthenticated];
}
return [
$unauthenticated,
[
'content' => [
'message' => 'Unauthorized',
......
{
"name": "laravel/laravel",
"name": "wwu/elock",
"type": "project",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"description": "Elock doorcode protection system.",
"license": "MIT",
"require": {
"php": "^8.0",
......@@ -14,6 +10,7 @@
"fruitcake/laravel-cors": "^1.0",
"laravel/framework": "^8.0",
"laravel/tinker": "^2.0",
"guzzlehttp/guzzle": "^7.0.1",
"laravel/ui": "^3.0",
"rlanvin/php-rrule": "^2.2",
"ext-json": "*"
......@@ -22,8 +19,8 @@
"bamarni/composer-bin-plugin": "^1.4",
"facade/ignition": "^2.3.6",
"friendsofphp/php-cs-fixer": "^2.16",
"fzaninotto/faker": "^1.9.1",
"knuckleswtf/scribe": "^2.0.0",
"fakerphp/faker": "^1.9.1",
"knuckleswtf/scribe": "^2.5.0",
"mockery/mockery": "^1.0",
"nunomaduro/collision": "^5.0",
"phpunit/phpunit": "^9.5",
......
This diff is collapsed.
......@@ -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.
* 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
* The base URL to be used in examples.
* 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.
......@@ -266,8 +267,7 @@ INTRO
'headers' => [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer token_string_engr',
// 'Api-Version' => 'v2',
// 'Authorization' => 'Bearer token_string_engr',
],
/*
......@@ -454,7 +454,7 @@ INTRO
'headers' => [
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Bearer token_string_admin',
// 'Authorization' => 'Bearer token_string_admin',
],
/*
......
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