require "cgi" require 'zlib' module Ciam module Saml module Coding def decode(encoded) Base64.decode64(encoded) end def encode(encoded) Base64.encode64(encoded).gsub(/\n/, "") end def escape(unescaped) CGI.escape(unescaped) end def unescape(escaped) CGI.unescape(escaped) end def inflate(deflated) zlib = Zlib::Inflate.new(-Zlib::MAX_WBITS) zlib.inflate(deflated) end def deflate(inflated) Zlib::Deflate.deflate(inflated, 9)[2..-5] end end end end