Module: Saml::Kit::Serializable
- Included in:
- Bindings::HttpPost, Bindings::HttpRedirect, Bindings::UrlBuilder
- Defined in:
- lib/saml/kit/serializable.rb
Instance Method Summary collapse
-
#decode(value) ⇒ Object
Base 64 decodes the value.
-
#deflate(value, level: Zlib::BEST_COMPRESSION) ⇒ Object
Deflate the value and drop the header and checksum as per the SAML spec.
-
#encode(value) ⇒ Object
Base 64 encodes the value.
-
#escape(value) ⇒ Object
URL escape a value.
-
#inflate(value) ⇒ Object
Inflates the value using zlib decompression.
-
#unescape(value) ⇒ Object
URL unescape a value.
Instance Method Details
#decode(value) ⇒ Object
Base 64 decodes the value.
7 8 9 |
# File 'lib/saml/kit/serializable.rb', line 7 def decode(value) Base64.decode64(value) end |
#deflate(value, level: Zlib::BEST_COMPRESSION) ⇒ Object
Deflate the value and drop the header and checksum as per the SAML spec. en.wikipedia.org/wiki/SAML_2.0#HTTP_Redirect_Binding
31 32 33 |
# File 'lib/saml/kit/serializable.rb', line 31 def deflate(value, level: Zlib::BEST_COMPRESSION) Zlib::Deflate.deflate(value, level)[2..-5] end |
#encode(value) ⇒ Object
Base 64 encodes the value.
14 15 16 |
# File 'lib/saml/kit/serializable.rb', line 14 def encode(value) Base64.strict_encode64(value) end |
#escape(value) ⇒ Object
URL escape a value
45 46 47 |
# File 'lib/saml/kit/serializable.rb', line 45 def escape(value) CGI.escape(value) end |
#inflate(value) ⇒ Object
Inflates the value using zlib decompression.
21 22 23 24 |
# File 'lib/saml/kit/serializable.rb', line 21 def inflate(value) inflater = Zlib::Inflate.new(-Zlib::MAX_WBITS) inflater.inflate(value) end |
#unescape(value) ⇒ Object
URL unescape a value
38 39 40 |
# File 'lib/saml/kit/serializable.rb', line 38 def unescape(value) CGI.unescape(value) end |