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
+72-2Lines changed: 72 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -157,6 +157,9 @@ Or also we can provide those data in the setting file at the 'x509cert' and the
157
157
158
158
Sometimes we could need a signature on the metadata published by the SP, in this case we could use the x.509 cert previously mentioned or use a new x.509 cert: metadata.crt and metadata.key.
159
159
160
+
Use `sp_new.crt` if you are in a key rollover process and you want to
161
+
publish that x509certificate on Service Provider metadata.
162
+
160
163
If you want to create self-signed certs, you can do it at the https://www.samltool.com/self_signed_certs.php service, or using the command:
161
164
162
165
```bash
@@ -279,6 +282,15 @@ This is the settings.json file:
279
282
// the certs folder. But we can also provide them with the following parameters
280
283
"x509cert":"",
281
284
"privateKey":""
285
+
286
+
/*
287
+
* Key rollover
288
+
* If you plan to update the SP x509cert and privateKey
289
+
* you can define here the new x509cert and it will be
290
+
* published on the SP metadata so Identity Providers can
291
+
* read them and get ready for rollover.
292
+
*/
293
+
// 'x509certNew': '',
282
294
},
283
295
284
296
// Identity Provider Data that we want connected with our SP.
@@ -320,8 +332,24 @@ This is the settings.json file:
320
332
* Notice that if you want to validate any SAML Message sent by the HTTP-Redirect binding, you
321
333
* will need to provide the whole x509cert.
322
334
*/
323
-
// 'certFingerprint' => '',
324
-
// 'certFingerprintAlgorithm' => 'sha1',
335
+
// 'certFingerprint': '',
336
+
// 'certFingerprintAlgorithm': 'sha1',
337
+
338
+
/* In some scenarios the IdP uses different certificates for
339
+
* signing/encryption, or is under key rollover phase and
340
+
* more than one certificate is published on IdP metadata.
341
+
* In order to handle that the toolkit offers that parameter.
342
+
* (when used, 'x509cert' and 'certFingerprint' values are
343
+
* ignored).
344
+
*/
345
+
// 'x509certMulti': {
346
+
// 'signing': [
347
+
// '<cert1-string>'
348
+
// ],
349
+
// 'encryption': [
350
+
// '<cert2-string>'
351
+
// ]
352
+
// }
325
353
}
326
354
}
327
355
```
@@ -475,6 +503,23 @@ json_data_file.close()
475
503
auth = OneLogin_Saml2_Auth(req, settings_data)
476
504
```
477
505
506
+
#### Metadata Based Configuration
507
+
508
+
The method above requires a little extra work to manually specify attributes about the IdP. (And your SP application)
509
+
510
+
There's an easier method -- use a metadata exchange. Metadata is just an XML file that defines the capabilities of both the IdP and the SP application. It also contains the X.509 public key certificates which add to the trusted relationship. The IdP administrator can also configure custom settings for an SP based on the metadata.
511
+
512
+
Using ````parse_remote```` IdP metadata can be obtained and added to the settings withouth further ado.
If the Metadata contains several entities, the relevant EntityDescriptor can be specified when retrieving the settings from the IdpMetadataParser by its Entity Id value:
In order to use the toolkit library you need to import the file that contains the class that you will need
@@ -815,6 +860,25 @@ else:
815
860
print', '.join(errors)
816
861
```
817
862
863
+
### SP Key rollover ###
864
+
865
+
If you plan to update the SP x509cert and privateKey you can define the new x509cert as $settings['sp']['x509certNew'] and it will be
866
+
published on the SP metadata so Identity Providers can read them and get ready for rollover.
867
+
868
+
869
+
### IdP with multiple certificates ###
870
+
871
+
In some scenarios the IdP uses different certificates for
872
+
signing/encryption, or is under key rollover phase and more than one certificate is published on IdP metadata.
873
+
874
+
In order to handle that the toolkit offers the $settings['idp']['x509certMulti'] parameter.
875
+
876
+
When that parameter is used, 'x509cert' and 'certFingerprint' values will be ignored by the toolkit.
877
+
878
+
The 'x509certMulti' is an array with 2 keys:
879
+
- 'signing'. An array of certs that will be used to validate IdP signature
880
+
- 'encryption' An array with one unique cert that will be used to encrypt data to be sent to the IdP
881
+
818
882
819
883
### Main classes and methods ###
820
884
@@ -924,14 +988,17 @@ Configuration of the OneLogin Python Toolkit
924
988
****check_sp_certs*** Checks if the x509 certs of the SP exists and are valid.
925
989
****get_sp_key*** Returns the x509 private key of the SP.
926
990
****get_sp_cert*** Returns the x509 public cert of the SP.
991
+
****get_sp_cert_new*** Returns the future x509 public cert of the SP.
927
992
****get_idp_cert*** Returns the x509 public cert of the IdP.
928
993
****get_sp_data*** Gets the SP data.
929
994
****get_idp_data*** Gets the IdP data.
930
995
****get_security_data*** Gets security data.
931
996
****get_contacts*** Gets contacts data.
932
997
****get_organization*** Gets organization data.
933
998
****format_idp_cert*** Formats the IdP cert.
999
+
****format_idp_cert_multi*** Formats all registered IdP certs.
934
1000
****format_sp_cert*** Formats the SP cert.
1001
+
****format_sp_cert_new*** Formats the SP cert new.
935
1002
****format_sp_key*** Formats the private key.
936
1003
****set_strict*** Activates or deactivates the strict mode.
937
1004
****is_strict*** Returns if the 'strict' mode is active.
@@ -992,6 +1059,9 @@ A class that contains methods to obtain and parse metadata from IdP
992
1059
993
1060
For more info, look at the source code; each method is documented and details about what does and how to use it are provided. Make sure to also check the doc folder where HTML documentation about the classes and methods is provided.
0 commit comments