ruby-saml 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of ruby-saml might be problematic. Click here for more details.
- data/lib/onelogin/saml.rb +3 -0
- data/lib/onelogin/saml/authrequest.rb +33 -31
- data/ruby-saml.gemspec +4 -2
- metadata +19 -3
data/lib/onelogin/saml.rb
CHANGED
@@ -2,34 +2,36 @@ require "base64"
|
|
2
2
|
require "uuid"
|
3
3
|
|
4
4
|
module Onelogin::Saml
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
end
|
5
|
+
|
6
|
+
class Authrequest
|
7
|
+
def create(settings)
|
8
|
+
id = Onelogin::Saml::Authrequest.generateUniqueID(42)
|
9
|
+
issue_instant = Onelogin::Saml::Authrequest.getTimestamp
|
10
|
+
|
11
|
+
request =
|
12
|
+
"<samlp:AuthnRequest xmlns:samlp=\"urn:oasis:names:tc:SAML:2.0:protocol\" ID=\"#{id}\" Version=\"2.0\" IssueInstant=\"#{issue_instant}\" ProtocolBinding=\"urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST\" AssertionConsumerServiceURL=\"#{settings.assertion_consumer_service_url}\">" +
|
13
|
+
"<saml:Issuer xmlns:saml=\"urn:oasis:names:tc:SAML:2.0:assertion\">#{settings.issuer}</saml:Issuer>\n" +
|
14
|
+
"<samlp:NameIDPolicy xmlns:samlp=\"urn:oasis:names:tc:SAML:2.0:protocol\" Format=\"#{settings.name_identifier_format}\" AllowCreate=\"true\"></samlp:NameIDPolicy>\n" +
|
15
|
+
"<samlp:RequestedAuthnContext xmlns:samlp=\"urn:oasis:names:tc:SAML:2.0:protocol\" Comparison=\"exact\">" +
|
16
|
+
"<saml:AuthnContextClassRef xmlns:saml=\"urn:oasis:names:tc:SAML:2.0:assertion\">urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport</saml:AuthnContextClassRef></samlp:RequestedAuthnContext>\n" +
|
17
|
+
"</samlp:AuthnRequest>"
|
18
|
+
|
19
|
+
deflated_request = Zlib::Deflate.deflate(request, 9)[2..-5]
|
20
|
+
base64_request = Base64.encode64(deflated_request)
|
21
|
+
encoded_request = CGI.escape(base64_request)
|
22
|
+
|
23
|
+
settings.idp_sso_target_url + "?SAMLRequest=" + encoded_request
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def self.generateUniqueID(length)
|
29
|
+
UUID.new.generate
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.getTimestamp
|
33
|
+
Time.new().strftime("%Y-%m-%dT%H:%M:%SZ")
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
data/ruby-saml.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{ruby-saml}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.6"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["OneLogin LLC"]
|
@@ -49,10 +49,12 @@ Gem::Specification.new do |s|
|
|
49
49
|
|
50
50
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
51
51
|
s.add_runtime_dependency(%q<XMLCanonicalizer>, [">= 1.0.1"])
|
52
|
+
s.add_runtime_dependency(%q<uuid>, [">= 2.0.0"])
|
52
53
|
else
|
53
54
|
s.add_dependency(%q<XMLCanonicalizer>, [">= 1.0.1"])
|
55
|
+
s.add_dependency(%q<uuid>, [">= 2.0.0"])
|
54
56
|
end
|
55
57
|
else
|
56
|
-
s.add_dependency(%q<
|
58
|
+
s.add_dependency(%q<uuid>, [">= 2.0.0"])
|
57
59
|
end
|
58
60
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-saml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 6
|
10
|
+
version: 0.0.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- OneLogin LLC
|
@@ -34,6 +34,22 @@ dependencies:
|
|
34
34
|
version: 1.0.1
|
35
35
|
type: :runtime
|
36
36
|
version_requirements: *id001
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: uuid
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
hash: 15
|
46
|
+
segments:
|
47
|
+
- 2
|
48
|
+
- 0
|
49
|
+
- 0
|
50
|
+
version: 2.0.0
|
51
|
+
type: :runtime
|
52
|
+
version_requirements: *id002
|
37
53
|
description: SAML toolkit for Ruby on Rails
|
38
54
|
email: support@onelogin.com
|
39
55
|
executables: []
|