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.
9 10 11 |
# File 'lib/saml/kit/serializable.rb', line 9 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
33 34 35 |
# File 'lib/saml/kit/serializable.rb', line 33 def deflate(value, level: Zlib::BEST_COMPRESSION) Zlib::Deflate.deflate(value, level)[2..-5] end |
#encode(value) ⇒ Object
Base 64 encodes the value.
16 17 18 |
# File 'lib/saml/kit/serializable.rb', line 16 def encode(value) Base64.strict_encode64(value) end |
#escape(value) ⇒ Object
URL escape a value
47 48 49 |
# File 'lib/saml/kit/serializable.rb', line 47 def escape(value) CGI.escape(value) end |
#inflate(value) ⇒ Object
Inflates the value using zlib decompression.
23 24 25 26 |
# File 'lib/saml/kit/serializable.rb', line 23 def inflate(value) inflater = Zlib::Inflate.new(-Zlib::MAX_WBITS) inflater.inflate(value) end |
#unescape(value) ⇒ Object
URL unescape a value
40 41 42 |
# File 'lib/saml/kit/serializable.rb', line 40 def unescape(value) CGI.unescape(value) end |