yumemi-inc / google-iap-laravel
Authentication guard on Laravel for verifying requests from Google IAP (Identity-Aware Proxy).
Installs: 2 215
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 8
Forks: 0
Open Issues: 3
Requires
- php: ^8.1
- google/auth: ^1.37
- illuminate/auth: ^9|^10|^11
- illuminate/contracts: ^9|^10|^11
- illuminate/http: ^9|^10|^11
- illuminate/support: ^9|^10|^11
- kelvinmo/simplejwt: ~0.7.0 || ~0.8.0 || dev-master
- symfony/cache: ^6.4 || ^7.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.51
- nunomaduro/larastan: ^2.9
- orchestra/testbench: ^8.21
- phpstan/extension-installer: ^1.3
- quartetcom/static-analysis-kit: ~8.1.22
- dev-main
- v1.3.1
- v1.3.0
- v1.2.3
- v1.2.2
- v1.2.1
- v1.2.0
- v1.2.0-rc.2
- v1.2.0-rc.1
- v1.1.0
- v1.0.2
- v1.0.1
- v1.0.0
- v1.0.0-rc.6
- v1.0.0-rc.5
- v1.0.0-rc.4
- v1.0.0-rc.3
- v1.0.0-rc.2
- v1.0.0-rc.1
- dev-dependabot/composer/google/auth-1.45.0
- dev-dependabot/composer/kelvinmo/simplejwt-1.0.0
- dev-dependabot/composer/league/commonmark-2.6.0
- dev-dependabot/composer/google/auth-1.44.0
This package is auto-updated.
Last update: 2024-12-16 23:02:29 UTC
README
Warning
This is not an official product of YUMEMI Inc.
Authentication guard on Laravel for verifying requests from Google IAP (Identity-Aware Proxy).
Prerequisites
- PHP 8.1 or later
- ext-gmp for JWT verification
- Laravel 9, 10, or 11 (dev)
Getting Started
-
Require this package as a dependency.
composer require yumemi-inc/google-iap-laravel
-
Implement
GoogleUserResolver
as you need.<?php // app/Security/AppGoogleUserResolver.php (new) use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Contracts\Auth\UserProvider; use YumemiInc\GoogleIapLaravel\Claims; use YumemiInc\GoogleIapLaravel\GoogleUserResolver; class AppGoogleUserResolver implements GoogleUserResolver { public function provide(Claims $claims, UserProvider $userProvider): ?Authenticatable { return $userProvider->retrieveByCredentials([ 'google_user_id' => $claims->id(), ]); } }
-
Register the user resolver as a service.
<?php // app/Providers/AppServiceProvider.php use YumemiInc\GoogleIapLaravel\GoogleUserResolver; public function register(): void { $this->app->bind(GoogleUserProvider::class, AppGoogleUserProvider::class); }
-
Use the guard provided in this package.
<?php // config/auth.php 'guards' => [ 'google-iap' => [ 'driver' => 'google-iap', 'provider' => 'users', ], ]