You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+23-22Lines changed: 23 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -119,7 +119,7 @@ After installation has completed you will find at the `vendor/` folder a new fol
119
119
**Important** In this option, the x509 certs must be stored at `vendor/onelogin/php-saml/certs`
120
120
and settings file stored at `vendor/onelogin/php-saml`.
121
121
122
-
Your settings are at risk of being deleted when updating packages using `composer update` or similiar commands. So it is **highly** recommended that instead of using settings files, you pass the settings as an array directly to the constructor (explained later in this document). If you do not use this approach your settings are at risk of being deleted when updating packages using `composer update` or similiar commands.
122
+
Your settings are at risk of being deleted when updating packages using `composer update` or similar commands. So it is **highly** recommended that instead of using settings files, you pass the settings as an array directly to the constructor (explained later in this document). If you do not use this approach your settings are at risk of being deleted when updating packages using `composer update` or similar commands.
123
123
124
124
Compatibility
125
125
-------------
@@ -144,7 +144,7 @@ the new features that the new library Saml2 carries.
144
144
Namespaces
145
145
----------
146
146
147
-
If you are using the library with a framework like Symfony2 that contains
147
+
If you are using the library with a framework like Symfony that contains
148
148
namespaces, remember that calls to the class must be done by adding a backslash (`\`) to the
149
149
start, for example to use the static method getSelfURLNoQuery use:
150
150
@@ -159,7 +159,7 @@ In production, the `strict` parameter **MUST** be set as `"true"` and the
159
159
something other than SHA1 (see https://shattered.io/ ). Otherwise your
160
160
environment is not secure and will be exposed to attacks.
161
161
162
-
In production also we highly recommended to register on the settings the IdP certificate instead of using the fingerprint method. The fingerprint, is a hash, so at the end is open to a collision attack that can end on a siganture validation bypass. Other SAML toolkits deprecated that mechanism, we maintain it for compatibility and also to be used on test environment.
162
+
In production also we highly recommended to register on the settings the IdP certificate instead of using the fingerprint method. The fingerprint, is a hash, so at the end is open to a collision attack that can end on a signature validation bypass. Other SAML toolkits deprecated that mechanism, we maintain it for compatibility and also to be used on test environment.
163
163
164
164
Getting started
165
165
---------------
@@ -173,7 +173,7 @@ Let's start describing the folders:
173
173
174
174
#### `certs/` ####
175
175
176
-
SAML requires a x.509 cert to sign and encrypt elements like `NameID`, `Message`,
176
+
SAML requires a x509 cert to sign and encrypt elements like `NameID`, `Message`,
177
177
`Assertion`, `Metadata`.
178
178
179
179
If our environment requires sign or encrypt support, this folder may contain
@@ -186,11 +186,11 @@ Or also we can provide those data in the setting file at the `$settings['sp']['x
186
186
and the `$settings['sp']['privateKey']`.
187
187
188
188
Sometimes we could need a signature on the metadata published by the SP, in
189
-
this case we could use the x.509 cert previously mentioned or use a new x.509
189
+
this case we could use the x509 cert previously mentioned or use a new x509
190
190
cert: `metadata.crt` and `metadata.key`.
191
191
192
192
Use `sp_new.crt` if you are in a key rollover process and you want to
193
-
publish that x509certificate on Service Provider metadata.
193
+
publish that x509 certificate on Service Provider metadata.
194
194
195
195
#### `extlib/` ####
196
196
@@ -545,7 +545,7 @@ $advancedSettings = array (
545
545
546
546
The compression settings allow you to instruct whether or not the IdP can accept
547
547
data that has been compressed using [gzip](gzip) ('requests' and 'responses').
548
-
But if we provide a $deflate boolean parameter to the getRequest or getResponse method it will have priority over the compression settings.
548
+
But if we provide a `$deflate` boolean parameter to the `getRequest` or `getResponse` method it will have priority over the compression settings.
549
549
550
550
In the security section, you can set the way that the SP will handle the messages
551
551
and assertions. Contact the admin of the IdP and ask him what the IdP expects,
@@ -556,7 +556,7 @@ Once we know what kind of data could be configured, let's talk about the way
556
556
settings are handled within the toolkit.
557
557
558
558
The settings files described (`settings.php` and `advanced_settings.php`) are loaded
559
-
by the toolkit if not other array with settings info is provided in the constructors of the toolkit. Let's see some examples.
559
+
by the toolkit if no other array with settings info is provided in the constructor of the toolkit. Let's see some examples.
560
560
561
561
```php
562
562
// Initializes toolkit with settings.php & advanced_settings files.
@@ -570,7 +570,7 @@ $auth = new OneLogin_Saml2_Auth($settingsInfo);
570
570
$settings = new OneLogin_Saml2_Settings($settingsInfo);
571
571
```
572
572
573
-
You can declare the `$settingsInfo` in the file that constains the constructor
573
+
You can declare the `$settingsInfo` in the file that contains the constructor
574
574
execution or locate them in any file and load the file in order to get the
575
575
array available as we see in the following example:
576
576
@@ -632,9 +632,9 @@ The `AuthNRequest` will be sent signed or unsigned based on the security info
632
632
of the `advanced_settings.php` (`'authnRequestsSigned'`).
633
633
634
634
635
-
The IdP will then return the SAML Response to the user's client. The client is then forwarded to the Attribute Consumer Service of the SP with this information. If we do not set a 'url' param in the login method and we are using the default ACS provided by the toolkit (`endpoints/acs.php`), then the ACS endpoint will redirect the user to the file that launched the SSO request.
635
+
The IdP will then return the SAML Response to the user's client. The client is then forwarded to the Attribute Consumer Service of the SP with this information. If we do not set a `'url'` param in the login method and we are using the default ACS provided by the toolkit (`endpoints/acs.php`), then the ACS endpoint will redirect the user to the file that launched the SSO request.
636
636
637
-
We can set an`'returnTo'` url to change the workflow and redirect the user to the other PHP file.
637
+
We can set a`'returnTo'` url to change the workflow and redirect the user to the other PHP file.
@@ -701,7 +701,8 @@ Before the XML metadata is exposed, a check takes place to ensure
701
701
that the info to be provided is valid.
702
702
703
703
Instead of use the Auth object, you can directly use
704
-
```
704
+
705
+
```php
705
706
$settings = new OneLogin_Saml2_Settings($settingsInfo, true);
706
707
```
707
708
to get the settings object and with the true parameter we will avoid the IdP Settings validation.
@@ -1126,11 +1127,11 @@ php-saml toolkit uses a bunch of methods in OneLogin_Saml2_Utils that try to gue
1126
1127
1127
1128
getSelfURLNoQuery and getSelfRoutedURLNoQuery are used to calculate the currentURL in order to valdate SAML elements like Destination or Recipient.
1128
1129
1129
-
When the PHP application is behind a proxy or a load balancer we can execute setProxyVars(true) and getSelfPort and isHTTPS will take care of the $_SERVER["HTTP_X_FORWARDED_PORT"] and $_SERVER['HTTP_X_FORWARDED_PROTO'] vars (otherwise they are ignored).
1130
+
When the PHP application is behind a proxy or a load balancer we can execute `setProxyVars(true)` and `setSelfPort` and `isHTTPS` will take care of the `$_SERVER["HTTP_X_FORWARDED_PORT"]` and `$_SERVER['HTTP_X_FORWARDED_PROTO']` vars (otherwise they are ignored).
1130
1131
1131
-
Also a developer can use setSelfProtocol, setSelfHost, setSelfPort and getBaseURLPath to define a specific value to be returned by isHTTPS, getSelfHost, getSelfPort and getBaseURLPath. And define a setBasePath to be used on the getSelfURL and getSelfRoutedURLNoQuery to replace the data extracted from $_SERVER["REQUEST_URI"].
1132
+
Also a developer can use `setSelfProtocol`, `setSelfHost`, `setSelfPort` and `getBaseURLPath` to define a specific value to be returned by `isHTTPS`, `getSelfHost`, `getSelfPort` and `getBaseURLPath`. And define a `setBasePath` to be used on the `getSelfURL` and `getSelfRoutedURLNoQuery` to replace the data extracted from `$_SERVER["REQUEST_URI"]`.
1132
1133
1133
-
At the settings the developer will be able to set a 'baseurl' parameter that automatically will use setBaseURL to set values for setSelfProtocol, setSelfHost, setSelfPort and setBaseURLPath.
1134
+
At the settings the developer will be able to set a `'baseurl'` parameter that automatically will use `setBaseURL` to set values for `setSelfProtocol`, `setSelfHost`, `setSelfPort` and `setBaseURLPath`.
1134
1135
1135
1136
1136
1137
### Working behind load balancer ###
@@ -1144,7 +1145,7 @@ Or by using the method described on the previous section.
1144
1145
1145
1146
### SP Key rollover ###
1146
1147
1147
-
If you plan to update the SP x509cert and privateKey you can define the new x509cert as $settings['sp']['x509certNew'] and it will be
1148
+
If you plan to update the SP x509cert and privateKey you can define the new x509cert as `$settings['sp']['x509certNew']` and it will be
1148
1149
published on the SP metadata so Identity Providers can read them and get ready for rollover.
1149
1150
1150
1151
@@ -1153,20 +1154,20 @@ published on the SP metadata so Identity Providers can read them and get ready f
1153
1154
In some scenarios the IdP uses different certificates for
1154
1155
signing/encryption, or is under key rollover phase and more than one certificate is published on IdP metadata.
1155
1156
1156
-
In order to handle that the toolkit offers the $settings['idp']['x509certMulti'] parameter.
1157
+
In order to handle that the toolkit offers the `$settings['idp']['x509certMulti']` parameter.
1157
1158
1158
-
When that parameter is used, 'x509cert' and 'certFingerprint' values will be ignored by the toolkit.
1159
+
When that parameter is used, `'x509cert'` and `'certFingerprint'` values will be ignored by the toolkit.
1159
1160
1160
-
The 'x509certMulti' is an array with 2 keys:
1161
-
- 'signing'. An array of certs that will be used to validate IdP signature
1162
-
- 'encryption' An array with one unique cert that will be used to encrypt data to be sent to the IdP
1161
+
The `'x509certMulti'` is an array with 2 keys:
1162
+
-`'signing'`. An array of certs that will be used to validate IdP signature
1163
+
-`'encryption'` An array with one unique cert that will be used to encrypt data to be sent to the IdP
1163
1164
1164
1165
1165
1166
### Replay attacks ###
1166
1167
1167
1168
In order to avoid replay attacks, you can store the ID of the SAML messages already processed, to avoid processing them twice. Since the Messages expires and will be invalidated due that fact, you don't need to store those IDs longer than the time frame that you currently accepting.
1168
1169
1169
-
Get the ID of the last processed message/assertion with the getLastMessageId/getLastAssertionId method of the Auth object.
1170
+
Get the ID of the last processed message/assertion with the `getLastMessageId/getLastAssertionId` methods of the Auth object.
0 commit comments