PHPackages                             lotashinski/saml-sp-package - 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. lotashinski/saml-sp-package

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

lotashinski/saml-sp-package
===========================

Saml library for service-provider

6.1.0(3y ago)026proprietaryPHPPHP &gt;=8.0

Since Nov 29Pushed 3y ago1 watchersCompare

[ Source](https://github.com/Lotashinski/saml-sp-package)[ Packagist](https://packagist.org/packages/lotashinski/saml-sp-package)[ Docs](https://github.com/Lotashinski/saml-sp-package)[ RSS](/packages/lotashinski-saml-sp-package/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (9)Dependencies (4)Versions (14)Used By (0)

SamlPackage
===========

[](#samlpackage)

---

Installation
============

[](#installation)

---

Install the latest version with

```
$ composer require lotashinski/saml-sp-package
```

Basic Usage
===========

[](#basic-usage)

---

1. Generate cert
----------------

[](#1-generate-cert)

You can use openssl to generate keys and certificate:

```
$ openssl genrsa -out encryptKey.pem 4096
$ openssl req -new -x509 -key encryptKey.pem -out encryptionCert.cer -days 3650
```

2. Create config file
---------------------

[](#2-create-config-file)

Create a file in project settings. For Symfony: `./config`.

```
## config/sso_saml.yaml

# Indicates user data keys in the IdP response
response:
  user_uid:   # user unique id in IdP
  user_login: # user login
  user_email: # user email

# Valid until (Unix time)
valid_until: 1672520400

# The block is passed to the package https://github.com/onelogin/php-sam
providers_setting:
  strict: true
  debug: false
  baseurl: null

  sp:
    entityId: # unique sp id (allow domain)

    assertionConsumerService:
      url: # example https:///app/saml/login
      binding: # example urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST

    singleLogoutService:
      url: # example https:///app/saml/logout
      binding: # example urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect

    NameIDFormat: # example urn:oasis:names:tc:SAML:2.0:nameid-format:transient

    x509cert:
    # copy from encryptKey.pem
    privateKey:
    # copy from encryptKey.cer

  idp:
    entityId: # example https:///simplesaml/saml2/idp/metadata.php

    singleSignOnService:
      url: # example https:///simplesaml/saml2/idp/SSOService.php
      binding: # urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect

    singleLogoutService:
      url: # example https:///simplesaml/saml2/idp/SingleLogoutService.php

      binding: # urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect

    x509cert:
    # Identity provider cert

```

3. Configure in app
-------------------

[](#3-configure-in-app)

### Configure from code

[](#configure-from-code)

```
