mirror of
https://github.com/HolgerHatGarKeineNode/einundzwanzig-nostr.git
synced 2025-12-27 21:30:16 +00:00
🛠️ Integrate Nostr auth across relevant components and views 📦 Update config, routes, and service provider for Nostr auth
31 lines
811 B
PHP
31 lines
811 B
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use App\Auth\NostrSessionGuard;
|
|
use App\Auth\NostrUserProvider;
|
|
use Illuminate\Foundation\Application;
|
|
use Illuminate\Support\Facades\Auth;
|
|
use Illuminate\Support\ServiceProvider;
|
|
|
|
class NostrAuthServiceProvider extends ServiceProvider
|
|
{
|
|
public function boot(): void
|
|
{
|
|
Auth::provider('nostr', function (Application $app, array $config) {
|
|
return new NostrUserProvider();
|
|
});
|
|
|
|
Auth::extend('nostr-session', function (Application $app, string $name, array $config) {
|
|
$provider = Auth::createUserProvider($config['provider']);
|
|
|
|
return new NostrSessionGuard(
|
|
$name,
|
|
$provider,
|
|
$app['session.store'],
|
|
$app['request']
|
|
);
|
|
});
|
|
}
|
|
}
|