Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions config/saml2.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' => '',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not define the default one here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went with the empty string so as to mirror the original PR as closely as possible
aacotroneo/laravel-saml2@34fe227

I imagine the original author probably chose to do this so that user error would be marginally safer (that is to say, if they set their config to false or something it shouldn't break the routes).


/*
|--------------------------------------------------------------------------
| Service Provider configuration.
Expand Down
12 changes: 7 additions & 5 deletions src/Http/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
));
});