Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: cd25bcbb76
Fetching contributors…

Cannot retrieve contributors at this time

34 lines (26 sloc) 1.145 kb
require File.expand_path(File.join(File.dirname(__FILE__), "test_helper"))
class RequestTest < Test::Unit::TestCase
context "Authrequest" do
should "create the deflated SAMLRequest URL parameter" do
settings = Onelogin::Saml::Settings.new
settings.idp_sso_target_url = "http://stuff.com"
auth_url = Onelogin::Saml::Authrequest.new.create(settings)
assert auth_url =~ /^http:\/\/stuff\.com\?SAMLRequest=/
payload = CGI.unescape(auth_url.split("=").last)
decoded = Base64.decode64(payload)
zstream = Zlib::Inflate.new(-Zlib::MAX_WBITS)
inflated = zstream.inflate(decoded)
zstream.finish
zstream.close
assert_match /^<samlp:AuthnRequest/, inflated
end
should "accept extra parameters" do
settings = Onelogin::Saml::Settings.new
settings.idp_sso_target_url = "http://stuff.com"
auth_url = Onelogin::Saml::Authrequest.new.create(settings, { :hello => "there" })
assert auth_url =~ /&hello=there$/
auth_url = Onelogin::Saml::Authrequest.new.create(settings, { :hello => nil })
assert auth_url =~ /&hello=$/
end
end
end
Jump to Line
Something went wrong with that request. Please try again.