snipe-it/app/Providers/SamlServiceProvider.php
snipe 973eacf6c3 Small fixes for SAML
The SAML routes are in a service provide (sigh), so they did not have the `web` middleware group assigned to it.

I also added some additional checks so that the setup blade won’t fail (the migrations wouldn’t have been run yet, so outside of a try/catch, it would return an error since those tables don’t exist.)
2020-11-24 13:51:02 -08:00

70 lines
1.8 KiB
PHP

<?php
namespace App\Providers;
use App\Services\Saml;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Route;
class SamlServiceProvider extends ServiceProvider
{
/**
* Bootstrap the application services.
*
* @return void
*/
public function boot()
{
$this->app->singleton(Saml::class, Saml::class);
Route::group(['namespace'=> 'App\Http\Controllers'], function () {
Route::group(['prefix'=> 'saml'], function () {
Route::get(
'metadata',
[
'as' => 'saml.metadata',
'uses' => 'Auth\SamlController@metadata' ]
);
Route::match(
['get', 'post'],
'acs',
[
'as' => 'saml.acs',
'uses' => 'Auth\SamlController@acs' ]
);
Route::get(
'sls',
[
'as' => 'saml.sls',
'uses' => 'Auth\SamlController@sls' ]
);
});
Route::get(
'login/saml',
[
'as' => 'saml.login',
'uses' => 'Auth\SamlController@login' ]
);
Route::group(['prefix' => 'admin','middleware' => ['web','auth', 'authorize:superuser']], function () {
Route::get('saml', ['as' => 'settings.saml.index','uses' => 'SettingsController@getSamlSettings' ]);
Route::post('saml', ['as' => 'settings.saml.save','uses' => 'SettingsController@postSamlSettings' ]);
});
});
}
/**
* Register the application services.
*
* @return void
*/
public function register()
{
}
}