Skip to content

Commit ca5dd55

Browse files
committed
Improve Readme
1 parent c211712 commit ca5dd55

File tree

2 files changed

+31
-34
lines changed

2 files changed

+31
-34
lines changed

README.md

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ After installation has completed you will find at the `vendor/` folder a new fol
119119
**Important** In this option, the x509 certs must be stored at `vendor/onelogin/php-saml/certs`
120120
and settings file stored at `vendor/onelogin/php-saml`.
121121

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.
123123

124124
Compatibility
125125
-------------
@@ -144,7 +144,7 @@ the new features that the new library Saml2 carries.
144144
Namespaces
145145
----------
146146

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
148148
namespaces, remember that calls to the class must be done by adding a backslash (`\`) to the
149149
start, for example to use the static method getSelfURLNoQuery use:
150150

@@ -159,7 +159,7 @@ In production, the `strict` parameter **MUST** be set as `"true"` and the
159159
something other than SHA1 (see https://shattered.io/ ). Otherwise your
160160
environment is not secure and will be exposed to attacks.
161161

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.
163163

164164
Getting started
165165
---------------
@@ -173,7 +173,7 @@ Let's start describing the folders:
173173

174174
#### `certs/` ####
175175

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`,
177177
`Assertion`, `Metadata`.
178178

179179
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
186186
and the `$settings['sp']['privateKey']`.
187187

188188
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
190190
cert: `metadata.crt` and `metadata.key`.
191191

192192
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.
194194

195195
#### `extlib/` ####
196196

@@ -545,7 +545,7 @@ $advancedSettings = array (
545545

546546
The compression settings allow you to instruct whether or not the IdP can accept
547547
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.
549549

550550
In the security section, you can set the way that the SP will handle the messages
551551
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
556556
settings are handled within the toolkit.
557557

558558
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.
560560

561561
```php
562562
// Initializes toolkit with settings.php & advanced_settings files.
@@ -570,7 +570,7 @@ $auth = new OneLogin_Saml2_Auth($settingsInfo);
570570
$settings = new OneLogin_Saml2_Settings($settingsInfo);
571571
```
572572

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
574574
execution or locate them in any file and load the file in order to get the
575575
array available as we see in the following example:
576576

@@ -632,9 +632,9 @@ The `AuthNRequest` will be sent signed or unsigned based on the security info
632632
of the `advanced_settings.php` (`'authnRequestsSigned'`).
633633

634634

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.
636636

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.
638638

639639
```php
640640
$newTargetUrl = 'http://example.com/consume2.php';
@@ -701,7 +701,8 @@ Before the XML metadata is exposed, a check takes place to ensure
701701
that the info to be provided is valid.
702702

703703
Instead of use the Auth object, you can directly use
704-
```
704+
705+
```php
705706
$settings = new OneLogin_Saml2_Settings($settingsInfo, true);
706707
```
707708
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
11261127

11271128
getSelfURLNoQuery and getSelfRoutedURLNoQuery are used to calculate the currentURL in order to valdate SAML elements like Destination or Recipient.
11281129

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).
11301131

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"]`.
11321133

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`.
11341135

11351136

11361137
### Working behind load balancer ###
@@ -1144,7 +1145,7 @@ Or by using the method described on the previous section.
11441145

11451146
### SP Key rollover ###
11461147

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
11481149
published on the SP metadata so Identity Providers can read them and get ready for rollover.
11491150

11501151

@@ -1153,20 +1154,20 @@ published on the SP metadata so Identity Providers can read them and get ready f
11531154
In some scenarios the IdP uses different certificates for
11541155
signing/encryption, or is under key rollover phase and more than one certificate is published on IdP metadata.
11551156

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.
11571158

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.
11591160

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
11631164

11641165

11651166
### Replay attacks ###
11661167

11671168
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.
11681169

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.
11701171

11711172

11721173
### Main classes and methods ###

demo1/Readme.txt

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ file is loaded in order to get the $settingsInfo var to be used to initialize
1919
the Setting class.
2020

2121
Notice that in this demo, the setting.php file that could be defined at the base
22-
folder of the toolkit is ignored and the libs are loaded using the
23-
_toolkit_loader.php located at the base folder of the toolkit.
22+
folder of the toolkit is ignored and the libs are loaded using the _toolkit_loader.php located at the base folder of the toolkit.
2423

2524

2625
IdP setup
@@ -37,40 +36,37 @@ How it works
3736
to the same view or login and be redirected to the attrs.php view.
3837

3938
2. When you click:
40-
39+
4140
2.1 in the first link, we access to (index.php?sso) an AuthNRequest
4241
is sent to the IdP, we authenticate at the IdP and then a Response is sent
4342
to the SP, specifically the Assertion Consumer Service view: index.php?acs,
4443
notice that a RelayState parameter is set to the url that initiated the
4544
process, the index.php view.
4645

47-
2.2 in the second link we access to (attrs.php) have the same process
48-
described at 2.1 with the diference that as RelayState is set the attrs.php
46+
2.2 in the second link we access to (attrs.php) have the same process described at 2.1 with the diference that as RelayState is set the attrs.php
4947

5048
3. The SAML Response is processed in the ACS (index.php?acs), if the Response
5149
is not valid, the process stop here and a message is showed. Otherwise we
5250
are redirected to the RelayState view. a) index.php or b) attrs.php
5351

54-
4. We are logged in the app and the user attributes are showed.
52+
4. We are logged in the app and the user attributes are showed.
5553
At this point, we can test the single log out functionality.
5654

57-
5. The single log out funcionality could be tested by 2 ways.
55+
5. The single log out functionality could be tested by 2 ways.
5856

5957
5.1 SLO Initiated by SP. Click on the "logout" link at the SP, after that a
60-
Logout Request is sent to the IdP, the session at the IdP is closed and
61-
replies to the SP a Logout Response (sent to the Single Logout Service
58+
Logout Request is sent to the IdP, the session at the IdP is closed and replies to the SP a Logout Response (sent to the Single Logout Service
6259
endpoint). The SLS endpoint (index.php?sls)of the SP process the Logout
6360
Response and if is valid, close the user session of the local app. Notice
6461
that the SLO Workflow starts and ends at the SP.
6562

6663
5.2 SLO Initiated by IdP. In this case, the action takes place on the IdP
67-
side, the logout process is initiated at the idP, sends a Logout
68-
Request to the SP (SLS endpoint, index.php?sls). The SLS endpoint of the SP
64+
side, the logout process is initiated at the idP, sends a Logout Request to the SP (SLS endpoint, index.php?sls). The SLS endpoint of the SP
6965
process the Logout Request and if is valid, close the session of the user
7066
at the local app and send a Logout Response to the IdP (to the SLS endpoint
7167
of the IdP). The IdP recieve the Logout Response, process it and close the
7268
session at of the IdP. Notice that the SLO Workflow starts and ends at the IdP.
73-
69+
7470
Notice that all the SAML Requests and Responses are handler at a unique file,
7571
the index.php file and how GET paramters are used to know the action that
7672
must be done.

0 commit comments

Comments
 (0)