ruby-saml-mod 0.1.18 → 0.1.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/onelogin/saml/logout_response.rb +15 -7
- data/lib/onelogin/saml/response.rb +19 -10
- data/ruby-saml-mod.gemspec +2 -2
- metadata +4 -4
@@ -2,23 +2,31 @@ module Onelogin::Saml
|
|
2
2
|
class LogoutResponse
|
3
3
|
|
4
4
|
attr_reader :settings, :document, :xml, :response
|
5
|
-
attr_reader :status_code, :status_message
|
6
|
-
attr_reader :in_response_to, :destination
|
7
|
-
def initialize(response, settings)
|
5
|
+
attr_reader :status_code, :status_message, :issuer
|
6
|
+
attr_reader :in_response_to, :destination, :request_id
|
7
|
+
def initialize(response, settings=nil)
|
8
8
|
@response = response
|
9
|
-
@settings = settings
|
10
9
|
|
11
10
|
@xml = Base64.decode64(@response)
|
12
11
|
zlib = Zlib::Inflate.new(-Zlib::MAX_WBITS)
|
13
12
|
@xml = zlib.inflate(@xml)
|
14
|
-
@document =
|
13
|
+
@document = LibXML::XML::Document.string(@xml)
|
15
14
|
|
15
|
+
@request_id = @document.find_first("/samlp:LogoutResponse", Onelogin::NAMESPACES)['ID'] rescue nil
|
16
|
+
@issuer = @document.find_first("/samlp:LogoutResponse/saml:Issuer", Onelogin::NAMESPACES).content rescue nil
|
16
17
|
@in_response_to = @document.find_first("/samlp:LogoutResponse", Onelogin::NAMESPACES)['InResponseTo'] rescue nil
|
17
18
|
@destination = @document.find_first("/samlp:LogoutResponse", Onelogin::NAMESPACES)['Destination'] rescue nil
|
18
19
|
@status_code = @document.find_first("/samlp:LogoutResponse/samlp:Status/samlp:StatusCode", Onelogin::NAMESPACES)['Value'] rescue nil
|
19
|
-
@status_message = @document.find_first("/samlp:LogoutResponse/samlp:Status/samlp:
|
20
|
+
@status_message = @document.find_first("/samlp:LogoutResponse/samlp:Status/samlp:StatusMessage", Onelogin::NAMESPACES).content rescue nil
|
21
|
+
|
22
|
+
process(settings) if settings
|
20
23
|
end
|
21
|
-
|
24
|
+
|
25
|
+
def process(settings)
|
26
|
+
@settings = settings
|
27
|
+
return unless @response
|
28
|
+
end
|
29
|
+
|
22
30
|
def logger=(val)
|
23
31
|
@logger = val
|
24
32
|
end
|
@@ -1,15 +1,15 @@
|
|
1
1
|
module Onelogin::Saml
|
2
2
|
class Response
|
3
|
-
|
4
|
-
|
3
|
+
|
4
|
+
attr_accessor :settings
|
5
|
+
attr_reader :document, :decrypted_document, :xml, :response
|
5
6
|
attr_reader :name_id, :name_qualifier, :session_index, :saml_attributes
|
6
7
|
attr_reader :status_code, :status_message
|
7
|
-
attr_reader :in_response_to, :destination
|
8
|
+
attr_reader :in_response_to, :destination, :issuer
|
8
9
|
attr_reader :validation_error
|
9
|
-
def initialize(response, settings)
|
10
|
+
def initialize(response, settings=nil)
|
10
11
|
@response = response
|
11
|
-
|
12
|
-
|
12
|
+
|
13
13
|
begin
|
14
14
|
@xml = Base64.decode64(@response)
|
15
15
|
@document = LibXML::XML::Document.string(@xml)
|
@@ -19,11 +19,21 @@ module Onelogin::Saml
|
|
19
19
|
@response = nil
|
20
20
|
return
|
21
21
|
end
|
22
|
-
|
22
|
+
|
23
|
+
@issuer = @document.find_first("/samlp:Response/saml:Issuer", Onelogin::NAMESPACES).content rescue nil
|
24
|
+
@status_code = @document.find_first("/samlp:Response/samlp:Status/samlp:StatusCode", Onelogin::NAMESPACES)["Value"] rescue nil
|
25
|
+
|
26
|
+
process(settings) if settings
|
27
|
+
end
|
28
|
+
|
29
|
+
def process(settings)
|
30
|
+
@settings = settings
|
31
|
+
return unless @response
|
32
|
+
|
23
33
|
@decrypted_document = LibXML::XML::Document.document(@document)
|
24
34
|
@decrypted_document.extend(XMLSecurity::SignedDocument)
|
25
35
|
@decrypted_document.decrypt!(@settings)
|
26
|
-
|
36
|
+
|
27
37
|
@in_response_to = @decrypted_document.find_first("/samlp:Response", Onelogin::NAMESPACES)['InResponseTo'] rescue nil
|
28
38
|
@destination = @decrypted_document.find_first("/samlp:Response", Onelogin::NAMESPACES)['Destination'] rescue nil
|
29
39
|
@name_id = @decrypted_document.find_first("/samlp:Response/saml:Assertion/saml:Subject/saml:NameID", Onelogin::NAMESPACES).content rescue nil
|
@@ -34,10 +44,9 @@ module Onelogin::Saml
|
|
34
44
|
end
|
35
45
|
@name_qualifier = @decrypted_document.find_first("/samlp:Response/saml:Assertion/saml:Subject/saml:NameID", Onelogin::NAMESPACES)["NameQualifier"] rescue nil
|
36
46
|
@session_index = @decrypted_document.find_first("/samlp:Response/saml:Assertion/saml:AuthnStatement", Onelogin::NAMESPACES)["SessionIndex"] rescue nil
|
37
|
-
@status_code = @decrypted_document.find_first("/samlp:Response/samlp:Status/samlp:StatusCode", Onelogin::NAMESPACES)["Value"] rescue nil
|
38
47
|
@status_message = @decrypted_document.find_first("/samlp:Response/samlp:Status/samlp:StatusCode", Onelogin::NAMESPACES).content rescue nil
|
39
48
|
end
|
40
|
-
|
49
|
+
|
41
50
|
def logger=(val)
|
42
51
|
@logger = val
|
43
52
|
end
|
data/ruby-saml-mod.gemspec
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = %q{ruby-saml-mod}
|
3
|
-
s.version = "0.1.
|
3
|
+
s.version = "0.1.19"
|
4
4
|
|
5
5
|
s.authors = ["OneLogin LLC", "Bracken", "Zach", "Cody", "Jeremy"]
|
6
|
-
s.date = %q{2012-09-
|
6
|
+
s.date = %q{2012-09-26}
|
7
7
|
s.extra_rdoc_files = [
|
8
8
|
"LICENSE"
|
9
9
|
]
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-saml-mod
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 61
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 19
|
10
|
+
version: 0.1.19
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- OneLogin LLC
|
@@ -19,7 +19,7 @@ autorequire:
|
|
19
19
|
bindir: bin
|
20
20
|
cert_chain: []
|
21
21
|
|
22
|
-
date: 2012-09-
|
22
|
+
date: 2012-09-26 00:00:00 Z
|
23
23
|
dependencies:
|
24
24
|
- !ruby/object:Gem::Dependency
|
25
25
|
name: libxml-ruby
|