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
+13-2Lines changed: 13 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -281,7 +281,7 @@ And on 'signing' and 'encryption' arrays, add the different IdP x509 public cert
281
281
The method above requires a little extra work to manually specify attributes about the IdP. (And your SP application) 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
282
282
key certificates which add to the trusted relationship. The IdP administrator can also configure custom settings for an SP based on the metadata.
283
283
284
-
Using ```idp_metadata_parser.parse_remote``` IdP metadata will be added to the settings withouth further ado.
284
+
Using ```idp_metadata_parser.parse_remote``` IdP metadata will be added to the settings without further ado.
285
285
286
286
```ruby
287
287
def saml_settings
@@ -300,9 +300,14 @@ def saml_settings
300
300
end
301
301
```
302
302
The following attributes are set:
303
+
* idp_entity_id
304
+
* name_identifier_format
303
305
* idp_sso_target_url
304
306
* idp_slo_target_url
305
-
* idp_cert_fingerprint
307
+
* idp_attribute_names
308
+
* idp_cert
309
+
* idp_cert_fingerprint
310
+
* idp_cert_multi
306
311
307
312
### Retrieve one Entity Descriptor when many exist in Metadata
308
313
@@ -319,6 +324,12 @@ IdpMetadataParser by its Entity Id value:
319
324
)
320
325
```
321
326
327
+
### Parsing Metadata into an Hash
328
+
329
+
The `OneLogin::RubySaml::IdpMetadataParser` also provides the methods `#parse_to_hash` and `#parse_remote_to_hash`.
330
+
Those return an Hash instead of a `Settings` object, which may be useful for configuring
331
+
[omniauth-saml](https://github.com/omniauth/omniauth-saml), for instance.
332
+
322
333
## Retrieving Attributes
323
334
324
335
If you are using `saml:AttributeStatement` to transfer data like the username, you can access all the attributes through `response.attributes`. It contains all the `saml:AttributeStatement`s with its 'Name' as an indifferent key and one or more `saml:AttributeValue`s as values. The value returned depends on the value of the
# Parse the Identity Provider metadata and update the settings with the
28
28
# IdP values
29
29
#
30
-
# @param (see IdpMetadataParser#get_idp_metadata)
31
-
# @param options [Hash] :settings to provide the OneLogin::RubySaml::Settings object or an hash for Settings overrides
32
-
# @return (see IdpMetadataParser#get_idp_metadata)
33
-
# @raise (see IdpMetadataParser#get_idp_metadata)
30
+
# @param url [String] Url where the XML of the Identity Provider Metadata is published.
31
+
# @param validate_cert [Boolean] If true and the URL is HTTPs, the cert of the domain is checked.
32
+
#
33
+
# @param options [Hash] options used for parsing the metadata and the returned Settings instance
34
+
# @option options [OneLogin::RubySaml::Settings, Hash] :settings the OneLogin::RubySaml::Settings object which gets the parsed metadata merged into or an hash for Settings overrides.
35
+
# @option options [Array<String>, nil] :sso_binding an ordered list of bindings to detect the single signon URL. The first binding in the list that is included in the metadata will be used.
36
+
# @option options [Array<String>, nil] :slo_binding an ordered list of bindings to detect the single logout URL. The first binding in the list that is included in the metadata will be used.
37
+
# @option options [String, nil] :entity_id when this is given, the entity descriptor for this ID is used. When ommitted, the first entity descriptor is used.
38
+
#
39
+
# @return [OneLogin::RubySaml::Settings]
40
+
#
41
+
# @raise [HttpError] Failure to fetch remote IdP metadata
# Parse the Identity Provider metadata and return the results as Hash
48
+
#
49
+
# @param url [String] Url where the XML of the Identity Provider Metadata is published.
50
+
# @param validate_cert [Boolean] If true and the URL is HTTPs, the cert of the domain is checked.
51
+
#
52
+
# @param options [Hash] options used for parsing the metadata
53
+
# @option options [Array<String>, nil] :sso_binding an ordered list of bindings to detect the single signon URL. The first binding in the list that is included in the metadata will be used.
54
+
# @option options [Array<String>, nil] :slo_binding an ordered list of bindings to detect the single logout URL. The first binding in the list that is included in the metadata will be used.
55
+
# @option options [String, nil] :entity_id when this is given, the entity descriptor for this ID is used. When ommitted, the first entity descriptor is used.
56
+
#
57
+
# @return [Hash]
58
+
#
59
+
# @raise [HttpError] Failure to fetch remote IdP metadata
# Parse the Identity Provider metadata and update the settings with the IdP values
66
+
#
40
67
# @param idp_metadata [String]
41
-
# @param options [Hash] :settings to provide the OneLogin::RubySaml::Settings object or an hash for Settings overrides
42
68
#
43
-
defparse(idp_metadata,parse_options={})
44
-
@document=REXML::Document.new(idp_metadata)
45
-
@parse_options=parse_options
46
-
@entity_descriptor=nil
69
+
# @param options [Hash] :settings to provide the OneLogin::RubySaml::Settings object or an hash for Settings overrides
70
+
# @option options [OneLogin::RubySaml::Settings, Hash] :settings the OneLogin::RubySaml::Settings object which gets the parsed metadata merged into or an hash for Settings overrides.
71
+
# @option options [Array<String>, nil] :sso_binding an ordered list of bindings to detect the single signon URL. The first binding in the list that is included in the metadata will be used.
72
+
# @option options [Array<String>, nil] :slo_binding an ordered list of bindings to detect the single logout URL. The first binding in the list that is included in the metadata will be used.
73
+
# @option options [String, nil] :entity_id when this is given, the entity descriptor for this ID is used. When ommitted, the first entity descriptor is used.
# Parse the Identity Provider metadata and return the results as Hash
91
+
#
92
+
# @param idp_metadata [String]
93
+
#
94
+
# @param options [Hash] options used for parsing the metadata and the returned Settings instance
95
+
# @option options [Array<String>, nil] :sso_binding an ordered list of bindings to detect the single signon URL. The first binding in the list that is included in the metadata will be used.
96
+
# @option options [Array<String>, nil] :slo_binding an ordered list of bindings to detect the single logout URL. The first binding in the list that is included in the metadata will be used.
97
+
# @option options [String, nil] :entity_id when this is given, the entity descriptor for this ID is used. When ommitted, the first entity descriptor is used.
0 commit comments