diff --git a/config/saml2.php b/config/saml2.php index 541f9fb..9c3a726 100644 --- a/config/saml2.php +++ b/config/saml2.php @@ -137,6 +137,16 @@ 'proxyVars' => false, + /* + | (Optional) Which class implements the route functions. + | If left blank, defaults to this lib's controller (Slides\Saml2\Http\Controllers\Saml2Controller). + | If you need to extend Saml2Controller (e.g. to override the `login()` function to pass + | a `$returnTo` argument), this value allows you to pass your own controller, and have + | it used in the routes definition. + | + */ + 'saml2_controller' => '', + /* |-------------------------------------------------------------------------- | Service Provider configuration. diff --git a/src/Http/routes.php b/src/Http/routes.php index 90a23b3..75cc5b7 100644 --- a/src/Http/routes.php +++ b/src/Http/routes.php @@ -6,28 +6,30 @@ 'prefix' => config('saml2.routesPrefix'), 'middleware' => array_merge(['saml2.resolveTenant'], config('saml2.routesMiddleware')), ], function () { + $saml2_controller = config('saml2.saml2_controller', 'Slides\Saml2\Http\Controllers\Saml2Controller'); + Route::get('/{uuid}/logout', array( 'as' => 'saml.logout', - 'uses' => 'Slides\Saml2\Http\Controllers\Saml2Controller@logout', + 'uses' => $saml2_controller.'@logout', )); Route::get('/{uuid}/login', array( 'as' => 'saml.login', - 'uses' => 'Slides\Saml2\Http\Controllers\Saml2Controller@login', + 'uses' => $saml2_controller.'@login', )); Route::get('/{uuid}/metadata', array( 'as' => 'saml.metadata', - 'uses' => 'Slides\Saml2\Http\Controllers\Saml2Controller@metadata', + 'uses' => $saml2_controller.'@metadata', )); Route::post('/{uuid}/acs', array( 'as' => 'saml.acs', - 'uses' => 'Slides\Saml2\Http\Controllers\Saml2Controller@acs', + 'uses' => $saml2_controller.'@acs', )); Route::get('/{uuid}/sls', array( 'as' => 'saml.sls', - 'uses' => 'Slides\Saml2\Http\Controllers\Saml2Controller@sls', + 'uses' => $saml2_controller.'@sls', )); });