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 CHANGED
@@ -1 +1,4 @@
1
1
  require 'onelogin/saml'
2
+ module Onelogin::Saml
3
+
4
+ end
@@ -2,34 +2,36 @@ require "base64"
2
2
  require "uuid"
3
3
 
4
4
  module Onelogin::Saml
5
- class Authrequest
6
- def create(settings)
7
- id = Onelogin::Saml::Authrequest.generateUniqueID(42)
8
- issue_instant = Onelogin::Saml::Authrequest.getTimestamp
9
-
10
- request =
11
- "<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}\">" +
12
- "<saml:Issuer xmlns:saml=\"urn:oasis:names:tc:SAML:2.0:assertion\">#{settings.issuer}</saml:Issuer>\n" +
13
- "<samlp:NameIDPolicy xmlns:samlp=\"urn:oasis:names:tc:SAML:2.0:protocol\" Format=\"#{settings.name_identifier_format}\" AllowCreate=\"true\"></samlp:NameIDPolicy>\n" +
14
- "<samlp:RequestedAuthnContext xmlns:samlp=\"urn:oasis:names:tc:SAML:2.0:protocol\" Comparison=\"exact\">" +
15
- "<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" +
16
- "</samlp:AuthnRequest>"
17
-
18
- deflated_request = Zlib::Deflate.deflate(request, 9)[2..-5]
19
- base64_request = Base64.encode64(deflated_request)
20
- encoded_request = CGI.escape(base64_request)
21
-
22
- settings.idp_sso_target_url + "?SAMLRequest=" + encoded_request
23
- end
24
-
25
- private
26
-
27
- def self.generateUniqueID(length)
28
- UUID.new.generate
29
- end
30
-
31
- def self.getTimestamp
32
- Time.new().strftime("%Y-%m-%dT%H:%M:%SZ")
33
- end
34
- end
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.5"
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<XMLCanonicalizer>, [">= 1.0.1"])
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: 21
4
+ hash: 19
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 5
10
- version: 0.0.5
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: []