Class: Saml::Kit::IdentityProviderMetadata
- Inherits:
-
Metadata
- Object
- Metadata
- Saml::Kit::IdentityProviderMetadata
show all
- Defined in:
- lib/saml/kit/identity_provider_metadata.rb
Constant Summary
collapse
- Builder =
ActiveSupport::Deprecation::DeprecatedConstantProxy.new('Saml::Kit::IdentityProviderMetadata::Builder', 'Saml::Kit::Builders::IdentityProviderMetadata')
Constants inherited
from Metadata
Metadata::METADATA_XSD
Instance Attribute Summary
Attributes inherited from Metadata
#hash_algorithm, #name, #xml
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Metadata
#certificates, #encryption_certificates, #entity_id, from, #logout_request_for, #matches?, #name_id_formats, #service_for, #services, #signing_certificates, #single_logout_service_for, #single_logout_services, #to_h, #to_s, #to_xml, #verify
#error_message, #matches_xsd?
Constructor Details
Returns a new instance of IdentityProviderMetadata.
4
5
6
|
# File 'lib/saml/kit/identity_provider_metadata.rb', line 4
def initialize(xml)
super("IDPSSODescriptor", xml)
end
|
Instance Method Details
#attributes ⇒ Object
23
24
25
26
27
28
29
30
|
# File 'lib/saml/kit/identity_provider_metadata.rb', line 23
def attributes
document.find_all("/md:EntityDescriptor/md:#{name}/saml:Attribute").map do |item|
{
format: item.attribute("NameFormat").try(:value),
name: item.attribute("Name").value,
}
end
end
|
#login_request_for(binding:, relay_state: nil) ⇒ Object
32
33
34
35
36
37
38
39
|
# File 'lib/saml/kit/identity_provider_metadata.rb', line 32
def login_request_for(binding:, relay_state: nil)
builder = Saml::Kit::AuthenticationRequest.builder do |x|
x.sign = want_authn_requests_signed
yield x if block_given?
end
request_binding = single_sign_on_service_for(binding: binding)
request_binding.serialize(builder, relay_state: relay_state)
end
|
#single_sign_on_service_for(binding:) ⇒ Object
19
20
21
|
# File 'lib/saml/kit/identity_provider_metadata.rb', line 19
def single_sign_on_service_for(binding:)
service_for(binding: binding, type: 'SingleSignOnService')
end
|
#single_sign_on_services ⇒ Object
15
16
17
|
# File 'lib/saml/kit/identity_provider_metadata.rb', line 15
def single_sign_on_services
services('SingleSignOnService')
end
|
#want_authn_requests_signed ⇒ Object
8
9
10
11
12
13
|
# File 'lib/saml/kit/identity_provider_metadata.rb', line 8
def want_authn_requests_signed
xpath = "/md:EntityDescriptor/md:#{name}"
attribute = document.find_by(xpath).attribute("WantAuthnRequestsSigned")
return true if attribute.nil?
attribute.text.downcase == "true"
end
|