PHPackages                             khan-zia/laravel-saml-idp - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. khan-zia/laravel-saml-idp

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

khan-zia/laravel-saml-idp
=========================

Make your Laravel application an Identity Provider using SAML 2.0.

v2.6.0(5y ago)01491proprietaryPHPPHP ^7.4 || ^8.0

Since Aug 9Pushed 5y ago1 watchersCompare

[ Source](https://github.com/khan-zia/laravel-saml-idp)[ Packagist](https://packagist.org/packages/khan-zia/laravel-saml-idp)[ RSS](/packages/khan-zia-laravel-saml-idp/feed)WikiDiscussions master Synced yesterday

READMEChangelog (10)Dependencies (4)Versions (15)Used By (0)

[![Latest Version on Packagist](https://camo.githubusercontent.com/f54dbd7e432acee595adb6cd1df57fd62dffe51aa799d9086d6d80d7db0b2f1a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6b68616e2d7a69612f6c61726176656c2d73616d6c2d6964702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/khan-zia/laravel-saml-idp)[![Total Downloads](https://camo.githubusercontent.com/d0d97be1036021b11c25110a5737d920f7a910f5f5e6b35671bf501ad1b71140/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6b68616e2d7a69612f6c61726176656c2d73616d6c2d6964702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/khan-zia/laravel-saml-idp)

Laravel SAML IDP
================

[](#laravel-saml-idp)

This library only supports Laravel 7.x onwards.

Installation
------------

[](#installation)

```
composer require khan-zia/laravel-saml-idp
```

Configuration
=============

[](#configuration)

```
php artisan vendor:publish --tag="samlidp_config"
```

FileSystem configuration

```
// config/filesystem.php

'disks' => [

        ...

        'samlidp' => [
            'driver' => 'local',
            'root' => storage_path() . '/samlidp',
        ]
],
```

Use the following command to create a self signed certificate for your IdP. If you change the certname or keyname to anything other than the default names, you will need to update your `config/samlidp.php` config file to reflect those new file names.

```
php artisan samlidp:cert [--days  --keyname  --certname ]
```

```
Options:
  --days=      Days to add for the expiration date [default: 7800]
  --keyname=   Name of the certificate key file [default: key.pem]
  --certname=  Name of the certificate file [default: cert.pem]
```

Usage
-----

[](#usage)

Within your login view, probably `resources/views/auth/login.blade.php` add the SAMLRequest directive beneath the CSRF directive:

```
@csrf
@samlidp
```

The SAMLRequest directive will fill out the hidden input automatically when a SAMLRequest is sent by an HTTP request and therefore initiate a SAML authentication attempt. To initiate the SAML auth, the login and redirect processes need to be intervened. This is done using the Laravel events fired upon authentication.

Config
------

[](#config)

After you publish the config file, you will need to set up your Service Providers. The key for the Service Provider is a base 64 encoded Consumer Service (ACS) URL. You can get this information from your Service Provider, but you will need to base 64 encode the URL and place it in your config. This is due to config dot notation.

You may use this command to help generate a new SAML Service Provider:

```
php artisan samlidp:sp
```

Example SP in `config/samlidp.php` file:

```
