Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renamed config/saml2_settings.php config/saml2.php #151

Open
wants to merge 1 commit into
base: remove_mcrypt
Choose a base branch
from
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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ For older versions of Laravel (<5.5), you have to add the service provider and a
]
```

Then publish the config file with `php artisan vendor:publish`. This will add the file `app/config/saml2_settings.php`. This config is handled almost directly by [OneLogin](https://github.com/onelogin/php-saml) so you may get further references there, but will cover here what's really necessary. There are some other config about routes you may want to check, they are pretty straightforward.
Then publish the config file with `php artisan vendor:publish`. This will add the file `app/config/saml2.php`. This config is handled almost directly by [OneLogin](https://github.com/onelogin/php-saml) so you may get further references there, but will cover here what's really necessary. There are some other config about routes you may want to check, they are pretty straightforward.

### Configuration

Once you publish your saml2_settings.php to your own files, you need to configure your sp and IDP (remote server). The only real difference between this config and the one that OneLogin uses, is that the SP entityId, assertionConsumerService url and singleLogoutService URL are injected by the library. They are taken from routes 'saml_metadata', 'saml_acs' and 'saml_sls' respectively.
Once you publish your saml2.php to your own files, you need to configure your sp and IDP (remote server). The only real difference between this config and the one that OneLogin uses, is that the SP entityId, assertionConsumerService url and singleLogoutService URL are injected by the library. They are taken from routes 'saml_metadata', 'saml_acs' and 'saml_sls' respectively.

Remember that you don't need to implement those routes, but you'll need to add them to your IDP configuration. For example, if you use simplesamlphp, add the following to /metadata/sp-remote.php

Expand Down
10 changes: 5 additions & 5 deletions src/Aacotroneo/Saml2/Http/Controllers/Saml2Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function acs()

logger()->error('Saml2 error', $errors);
session()->flash('saml2_error', $errors);
return redirect(config('saml2_settings.errorRoute'));
return redirect(config('saml2.errorRoute'));
}
$user = $this->saml2Auth->getSaml2User();

Expand All @@ -60,7 +60,7 @@ public function acs()
return redirect($redirectUrl);
} else {

return redirect(config('saml2_settings.loginRoute'));
return redirect(config('saml2.loginRoute'));
}
}

Expand All @@ -71,12 +71,12 @@ public function acs()
*/
public function sls()
{
$error = $this->saml2Auth->sls(config('saml2_settings.retrieveParametersFromServer'));
$error = $this->saml2Auth->sls(config('saml2.retrieveParametersFromServer'));
if (!empty($error)) {
throw new \Exception("Could not log out");
}

return redirect(config('saml2_settings.logoutRoute')); //may be set a configurable default
return redirect(config('saml2.logoutRoute')); //may be set a configurable default
}

/**
Expand All @@ -97,7 +97,7 @@ public function logout(Request $request)
*/
public function login()
{
$this->saml2Auth->login(config('saml2_settings.loginRoute'));
$this->saml2Auth->login(config('saml2.loginRoute'));
}

}
8 changes: 4 additions & 4 deletions src/Aacotroneo/Saml2/Saml2ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ class Saml2ServiceProvider extends ServiceProvider
*/
public function boot()
{
if(config('saml2_settings.useRoutes', false) == true ){
if(config('saml2.useRoutes', false) == true ){
include __DIR__ . '/../../routes.php';
}

$this->publishes([
__DIR__.'/../../config/saml2_settings.php' => config_path('saml2_settings.php'),
__DIR__.'/../../config/saml2.php' => config_path('saml2.php'),
]);

if (config('saml2_settings.proxyVars', false)) {
if (config('saml2.proxyVars', false)) {
\OneLogin\Saml2\Utils::setProxyVars(true);
}
}
Expand All @@ -55,7 +55,7 @@ public function register()
protected function registerOneLoginInContainer()
{
$this->app->singleton('OneLogin_Saml2_Auth', function ($app) {
$config = config('saml2_settings');
$config = config('saml2');
if (empty($config['sp']['entityId'])) {
$config['sp']['entityId'] = URL::route('saml_metadata');
}
Expand Down
4 changes: 2 additions & 2 deletions src/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@


Route::group([
'prefix' => config('saml2_settings.routesPrefix'),
'middleware' => config('saml2_settings.routesMiddleware'),
'prefix' => config('saml2.routesPrefix'),
'middleware' => config('saml2.routesMiddleware'),
], function () {

Route::get('/logout', array(
Expand Down