Skip to content
This repository has been archived by the owner on Apr 2, 2024. It is now read-only.

Make ccache check safer #93

Merged
merged 2 commits into from
Jan 26, 2024
Merged
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
12 changes: 4 additions & 8 deletions app/Support/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
use AMRCFactoryPlus\ServiceClient;
use App\Exceptions\ReauthenticationRequiredException;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider
Expand All @@ -22,18 +20,16 @@ class AppServiceProvider extends ServiceProvider
*/
public function register()
{

$this->app->singletonIf(ServiceClient::class, function (Application $app) {

$ccache = new \KRB5CCache;

// If the user is logged in then get their ccache
// and use that for all future requests
$ccache->open("FILE:/app/storage/".auth()->user()->username . '.ccache');

// If the ccache has expired then re-authenticate by ending the session
// and showing the login modal
try {
// If the user is logged in then get their ccache
// and use that for all future requests
$ccache->open("FILE:/app/storage/" . auth()->user()->username . '.ccache');

$ccache->isValid();
} catch (\Exception $e) {
// Throw a 'ReauthenticationRequiredException' to show the login dialog
Expand Down
Loading