You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
1.3 KiB
58 lines
1.3 KiB
3 years ago
|
<?php
|
||
|
|
||
|
namespace authkit2\Providers;
|
||
|
|
||
|
use Illuminate\Support\ServiceProvider;
|
||
|
|
||
|
class Authkit2ServiceProvider extends ServiceProvider
|
||
|
{
|
||
|
|
||
|
/**
|
||
|
* Register all providers and other components for any enabled features
|
||
|
* of the library.
|
||
|
*
|
||
|
* @return void
|
||
|
*/
|
||
|
public function register(): void
|
||
|
{
|
||
|
$this->mergeConfigFrom(__DIR__.'/../../config/authkit.php', 'authkit');
|
||
|
|
||
|
if (config('authkit.authn.enable'))
|
||
|
{
|
||
|
$this->app->register(AuthnServiceProvider::class);
|
||
|
}
|
||
|
|
||
|
if (config('authkit.authz.enable'))
|
||
|
{
|
||
|
$this->app->register(AuthzServiceProvider::class);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Register publishable resources
|
||
|
*
|
||
|
* @return void
|
||
|
*/
|
||
|
public function boot(): void
|
||
|
{
|
||
|
if ($this->app->runningInConsole())
|
||
|
{
|
||
|
$this->publishes([
|
||
|
__DIR__.'/../../config/authkit.php' => config_path('authkit.php')
|
||
|
], 'config');
|
||
|
|
||
|
$this->publishes([
|
||
|
__DIR__.'/../../database/migrations/new/authkit2_users_update.php' => database_path('migrations/'.date('Y_m_d_His').'_authkit2_users_update.php')
|
||
|
], 'migrations_new');
|
||
|
$this->publishes([
|
||
|
__DIR__.'/../../database/migrations/existing/authkit2_users_update_minimal.php' => database_path('migrations/'.date('Y_m_d_His').'_authkit2_users_update_minimal.php')
|
||
|
], 'migrations_existing');
|
||
|
}
|
||
|
|
||
|
$this->app->booted(function($app) {
|
||
|
\authkit2\Oidc\Client::setUrl(config('authkit.authn.openid.endpoint'));
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
|