class
Saml::Utils
- Saml::Utils
- Reference
- Object
Overview
SAML2 Auxiliary class
Defined in:
saml/utils.crConstant Summary
-
BINDINGS =
{:post => "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST", :redirect => "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect"} -
DSIG =
"http://www.w3.org/2000/09/xmldsig#" -
DURATION_FORMAT =
/^ (-?)P # 1: Duration sign (?: (?:(\d+)Y)? # 2: Years (?:(\d+)M)? # 3: Months (?:(\d+)D)? # 4: Days (?:T (?:(\d+)H)? # 5: Hours (?:(\d+)M)? # 6: Minutes (?:(\d+(?:[.,]\d+)?)S)? # 7: Seconds )? | (\d+)W # 8: Weeks ) $/x -
EVP_CTRL_GCM_SET_TAG =
17 -
GCM_TAG_LENGTH =
16 -
UUID_PREFIX =
"_" -
XENC =
"http://www.w3.org/2001/04/xmlenc#"
Class Method Summary
- .build_cert_object(cert : String | Nil) : OpenSSL::X509::Certificate | Nil
- .build_private_key_object(private_key : String | Nil) : OpenSSL::PKey::RSA | Nil
-
.build_query(params) : String
Build the Query String signature that will be used in the HTTP-Redirect binding
-
.build_query_from_raw_parts(params) : String
Reconstruct a canonical query string from raw URI-encoded parts, to be used in verifying a signature
-
.decrypt_data(encrypted_node : XML::Node, private_key : OpenSSL::PKey::RSA | String) : String | Nil
Obtains the decrypted string from an Encrypted node element in XML
-
.decrypt_multi(encrypted_node : XML::Node, private_keys : Array(OpenSSL::PKey::RSA)) : String | Nil
Tries each private key in turn; nil if none decrypts the element.
-
.element_text(element : XML::Node | Nil) : String | Nil
Concatenation of the element's own text and CDATA children (comments and child elements ignored).
- .escape_request_param(param : String, lowercase_url_encoding) : String
-
.format_cert(cert : String | Nil) : String | Nil
Return a properly formatted x509 certificate
-
.format_private_key(key : String | Nil) : String | Nil
Return a properly formatted private key
-
.is_cert_active(cert : OpenSSL::X509::Certificate | String) : Bool
@return [Boolean] True if the certificate is within its validity period.
-
.is_cert_expired(cert : OpenSSL::X509::Certificate | String) : Bool
@return [Boolean] True if the certificate's notAfter is in the past.
- .original_uri_match?(destination_url, settings_url) : Bool
-
.parse_duration(duration : String, timestamp : Time | Int = Time.utc) : Float64
Interprets a ISO8601 duration value relative to a given timestamp.
- .prefix : String
-
.prepare_raw_get_params(rawparams : Hash(String, String) | Nil, params : Hash(String, String), lowercase_url_encoding = false) : Hash(String, String)
Prepare raw GET parameters (build them from normal parameters if not provided).
-
.retrieve_plaintext(cipher_text : Bytes, symmetric_key : Bytes | String | OpenSSL::PKey::RSA | Nil, algorithm : String | Nil) : Bytes | Nil
Obtains the deciphered bytes: block ciphers take a symmetric key, key transport takes the SP's RSA key.
- .retrieve_symetric_key_reference(encrypt_data : XML::Node) : String | Nil
-
.retrieve_symmetric_key(encrypt_data : XML::Node, private_key : OpenSSL::PKey::RSA) : Bytes | Nil
Obtains the symmetric key from the EncryptedData element
- .set_prefix(value : String)
-
.status_error_msg(error_msg : String, raw_status_code : String | Nil = nil, status_message : String | Nil = nil) : String
Build the status error message
-
.uri_match?(destination_url : String, settings_url : String) : Bool
Matches two URIs: scheme and host case-insensitively, port, path and query exactly.
- .url_decode(input : String | Nil) : String
-
.url_encode(input : String | Nil) : String
Form encoding, as Ruby's CGI.escape does.
- .uuid : String
-
.verify_signature(params) : Bool
Validate the Signature parameter sent on the HTTP-Redirect binding.
Class Method Detail
Build the Query String signature that will be used in the HTTP-Redirect binding
Reconstruct a canonical query string from raw URI-encoded parts, to be used in verifying a signature
Obtains the decrypted string from an Encrypted node element in XML
Tries each private key in turn; nil if none decrypts the element.
Concatenation of the element's own text and CDATA children (comments and child elements ignored). Nil when no element is given.
Return a properly formatted x509 certificate
Return a properly formatted private key
@return [Boolean] True if the certificate is within its validity period.
@return [Boolean] True if the certificate's notAfter is in the past.
Interprets a ISO8601 duration value relative to a given timestamp. @return [Float64] The new unix timestamp, after the duration is applied.
Prepare raw GET parameters (build them from normal parameters if not provided).
Obtains the deciphered bytes: block ciphers take a symmetric key, key transport takes the SP's RSA key. Nil for unsupported algorithms or when decryption or the GCM tag check fails.
Obtains the symmetric key from the EncryptedData element
Build the status error message
Matches two URIs: scheme and host case-insensitively, port, path and query exactly. Falls back to plain string equality when either isn't a URL.
Validate the Signature parameter sent on the HTTP-Redirect binding. Unsupported SigAlg values are refused.