Skip to content

tatsuyaueda/LaravelSAML2_Sample

Repository files navigation

Laravel SAML2 認証サンプル

  1. git clone https://github.com/tatsuyaueda/LaravelSAML2_Sample.git
  2. cd LaravelSAML2_Sample
  3. composer install
  4. cp .env.example .env
  5. .env にデータベースの設定をする
  6. php artisan key:generate
  7. php artisan migrate
  8. config/saml2_settings.php を作成
  9. Laravelのユーザを登録
  10. ブラウザで /saml2/login にアクセスすると、SAMLで認証が走ります。

saml2_settings.php のサンプル

<?php

return $settings = array( 'useRoutes' => true,
    'routesPrefix' => '/saml2',
    'routesMiddleware' => ['saml'],
    'retrieveParametersFromServer' => false,
    'logoutRoute' => '/logout',
    'loginRoute' => '/home',
    'errorRoute' => '/error',
    'strict' => true, //@todo: make this depend on laravel config
    'debug' => true, //@todo: make this depend on laravel config
    'sp' => array(
        'NameIDFormat' => 'urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress',
        'x509cert' => 'foobar',
        'privateKey' => 'foobar',
    ),
    'idp' => array(
        'entityId' => 'https://openam.example.com/OpenAM',
        'singleSignOnService' => array(
            'url' => 'https://openam.example.com/OpenAM/SSORedirect/metaAlias/idp',
        ),
        'singleLogoutService' => array(
            'url' => 'https://openam.example.com/OpenAM/IDPSloRedirect/metaAlias/idp',
        ),
        'certFingerprint' => 'foobar',
    ),
    'security' => array(
        'nameIdEncrypted' => false,
        'authnRequestsSigned' => true,
        'logoutRequestSigned' => false,
        'logoutResponseSigned' => false,
        'signMetadata' => false,
        'wantMessagesSigned' => false,
        'wantAssertionsSigned' => false,
        'wantNameIdEncrypted' => false,
        'requestedAuthnContext' => true,
    ),
);

License

The Laravel framework is open-sourced software licensed under the MIT license.

About

LaravelでSAML2の認証を実装したサンプル

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published