try scramble auth
This commit is contained in:
parent
866a3de915
commit
786d191092
|
|
@ -21,11 +21,22 @@ class AppServiceProvider extends ServiceProvider
|
||||||
/**
|
/**
|
||||||
* Bootstrap any application services.
|
* Bootstrap any application services.
|
||||||
*/
|
*/
|
||||||
public function boot()
|
public function boot(): void
|
||||||
{
|
{
|
||||||
if ($this->app->environment('production')) {
|
if ($this->app->environment('production')) {
|
||||||
URL::forceScheme('https');
|
URL::forceScheme('https');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Scramble::auth(function ($request) {
|
||||||
|
// Option A : Autoriser tout le monde (Attention : Ta doc sera publique !)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
/* // Option B : Autoriser seulement certains emails (Recommandé)
|
||||||
|
return in_array($request->user()?->email, [
|
||||||
|
'admin@tondomaine.com',
|
||||||
|
]);
|
||||||
|
*/
|
||||||
|
});
|
||||||
Scramble::afterOpenApiGenerated(function (OpenApi $openApi) {
|
Scramble::afterOpenApiGenerated(function (OpenApi $openApi) {
|
||||||
$openApi->secure(
|
$openApi->secure(
|
||||||
SecurityScheme::http('bearer')
|
SecurityScheme::http('bearer')
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue