saml-kit 0.2.7 → 0.2.8
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c496796275792465ee1906c67364da02c7633058aa58ba06cd8f3471f24aadf7
|
4
|
+
data.tar.gz: '090aef04081e81bad6805fecbc73daeaa88fdeaf2d88dbcaeb42c8e204416e0f'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1c3064dfb1e0ae83c665d6e43da37ad639b384491b1100d5c3cdf4b52a6f18e3cf169cb81e4b93516dffc4b73b3f3318c99d6e43b4fb5684c51503917437ff4
|
7
|
+
data.tar.gz: '020684ed30855042cf53c804ec1e12355ffe1ac032365abc94de85b757c8e330418435cde36cc8e081d231a7cccbf8777012adfff44e4003d02d26b14eaecf23'
|
@@ -48,10 +48,14 @@ module Saml
|
|
48
48
|
protected
|
49
49
|
|
50
50
|
def saml_param_from(params)
|
51
|
-
|
52
|
-
params['SAMLRequest']
|
53
|
-
|
54
|
-
|
51
|
+
parameters = {
|
52
|
+
SAMLRequest: params[:SAMLRequest] || params['SAMLRequest'],
|
53
|
+
SAMLResponse: params[:SAMLResponse] || params['SAMLResponse'],
|
54
|
+
}
|
55
|
+
if parameters[:SAMLRequest].present?
|
56
|
+
parameters[:SAMLRequest]
|
57
|
+
elsif parameters[:SAMLResponse].present?
|
58
|
+
parameters[:SAMLResponse]
|
55
59
|
else
|
56
60
|
raise ArgumentError.new("SAMLRequest or SAMLResponse parameter is required.")
|
57
61
|
end
|
@@ -10,10 +10,14 @@ module Saml
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def build(saml_document, relay_state: nil)
|
13
|
-
payload = canonicalize(saml_document, relay_state)
|
14
13
|
if configuration.sign?
|
14
|
+
payload = canonicalize(saml_document, relay_state)
|
15
15
|
"#{saml_document.destination}?#{payload}&Signature=#{signature_for(payload)}"
|
16
16
|
else
|
17
|
+
payload = to_query_string(
|
18
|
+
saml_document.query_string_parameter => serialize(saml_document.to_xml),
|
19
|
+
'RelayState' => relay_state,
|
20
|
+
)
|
17
21
|
"#{saml_document.destination}?#{payload}"
|
18
22
|
end
|
19
23
|
end
|
@@ -26,11 +30,15 @@ module Saml
|
|
26
30
|
end
|
27
31
|
|
28
32
|
def canonicalize(saml_document, relay_state)
|
29
|
-
|
33
|
+
to_query_string(
|
30
34
|
saml_document.query_string_parameter => serialize(saml_document.to_xml),
|
31
35
|
'RelayState' => relay_state,
|
32
36
|
'SigAlg' => Saml::Kit::Namespaces::SHA256,
|
33
|
-
|
37
|
+
)
|
38
|
+
end
|
39
|
+
|
40
|
+
def to_query_string(query_params)
|
41
|
+
query_params.map do |(key, value)|
|
34
42
|
value.present? ? "#{key}=#{escape(value)}" : nil
|
35
43
|
end.compact.join('&')
|
36
44
|
end
|
@@ -17,7 +17,7 @@ module Saml
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def add_key_pair(certificate, private_key, password:, use: :signing)
|
20
|
-
@key_pairs.push(KeyPair.new(certificate, private_key, password, use))
|
20
|
+
@key_pairs.push(KeyPair.new(certificate, private_key, password, use.to_sym))
|
21
21
|
end
|
22
22
|
|
23
23
|
def generate_key_pair_for(use:, password: SecureRandom.uuid)
|
@@ -29,8 +29,8 @@ module Saml
|
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
|
-
def login_request_for(binding:, relay_state: nil)
|
33
|
-
builder = Saml::Kit::AuthenticationRequest.builder do |x|
|
32
|
+
def login_request_for(binding:, relay_state: nil, configuration: Saml::Kit.configuration)
|
33
|
+
builder = Saml::Kit::AuthenticationRequest.builder(configuration: configuration) do |x|
|
34
34
|
x.embed_signature = want_authn_requests_signed
|
35
35
|
yield x if block_given?
|
36
36
|
end
|
data/lib/saml/kit/key_pair.rb
CHANGED
data/lib/saml/kit/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: saml-kit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- mo khan
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-12-
|
11
|
+
date: 2017-12-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|