]> BookStack Code Mirror - bookstack/blob - app/Config/saml2.php
Add support Windows Authentication via SAML
[bookstack] / app / Config / saml2.php
1 <?php
2
3 return [
4
5     // Display name, shown to users, for SAML2 option
6     'name' => env('SAML2_NAME', 'SSO'),
7
8     // Dump user details after a login request for debugging purposes
9     'dump_user_details' => env('SAML2_DUMP_USER_DETAILS', false),
10
11     // Attribute, within a SAML response, to find the user's email address
12     'email_attribute' => env('SAML2_EMAIL_ATTRIBUTE', 'email'),
13     // Attribute, within a SAML response, to find the user's display name
14     'display_name_attributes' => explode('|', env('SAML2_DISPLAY_NAME_ATTRIBUTES', 'username')),
15     // Attribute, within a SAML response, to use to connect a BookStack user to the SAML user.
16     'external_id_attribute' => env('SAML2_EXTERNAL_ID_ATTRIBUTE', null),
17
18     // Group sync options
19     // Enable syncing, upon login, of SAML2 groups to BookStack groups
20     'user_to_groups' => env('SAML2_USER_TO_GROUPS', false),
21     // Attribute, within a SAML response, to find group names on
22     'group_attribute' => env('SAML2_GROUP_ATTRIBUTE', 'group'),
23     // When syncing groups, remove any groups that no longer match. Otherwise sync only adds new groups.
24     'remove_from_groups' => env('SAML2_REMOVE_FROM_GROUPS', false),
25
26     // Autoload IDP details from the metadata endpoint
27     'autoload_from_metadata' => env('SAML2_AUTOLOAD_METADATA', false),
28
29     // Overrides, in JSON format, to the configuration passed to underlying onelogin library.
30     'onelogin_overrides' => env('SAML2_ONELOGIN_OVERRIDES', null),
31
32
33     'onelogin' => [
34         // If 'strict' is True, then the PHP Toolkit will reject unsigned
35         // or unencrypted messages if it expects them signed or encrypted
36         // Also will reject the messages if not strictly follow the SAML
37         // standard: Destination, NameId, Conditions ... are validated too.
38         'strict' => true,
39
40         // Enable debug mode (to print errors)
41         'debug' => env('APP_DEBUG', false),
42
43         // Set a BaseURL to be used instead of try to guess
44         // the BaseURL of the view that process the SAML Message.
45         // Ex. http://sp.example.com/
46         //     http://example.com/sp/
47         'baseurl' => null,
48
49         // Service Provider Data that we are deploying
50         'sp' => [
51             // Identifier of the SP entity  (must be a URI)
52             'entityId' => '',
53
54             // Specifies info about where and how the <AuthnResponse> message MUST be
55             // returned to the requester, in this case our SP.
56             'assertionConsumerService' => [
57                 // URL Location where the <Response> from the IdP will be returned
58                 'url' => '',
59                 // SAML protocol binding to be used when returning the <Response>
60                 // message.  Onelogin Toolkit supports for this endpoint the
61                 // HTTP-POST binding only
62                 'binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST',
63             ],
64
65             // Specifies info about where and how the <Logout Response> message MUST be
66             // returned to the requester, in this case our SP.
67             'singleLogoutService' => [
68                 // URL Location where the <Response> from the IdP will be returned
69                 'url' => '',
70                 // SAML protocol binding to be used when returning the <Response>
71                 // message.  Onelogin Toolkit supports for this endpoint the
72                 // HTTP-Redirect binding only
73                 'binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect',
74             ],
75
76             // Specifies constraints on the name identifier to be used to
77             // represent the requested subject.
78             // Take a look on lib/Saml2/Constants.php to see the NameIdFormat supported
79             'NameIDFormat' => 'urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress',
80             // Usually x509cert and privateKey of the SP are provided by files placed at
81             // the certs folder. But we can also provide them with the following parameters
82             'x509cert' => '',
83             'privateKey' => '',
84         ],
85         // Identity Provider Data that we want connect with our SP
86         'idp' => [
87             // Identifier of the IdP entity  (must be a URI)
88             'entityId' => env('SAML2_IDP_ENTITYID', null),
89             // SSO endpoint info of the IdP. (Authentication Request protocol)
90             'singleSignOnService' => [
91                 // URL Target of the IdP where the SP will send the Authentication Request Message
92                 'url' => env('SAML2_IDP_SSO', null),
93                 // SAML protocol binding to be used when returning the <Response>
94                 // message.  Onelogin Toolkit supports for this endpoint the
95                 // HTTP-Redirect binding only
96                 'binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect',
97             ],
98             // SLO endpoint info of the IdP.
99             'singleLogoutService' => [
100                 // URL Location of the IdP where the SP will send the SLO Request
101                 'url' => env('SAML2_IDP_SLO', null),
102                 // URL location of the IdP where the SP will send the SLO Response (ResponseLocation)
103                 // if not set, url for the SLO Request will be used
104                 'responseUrl' => '',
105                 // SAML protocol binding to be used when returning the <Response>
106                 // message.  Onelogin Toolkit supports for this endpoint the
107                 // HTTP-Redirect binding only
108                 'binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect',
109             ],
110             // Public x509 certificate of the IdP
111             'x509cert' => env('SAML2_IDP_x509', null),
112             /*
113              *  Instead of use the whole x509cert you can use a fingerprint in
114              *  order to validate the SAMLResponse, but we don't recommend to use
115              *  that method on production since is exploitable by a collision
116              *  attack.
117              *  (openssl x509 -noout -fingerprint -in "idp.crt" to generate it,
118              *   or add for example the -sha256 , -sha384 or -sha512 parameter)
119              *
120              *  If a fingerprint is provided, then the certFingerprintAlgorithm is required in order to
121              *  let the toolkit know which Algorithm was used. Possible values: sha1, sha256, sha384 or sha512
122              *  'sha1' is the default value.
123              */
124             // 'certFingerprint' => '',
125             // 'certFingerprintAlgorithm' => 'sha1',
126             /* In some scenarios the IdP uses different certificates for
127              * signing/encryption, or is under key rollover phase and more
128              * than one certificate is published on IdP metadata.
129              * In order to handle that the toolkit offers that parameter.
130              * (when used, 'x509cert' and 'certFingerprint' values are
131              * ignored).
132              */
133             // 'x509certMulti' => array(
134             //      'signing' => array(
135             //          0 => '<cert1-string>',
136             //      ),
137             //      'encryption' => array(
138             //          0 => '<cert2-string>',
139             //      )
140             // ),
141         ],
142         'security' => [
143             // Specifies Authentication context
144             // false means that IDP choose authentication method
145             // null force Form based authentication or is possible set via array supported methods. See to onelogin/php-sampl/advance_settings
146             'requestedAuthnContext' => env('SAML2_IDP_AUTHNCONTEXT',false), 
147         ],
148     ],
149
150 ];