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

Upgrade instruction from 1.x to 2.x #221

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
38 changes: 38 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,44 @@ A Laravel package for Saml2 integration as a SP (service provider) based on [On

The aim of this library is to be as simple as possible. We won't mess with Laravel users, auth, session... We prefer to limit ourselves to a concrete task. Ask the user to authenticate at the IDP and process the response. Same case for SLO (Single Logout) requests.

## How to upgrade 1.x to 2.x
* Backup existing `config/saml2_settings.php`
* Delete existing `config/saml2_settings.php`
* Edit `config/app.php`:
```php
'providers' => [
...
Aacotroneo\Saml2\Saml2ServiceProvider::class,
]
```
* Republish the config files with `php artisan vendor:publish --provider="Aacotroneo\Saml2\Saml2ServiceProvider"`.
* Edit `app/Http/Middleware/VerifyCsrfToken.php`
```php
protected $except = [
...
'/saml2/*'
];
```
* Modify `app/Exceptions/Handler.php`
```php
protected function unauthenticated($request, AuthenticationException $exception)
{
if ($request->expectsJson())
{
return response()->json(['error' => 'Unauthenticated.'], 401); // Or, return a response that causes client side js to redirect to '/routesPrefix/myIdp1/login'
}

$saml2Auth = new Saml2Auth(Saml2Auth::loadOneLoginAuthFromIpdConfig('mytestidp1'));
return $saml2Auth->login('/my/redirect/path');
}
```
* If you are using only "web" and "api" routeMiddleware's then in your config/saml2_settings.php need to be:
```php
...
'routesMiddleware' => ['web'],
...
```

## Installation - Composer

You can install the package via composer:
Expand Down