class Saml::Response
- Saml::Response
- Saml::SamlMessage
- Reference
- Object
Overview
SAML2 Authentication Response. SAML Response
Included Modules
Defined in:
saml/response.crConstant Summary
-
ASSERTION =
"urn:oasis:names:tc:SAML:2.0:assertion"
-
AVAILABLE_OPTIONS =
[:allowed_clock_drift, :check_duplicated_attributes, :matches_request_id, :settings, :skip_audience, :skip_authnstatement, :skip_conditions, :skip_destination, :skip_recipient_check, :skip_subject_confirmation]
-
Response available options This is not a whitelist to allow people extending Saml:Response and pass custom options
-
DSIG =
"http://www.w3.org/2000/09/xmldsig#"
-
PROTOCOL =
"urn:oasis:names:tc:SAML:2.0:protocol"
-
XENC =
"http://www.w3.org/2001/04/xmlenc#"
Constructors
-
.new(response : String | Nil, options = {} of Symbol => OptionValue)
Constructs the SAML Response.
Instance Method Summary
-
#allowed_clock_drift
returns the allowed clock drift on timing validation @return [Float]
-
#assertion_encrypted?
Checks if the SAML Response contains or not an EncryptedAssertion element @return [Boolean] True if the SAML Response contains an EncryptedAssertion element
- #assertion_id
-
#attributes
Gets the Attributes from the AttributeStatement element.
-
#audiences
@return [Array] The Audience elements from the Contitions of the SAML Response.
-
#conditions
Gets the Condition Element of the SAML Response if exists.
- #decrypted_document : XMLSecurity::SignedDocument | Nil
-
#destination
@return [String|nil] Destination attribute from the SAML Response.
- #document : XMLSecurity::SignedDocument
- #errors : Array(String)
-
#in_response_to
@return [String|nil] The InResponseTo attribute from the SAML Response.
-
#is_valid?(collect_errors = false)
Validates the SAML Response with the default values (soft = true) @param collect_errors [Boolean] Stop validation when first error appears or keep validating.
-
#issuers
Gets the Issuers (from Response and Assertion).
-
#name_id
@return [String] the NameID provided by the SAML response from the IdP.
-
#name_id_format
@return [String] the NameID Format provided by the SAML response from the IdP.
-
#name_id_namequalifier
@return [String] the NameID NameQualifier provided by the SAML response from the IdP.
-
#name_id_spnamequalifier
@return [String] the NameID SPNameQualifier provided by the SAML response from the IdP.
- #nameid
- #nameid_format
-
#not_before
Gets the NotBefore Condition Element value.
-
#not_on_or_after
Gets the NotOnOrAfter Condition Element value.
- #options : Hash(Symbol, OptionValue)
- #options=(options : Hash(Symbol, OptionValue))
- #response : String
- #response_id
-
#session_expires_at
Gets the SessionNotOnOrAfter from the AuthnStatement.
-
#sessionindex
Gets the SessionIndex from the AuthnStatement.
-
#settings : Saml::Settings
Saml::Settings Toolkit settings
-
#settings=(settings : Saml::Settings)
Saml::Settings Toolkit settings
- #soft : Bool
- #soft=(soft : Bool)
-
#status_code
@return [String] StatusCode value from a SAML Response.
-
#status_message
@return [String] the StatusMessage value from a SAML Response.
-
#success?
Checks if the Status has the "Success" code @return [Boolean] True if the StatusCode is Sucess
Instance methods inherited from module Saml::ErrorHandling
append_error(error_msg : String, soft_override : Bool | Nil = nil)
append_error,
errors
errors,
errors_messages
errors_messages,
errors_messages=(errors_messages)
errors_messages=,
reset_errors!
reset_errors!
Instance methods inherited from class Saml::SamlMessage
id(document)
id,
valid_saml?(document, soft = true)
valid_saml?,
version(document)
version
Constructor Detail
Constructs the SAML Response. A Response Object that is an extension of the SamlMessage class. @param response [String] A UUEncoded SAML response from the IdP. @param options [Hash] :settings to provide the Saml::Settings object Or some options for the response validation process like skip the conditions validation with the :skip_conditions, or allow a clock_drift when checking dates with :allowed_clock_drift or :matches_request_id that will validate that the response matches the ID of the request, or skip the subject confirmation validation with the :skip_subject_confirmation option or skip the recipient validation of the subject confirmation element with :skip_recipient_check option or skip the audience validation with :skip_audience option
Instance Method Detail
Checks if the SAML Response contains or not an EncryptedAssertion element @return [Boolean] True if the SAML Response contains an EncryptedAssertion element
Gets the Attributes from the AttributeStatement element.
All attributes can be iterated over +attributes.each+ or returned as array by +attributes.all+ For backwards compatibility ruby-saml returns by default only the first value for a given attribute with attributes['name'] To get all of the attributes, use: attributes.multi('name') Or turn off the compatibility: Saml::Attributes.single_value_compatibility = false Now this will return an array: attributes['name']
@return [Attributes] Saml::Attributes enumerable collection. @raise [ValidationError] if there are 2+ Attribute with the same Name
Gets the Condition Element of the SAML Response if exists. (returns the first node that matches the supplied xpath) @return [XML::Node] Conditions Element if exists
Validates the SAML Response with the default values (soft = true) @param collect_errors [Boolean] Stop validation when first error appears or keep validating. (if soft=true) @return [Boolean] TRUE if the SAML Response is valid
Gets the Issuers (from Response and Assertion). (returns the first node that matches the supplied xpath from the Response and from the Assertion) @return [Array] Array with the Issuers (XML::Node)
@return [String] the NameID NameQualifier provided by the SAML response from the IdP.
@return [String] the NameID SPNameQualifier provided by the SAML response from the IdP.
Gets the NotBefore Condition Element value. @return [Time] The NotBefore value in Time format
Gets the NotOnOrAfter Condition Element value. @return [Time] The NotOnOrAfter value in Time format
Gets the SessionNotOnOrAfter from the AuthnStatement. Could be used to set the local session expiration (expire at latest) @return [String] The SessionNotOnOrAfter value
Gets the SessionIndex from the AuthnStatement. Could be used to be stored in the local session in order to be used in a future Logout Request that the SP could send to the IdP, to set what specific session must be deleted @return [String] SessionIndex Value
Checks if the Status has the "Success" code @return [Boolean] True if the StatusCode is Sucess