- git clone https://github.com/tatsuyaueda/LaravelSAML2_Sample.git
- cd LaravelSAML2_Sample
- composer install
- cp .env.example .env
- .env にデータベースの設定をする
- php artisan key:generate
- php artisan migrate
- config/saml2_settings.php を作成
- Laravelのユーザを登録
- ブラウザで /saml2/login にアクセスすると、SAMLで認証が走ります。
<?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,
),
);
The Laravel framework is open-sourced software licensed under the MIT license.