Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ APP_ENV=development
APP_DEBUG=true
APP_KEY=

AUTH_URL=http://auth.test/
BLIP_URL=http://blip.test/

DB_HOST=mariadb
DB_DATABASE=bolknoms
DB_USERNAME=sail
Expand Down
8 changes: 4 additions & 4 deletions app/BolkLogin/BolkLoginService.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ public function userDetails(User $user): array

try {
$username = null;
$url = 'https://auth.debolk.nl/resource?access_token=' . $user->token;
$url = env('AUTH_URL', 'https://auth.debolk.nl/') . 'resource?access_token=' . $user->token;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't work, because the app uses config caching, so a call to env() will always return null. You'll need to create a config setting.

https://laravel.com/docs/12.x/deployment#optimizing-configuration-loading

$response = $client->get($url);
$username = json_decode($response->getBody())->user_id;

$url = 'https://people.debolk.nl/person/' . $username . '?access_token=' . $user->token;
$url = env('BLIP_URL', 'https://people.debolk.nl/') . 'person/' . $username . '?access_token=' . $user->token;
$response = $client->get($url);
$basicData = json_decode($response->getBody());

Expand All @@ -34,7 +34,7 @@ public function userDetails(User $user): array

return [
'username' => $username,
'name' => $basicData->name,
'name' => "$basicData->firstname $basicData->surname",
'email' => $basicData->email,
];
} catch (ClientException $e) {
Expand All @@ -55,7 +55,7 @@ public function isBoardMember(User $user): bool
{
try {
$client = app(Client::class);
$url = 'https://auth.debolk.nl/bestuur?access_token=' . $user->token;
$url = env('AUTH_URL', 'https://auth.debolk.nl/') . 'bestuur?access_token=' . $user->token;
$client->get($url);
return true;
} catch (ClientException $e) {
Expand Down
6 changes: 3 additions & 3 deletions app/BolkLogin/BolkLoginSocialiteProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ class BolkLoginSocialiteProvider extends AbstractProvider implements ProviderInt

protected function getAuthUrl($state)
{
return $this->buildAuthUrlFromBase('https://auth.debolk.nl/authorize', $state);
return $this->buildAuthUrlFromBase(env('AUTH_URL', 'https://auth.debolk.nl/') . 'authorize', $state);
}

protected function getTokenUrl()
{
return 'https://auth.debolk.nl/token';
return env('AUTH_URL', 'https://auth.debolk.nl/') . 'token';
}

protected function getUserByToken($token)
Expand All @@ -27,7 +27,7 @@ protected function getUserByToken($token)

protected function mapUserToObject(array $user)
{
return (new User())->setRaw($user);
return new User()->setRaw($user);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure why this is in this PR, autoformatting?

}

public static function getAuthorizations(User $user): array
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Helpers/ProfilePicture.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function updatePictureFor(User $user, string $token): void

try {
$client = app(Client::class);
$url = 'https://people.debolk.nl/person/' . $user->username . '/photo?access_token=' . $token;
$url = env('BLIP_URL', 'https://people.debolk.nl/') . 'person/' . $user->username . '/photo?access_token=' . $token;
$file = fopen($path, 'w');
$client->get($url, ['sink' => $file]);
} catch (TransferException $exception) {
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
"laravel/sail": "^1.15",
"mockery/mockery": "^1.5",
"nunomaduro/collision": "^8.6",
"pestphp/pest": "^3.7",
"pestphp/pest-plugin-laravel": "^3.1",
"pestphp/pest": "^4.2",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same with above, unrelated to PR purpose?

"pestphp/pest-plugin-laravel": "^4.0",
"roave/security-advisories": "dev-latest"
},
"config": {
Expand Down
Loading