spid 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -1
- data/Gemfile +2 -2
- data/README.md +2 -2
- data/lib/spid/identity_provider_configuration.rb +4 -0
- data/lib/spid/logout_request.rb +21 -0
- data/lib/spid/slo_request.rb +24 -0
- data/lib/spid/slo_settings.rb +58 -0
- data/lib/spid/sso_response.rb +4 -0
- data/lib/spid/version.rb +1 -1
- data/lib/spid.rb +3 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 56bb160d25e7ec4b209d932f65efc2dbc2f0ce29cb888e9af2f20fbf6ec2b9be
|
4
|
+
data.tar.gz: e754ff7caf5732c27fc79941e48ae978891439e7ddaa8184ad68eea1580e0d5a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0818e90142286b6c1b9e8ebdda459707c360a3678a3ed19b9f8c6e84a3252d3a89001aed6bfdb9b4c2176a65ab823a81e2e15be97a12acdd7764f8e086fff863'
|
7
|
+
data.tar.gz: d31f37207e05f2021b12440a64dfa3193704d11ab1f138ae07369bdfc07cf051df215c6c6452569d1c1a509a99f3bafda6162cf0d5f8483e5e47ed819d9b8573
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
|
3
3
|
## [Unreleased]
|
4
4
|
|
5
|
+
## [0.6.0] - 2018-07-18
|
6
|
+
### Added
|
7
|
+
- Slo Settings and SloRequest class
|
8
|
+
|
5
9
|
## [0.5.0] - 2018-07-13
|
6
10
|
### Added
|
7
11
|
- Sso Settings with all saml settings required attributes
|
@@ -48,7 +52,8 @@
|
|
48
52
|
- Coveralls Integration
|
49
53
|
- Rubygems version badge in README
|
50
54
|
|
51
|
-
[Unreleased]: https://github.com/italia/spid-ruby/compare/v0.
|
55
|
+
[Unreleased]: https://github.com/italia/spid-ruby/compare/v0.6.0...HEAD
|
56
|
+
[0.6.0]: https://github.com/italia/spid-ruby/compare/v0.5.0...v0.6.0
|
52
57
|
[0.5.0]: https://github.com/italia/spid-ruby/compare/v0.4.0...v0.5.0
|
53
58
|
[0.4.0]: https://github.com/italia/spid-ruby/compare/v0.3.1...v0.4.0
|
54
59
|
[0.3.1]: https://github.com/italia/spid-ruby/compare/v0.3.0...v0.3.1
|
data/Gemfile
CHANGED
@@ -8,5 +8,5 @@ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
|
8
8
|
gemspec
|
9
9
|
|
10
10
|
gem "ruby-saml",
|
11
|
-
github: "
|
12
|
-
ref: "
|
11
|
+
github: "davidlibrera/ruby-saml",
|
12
|
+
ref: "4204afc2439f712db8909bccfd8d6e15f9320c34"
|
data/README.md
CHANGED
@@ -17,6 +17,10 @@ module Spid
|
|
17
17
|
@sso_target_url ||= idp_metadata_hash[:idp_sso_target_url]
|
18
18
|
end
|
19
19
|
|
20
|
+
def slo_target_url
|
21
|
+
@slo_target_url ||= idp_metadata_hash[:idp_slo_target_url]
|
22
|
+
end
|
23
|
+
|
20
24
|
def cert_fingerprint
|
21
25
|
@cert_fingerprint ||= idp_metadata_hash[:idp_cert_fingerprint]
|
22
26
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "onelogin/ruby-saml/logoutrequest"
|
4
|
+
|
5
|
+
module Spid
|
6
|
+
class LogoutRequest < ::OneLogin::RubySaml::Logoutrequest # :nodoc:
|
7
|
+
def create_xml_document(settings)
|
8
|
+
original_document = super(settings)
|
9
|
+
issuer_element = original_document.elements["//saml:Issuer"]
|
10
|
+
issuer_element.attributes["Format"] = format_entity
|
11
|
+
issuer_element.attributes["NameQualifier"] = settings.issuer
|
12
|
+
original_document
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def format_entity
|
18
|
+
"urn:oasis:names:tc:SAML:2.0:nameid-format:entity"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "spid/logout_request"
|
4
|
+
require "onelogin/ruby-saml/settings"
|
5
|
+
|
6
|
+
module Spid
|
7
|
+
class SloRequest # :nodoc:
|
8
|
+
attr_reader :slo_settings
|
9
|
+
|
10
|
+
def initialize(slo_settings:)
|
11
|
+
@slo_settings = slo_settings
|
12
|
+
end
|
13
|
+
|
14
|
+
def to_saml
|
15
|
+
logout_request.create(slo_settings)
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def logout_request
|
21
|
+
LogoutRequest.new
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "onelogin/ruby-saml/settings"
|
4
|
+
|
5
|
+
module Spid
|
6
|
+
class SloSettings < ::OneLogin::RubySaml::Settings # :nodoc:
|
7
|
+
attr_reader :service_provider_configuration,
|
8
|
+
:identity_provider_configuration,
|
9
|
+
:session_index
|
10
|
+
|
11
|
+
def initialize(
|
12
|
+
service_provider_configuration:,
|
13
|
+
identity_provider_configuration:,
|
14
|
+
session_index:
|
15
|
+
)
|
16
|
+
@service_provider_configuration = service_provider_configuration
|
17
|
+
@identity_provider_configuration = identity_provider_configuration
|
18
|
+
@session_index = session_index
|
19
|
+
|
20
|
+
super(slo_attributes)
|
21
|
+
end
|
22
|
+
|
23
|
+
# rubocop:disable Metrics/MethodLength
|
24
|
+
# rubocop:disable Metrics/AbcSize
|
25
|
+
def slo_attributes
|
26
|
+
return @slo_attributes if @slo_attributes.present?
|
27
|
+
@slo_attributes = {
|
28
|
+
idp_slo_target_url: identity_provider_configuration.slo_target_url,
|
29
|
+
issuer: service_provider_configuration.host,
|
30
|
+
idp_name_qualifier: identity_provider_configuration.entity_id,
|
31
|
+
name_identifier_value: generated_name_identifier_value,
|
32
|
+
name_identifier_format: name_identifier_format_value,
|
33
|
+
private_key: service_provider_configuration.private_key,
|
34
|
+
certificate: service_provider_configuration.certificate,
|
35
|
+
sessionindex: session_index,
|
36
|
+
security: {
|
37
|
+
logout_requests_signed: true,
|
38
|
+
embed_sign: true,
|
39
|
+
digest_method: service_provider_configuration.digest_method,
|
40
|
+
signature_method: service_provider_configuration.signature_method
|
41
|
+
}
|
42
|
+
}
|
43
|
+
@slo_attributes
|
44
|
+
end
|
45
|
+
# rubocop:enable Metrics/AbcSize
|
46
|
+
# rubocop:enable Metrics/MethodLength
|
47
|
+
|
48
|
+
private
|
49
|
+
|
50
|
+
def generated_name_identifier_value
|
51
|
+
::OneLogin::RubySaml::Utils.uuid
|
52
|
+
end
|
53
|
+
|
54
|
+
def name_identifier_format_value
|
55
|
+
"urn:oasis:names:tc:SAML:2.0:nameid-format:transient"
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
data/lib/spid/sso_response.rb
CHANGED
data/lib/spid/version.rb
CHANGED
data/lib/spid.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "spid/authn_request"
|
4
|
+
require "spid/logout_request"
|
4
5
|
require "spid/sso_request"
|
5
6
|
require "spid/sso_response"
|
7
|
+
require "spid/slo_request"
|
6
8
|
require "spid/identity_providers"
|
7
9
|
require "spid/metadata"
|
8
10
|
require "spid/idp_metadata"
|
@@ -10,6 +12,7 @@ require "spid/version"
|
|
10
12
|
require "spid/identity_provider_configuration"
|
11
13
|
require "spid/service_provider_configuration"
|
12
14
|
require "spid/sso_settings"
|
15
|
+
require "spid/slo_settings"
|
13
16
|
|
14
17
|
module Spid # :nodoc:
|
15
18
|
class UnknownAuthnComparisonMethodError < StandardError; end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Librera
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-07-
|
11
|
+
date: 2018-07-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby-saml
|
@@ -281,8 +281,11 @@ files:
|
|
281
281
|
- lib/spid/identity_provider_configuration.rb
|
282
282
|
- lib/spid/identity_providers.rb
|
283
283
|
- lib/spid/idp_metadata.rb
|
284
|
+
- lib/spid/logout_request.rb
|
284
285
|
- lib/spid/metadata.rb
|
285
286
|
- lib/spid/service_provider_configuration.rb
|
287
|
+
- lib/spid/slo_request.rb
|
288
|
+
- lib/spid/slo_settings.rb
|
286
289
|
- lib/spid/sso_request.rb
|
287
290
|
- lib/spid/sso_response.rb
|
288
291
|
- lib/spid/sso_settings.rb
|