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