Module: Saml::Provider

Extended by:
ActiveSupport::Concern
Included in:
BasicProvider, NullProvider
Defined in:
lib/saml/provider.rb

Instance Method Summary collapse

Instance Method Details

#artifact_resolution_service_url(index = nil) ⇒ Object



9
10
11
# File 'lib/saml/provider.rb', line 9

def artifact_resolution_service_url(index = nil)
  find_indexed_service_url(descriptor.artifact_resolution_services, index)
end

#assertion_consumer_service(index = nil) ⇒ Object



17
18
19
# File 'lib/saml/provider.rb', line 17

def assertion_consumer_service(index = nil)
  find_indexed_service(descriptor.assertion_consumer_services, index)
end

#assertion_consumer_service_indicesObject



21
22
23
24
25
26
27
# File 'lib/saml/provider.rb', line 21

def assertion_consumer_service_indices
  if descriptor.assertion_consumer_services.present?
    descriptor.assertion_consumer_services.map(&:index)
  else
    []
  end
end

#assertion_consumer_service_url(index = nil) ⇒ Object



5
6
7
# File 'lib/saml/provider.rb', line 5

def assertion_consumer_service_url(index = nil)
  find_indexed_service_url(descriptor.assertion_consumer_services, index)
end

#attribute_consuming_service(index = nil) ⇒ Object



13
14
15
# File 'lib/saml/provider.rb', line 13

def attribute_consuming_service(index = nil)
  find_indexed_service(descriptor.attribute_consuming_services, index)
end

#authn_requests_signed?Boolean

Returns:

  • (Boolean)


66
67
68
# File 'lib/saml/provider.rb', line 66

def authn_requests_signed?
  descriptor.authn_requests_signed
end

#certificate(key_name = nil, use = "signing") ⇒ Object



37
38
39
40
# File 'lib/saml/provider.rb', line 37

def certificate(key_name = nil, use = "signing")
  key_descriptor = descriptor.find_key_descriptor(key_name, use)
  key_descriptor.certificate if key_descriptor
end

#entity_descriptorObject



29
30
31
# File 'lib/saml/provider.rb', line 29

def entity_descriptor
  @entity_descriptor
end

#entity_idObject



33
34
35
# File 'lib/saml/provider.rb', line 33

def entity_id
  entity_descriptor.entity_id
end

#private_keyObject



42
43
44
# File 'lib/saml/provider.rb', line 42

def private_key
  @private_key
end

#sign(signature_algorithm, data) ⇒ Object



46
47
48
# File 'lib/saml/provider.rb', line 46

def sign(signature_algorithm, data)
  private_key.sign(digest_method(signature_algorithm).new, data)
end

#single_logout_service_url(binding) ⇒ Object



54
55
56
# File 'lib/saml/provider.rb', line 54

def single_logout_service_url(binding)
  find_binding_service(descriptor.single_logout_services, binding)
end

#single_sign_on_service_url(binding) ⇒ Object



50
51
52
# File 'lib/saml/provider.rb', line 50

def single_sign_on_service_url(binding)
  find_binding_service(descriptor.single_sign_on_services, binding)
end

#typeObject



58
59
60
# File 'lib/saml/provider.rb', line 58

def type
  descriptor.is_a?(Saml::Elements::SPSSODescriptor) ? "service_provider" : "identity_provider"
end

#verify(signature_algorithm, signature, data, key_name = nil) ⇒ Object



62
63
64
# File 'lib/saml/provider.rb', line 62

def verify(signature_algorithm, signature, data, key_name = nil)
  certificate(key_name).public_key.verify(digest_method(signature_algorithm).new, signature, data) rescue nil
end