omniauth-suomifi 0.7.0 → 0.9.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bc0704db48f42ecbc14c86e3e629e611b535b427cfd23ee9d0363545d12f0ee7
4
- data.tar.gz: e895872a3b621fa5e7a3fe61b45156c8ce12b05abdc55b962dd2a3d4a5e7df8b
3
+ metadata.gz: 828b52d04db9791651039f76e3658cc35d0341761c0d89a8093fec92c6a59633
4
+ data.tar.gz: bf9f6300e7f75e92940d8e30c961eb83bb3178044e5cc87a9f1e86621b4d3ec1
5
5
  SHA512:
6
- metadata.gz: 4f4c2d1ffb1e80a120a832aae423ead500d3a725be94bbd776127c28892d02a70ab4f8748e0ff01a95fba14f8747b8742c63b33f49b35867add4970bbe812cba
7
- data.tar.gz: 30dc8039e91aa1e6def01027596e47a060ef190fedcc68537b7c1ad0496a4e8d87efa38d2b03084744cc976adfa7e5353509814549dc95ebf3af2d5b61b8a663
6
+ metadata.gz: a0d270db302440de00ade6e5aa206d178c6782c304b135fd7c1934f997b8f2930d79aad93e9c7ad4832d1c187dae866fee3f61388dc003e9be95747f92f3cc09
7
+ data.tar.gz: 50bb332a0ccb99bb91b11931f2f746a4d576c521ed97d92afde48d0b594251360384a4c70de7edd11e2e23dcdc732eee5a5b43839618a590d25705ca29ed8687
data/README.md CHANGED
@@ -198,7 +198,7 @@ Devise.setup do |config|
198
198
  # is why it is generated from the personal identity codes. That code may,
199
199
  # however, contain personal data such as date of birth or gender, which is
200
200
  # why it is hashed using this salt. For Rails, this defaults to
201
- # `Rails.application.secrets.secret_key_base` and does not need to be
201
+ # `Rails.application.secret_key_base` and does not need to be
202
202
  # specifically configured.
203
203
  uid_salt: 'abcdef123'
204
204
  end
@@ -448,7 +448,7 @@ module OmniAuth
448
448
  # birth, gender, etc.). Please provide a salt with the `uid_salt`
449
449
  # configuration option for proper hashing of the strings. For Rails, it
450
450
  # will be automatically set by
451
- # `Rails.application.secrets.secret_key_base`.
451
+ # `Rails.application.secret_key_base`.
452
452
  #
453
453
  # Finally, fallback to the SAML NameID which is only unique per session.
454
454
  # This should not happen with any valid authentication requests.
@@ -458,22 +458,21 @@ module OmniAuth
458
458
  eidas_id = find_attribute_by(
459
459
  ['http://eidas.europa.eu/attributes/naturalperson/PersonIdentifier']
460
460
  )
461
- hash_salt = begin
461
+ hash_salt =
462
462
  if options.uid_salt
463
463
  options.uid_salt
464
464
  elsif defined?(::Rails) && ::Rails.application
465
- ::Rails.application.secrets.secret_key_base
465
+ ::Rails.application.secret_key_base
466
466
  else
467
467
  ''
468
468
  end
469
- end
470
469
 
471
470
  if !electronic_id.nil?
472
- 'FINUID:' + electronic_id
471
+ "FINUID:#{electronic_id}"
473
472
  elsif !national_id.nil?
474
- 'FIHETU:' + Digest::MD5.hexdigest("FI:#{national_id}:#{hash_salt}")
473
+ "FIHETU:#{Digest::MD5.hexdigest("FI:#{national_id}:#{hash_salt}")}"
475
474
  elsif !eidas_id.nil?
476
- 'EIDASPID:' + Digest::MD5.hexdigest("EIDAS:#{eidas_id}:#{hash_salt}")
475
+ "EIDASPID:#{Digest::MD5.hexdigest("EIDAS:#{eidas_id}:#{hash_salt}")}"
477
476
  else
478
477
  @name_id
479
478
  end
@@ -483,7 +482,7 @@ module OmniAuth
483
482
  # hash for easier access.
484
483
  extra do
485
484
  {
486
- search_success: search_success,
485
+ search_success: search_success?,
487
486
  saml_attributes: saml_attributes
488
487
  }
489
488
  end
@@ -491,6 +490,7 @@ module OmniAuth
491
490
  attr_accessor :options
492
491
  attr_reader :suomifi_thread
493
492
 
493
+ # rubocop:disable Metrics/MethodLength
494
494
  def initialize(app, *args, &block)
495
495
  super
496
496
 
@@ -520,6 +520,7 @@ module OmniAuth
520
520
  )
521
521
  end
522
522
  end
523
+ # rubocop:enable Metrics/MethodLength
523
524
 
524
525
  # Override the request phase to be able to pass the locale parameter to
525
526
  # the redirect URL. Note that this needs to be the last parameter to
@@ -572,7 +573,7 @@ module OmniAuth
572
573
  # storing the Suomi.fi sessions in a database and then comparing the SAML
573
574
  # uid of the SLO request to the values stored witin the database to log
574
575
  # out the user who requested the logout. There is no other way to transfer
575
- # this information from the
576
+ # this information from the SLO page.
576
577
  #
577
578
  # The default functionality within the `omniauth-saml` strategy relies on
578
579
  # the session variables to compare the SAML uid during the SLO request but
@@ -583,16 +584,16 @@ module OmniAuth
583
584
  # application itself. If not, the code below calls the application which
584
585
  # can do the validation against the database where the sessions are
585
586
  # stored.
586
- return super if session["saml_uid"]
587
+ return super if session['saml_uid']
587
588
 
588
589
  # Otherwise, the application itself needs to handle the logout because
589
590
  # this is not happening within the same session that the user has
590
591
  # currently open at the website.
591
592
  logout_request = OneLogin::RubySaml::SloLogoutrequest.new(
592
593
  raw_request,
593
- { settings: settings, get_params: @request.params }
594
+ {settings: settings, get_params: @request.params}
594
595
  )
595
- raise OmniAuth::Strategies::SAML::ValidationError.new("SAML failed to process LogoutRequest") unless logout_request.is_valid?
596
+ raise OmniAuth::Strategies::SAML::ValidationError.new('SAML failed to process LogoutRequest') unless logout_request.is_valid?
596
597
 
597
598
  @env['omniauth.saml_request'] = logout_request
598
599
 
@@ -665,6 +666,7 @@ module OmniAuth
665
666
  end
666
667
  end
667
668
 
669
+ # rubocop:disable Metrics/MethodLength
668
670
  def suomifi_options
669
671
  idp_metadata_parser = OneLogin::RubySaml::IdpMetadataParser.new
670
672
 
@@ -705,14 +707,16 @@ module OmniAuth
705
707
 
706
708
  settings
707
709
  end
710
+ # rubocop:enable Metrics/MethodLength
708
711
 
709
712
  # This will return true if the VTJ search (population information system,
710
713
  # väestötietojärjestelmä) was successful and information about the person
711
714
  # was transmitted in the SAML response.
712
- def search_success
715
+ def search_success?
713
716
  success_string = find_attribute_by(['urn:oid:1.2.246.517.3002.111.2'])
714
717
  success_string == 'true'
715
718
  end
719
+ alias search_success search_success?
716
720
 
717
721
  def saml_attributes
718
722
  {}.tap do |attrs|
@@ -28,6 +28,7 @@ OneLogin::RubySaml::Utils.class_eval do
28
28
  # @param symmetric_key [String] The symetric key used to encrypt the text
29
29
  # @param algorithm [String] The encrypted algorithm
30
30
  # @return [String] The deciphered text
31
+ # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Metrics/MethodLength
31
32
  def self.retrieve_plaintext(cipher_text, symmetric_key, algorithm)
32
33
  case algorithm
33
34
  when 'http://www.w3.org/2001/04/xmlenc#tripledes-cbc' then cipher = OpenSSL::Cipher.new('DES-EDE3-CBC').decrypt
@@ -43,22 +44,22 @@ OneLogin::RubySaml::Utils.class_eval do
43
44
 
44
45
  if cipher
45
46
  iv_len = cipher.iv_len
46
- data = cipher_text[iv_len..-1]
47
+ data = cipher_text[iv_len..]
47
48
  cipher.padding = 0
48
49
  cipher.key = symmetric_key
49
- cipher.iv = cipher_text[0..iv_len - 1]
50
+ cipher.iv = cipher_text[0..(iv_len - 1)]
50
51
  assertion_plaintext = cipher.update(data)
51
52
  assertion_plaintext << cipher.final
52
53
  elsif auth_cipher
53
54
  iv_len = auth_cipher.iv_len
54
55
  text_len = cipher_text.length
55
56
  tag_len = 16
56
- data = cipher_text[iv_len..text_len - 1 - tag_len]
57
+ data = cipher_text[iv_len..(text_len - 1 - tag_len)]
57
58
  auth_cipher.padding = 0
58
59
  auth_cipher.key = symmetric_key
59
- auth_cipher.iv = cipher_text[0..iv_len - 1]
60
+ auth_cipher.iv = cipher_text[0..(iv_len - 1)]
60
61
  auth_cipher.auth_data = ''
61
- auth_cipher.auth_tag = cipher_text[text_len - tag_len..-1]
62
+ auth_cipher.auth_tag = cipher_text[(text_len - tag_len)..]
62
63
  assertion_plaintext = auth_cipher.update(data)
63
64
  assertion_plaintext << auth_cipher.final
64
65
  elsif rsa
@@ -69,4 +70,5 @@ OneLogin::RubySaml::Utils.class_eval do
69
70
  cipher_text
70
71
  end
71
72
  end
73
+ # rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity, Metrics/MethodLength
72
74
  end
@@ -17,14 +17,14 @@ module OmniAuth
17
17
  cert = OpenSSL::X509::Certificate.new
18
18
  cert.subject = cert.issuer = OpenSSL::X509::Name.parse(subject)
19
19
  cert.not_before = Time.now
20
- cert.not_after = Time.now + 365 * 24 * 60 * 60
20
+ cert.not_after = Time.now + (365 * 24 * 60 * 60)
21
21
  cert.public_key = public_key
22
22
  cert.serial = 0x0
23
23
  cert.version = 2
24
24
 
25
25
  inject_certificate_extensions(cert)
26
26
 
27
- cert.sign(private_key, OpenSSL::Digest::SHA1.new)
27
+ cert.sign(private_key, OpenSSL::Digest.new('SHA1'))
28
28
 
29
29
  cert
30
30
  end
@@ -33,7 +33,7 @@ module OmniAuth
33
33
  end
34
34
 
35
35
  def self.encrypted_xml(raw_xml_file, cert, sign_cert, sign_key)
36
- raw_xml = IO.read(raw_xml_file)
36
+ raw_xml = File.read(raw_xml_file)
37
37
  encrypted_xml_from_string(raw_xml, cert, sign_cert, sign_key)
38
38
  end
39
39
 
@@ -53,7 +53,7 @@ module OmniAuth
53
53
  template_path = Utility.template_filepath(
54
54
  'encrypted_data_template.xml'
55
55
  )
56
- template_io = IO.read(template_path)
56
+ template_io = File.read(template_path)
57
57
 
58
58
  Nokogiri::XML::Document.parse(template_io).root
59
59
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module OmniAuth
4
4
  module Suomifi
5
- VERSION = '0.7.0'
5
+ VERSION = '0.9.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-suomifi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Antti Hukkanen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-02-08 00:00:00.000000000 Z
11
+ date: 2026-07-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth-saml
@@ -16,118 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '2.0'
19
+ version: '2.1'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '2.0'
26
+ version: '2.1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: ruby-saml
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.13.0
33
+ version: '1.18'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.13.0
41
- - !ruby/object:Gem::Dependency
42
- name: rake
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '13.0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '13.0'
55
- - !ruby/object:Gem::Dependency
56
- name: rspec
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '3.9'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '3.9'
69
- - !ruby/object:Gem::Dependency
70
- name: rack-test
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: 1.1.0
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: 1.1.0
83
- - !ruby/object:Gem::Dependency
84
- name: webmock
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: '3.6'
90
- - - ">="
91
- - !ruby/object:Gem::Version
92
- version: 3.6.2
93
- type: :development
94
- prerelease: false
95
- version_requirements: !ruby/object:Gem::Requirement
96
- requirements:
97
- - - "~>"
98
- - !ruby/object:Gem::Version
99
- version: '3.6'
100
- - - ">="
101
- - !ruby/object:Gem::Version
102
- version: 3.6.2
103
- - !ruby/object:Gem::Dependency
104
- name: xmlenc
105
- requirement: !ruby/object:Gem::Requirement
106
- requirements:
107
- - - "~>"
108
- - !ruby/object:Gem::Version
109
- version: 0.7.1
110
- type: :development
111
- prerelease: false
112
- version_requirements: !ruby/object:Gem::Requirement
113
- requirements:
114
- - - "~>"
115
- - !ruby/object:Gem::Version
116
- version: 0.7.1
117
- - !ruby/object:Gem::Dependency
118
- name: simplecov
119
- requirement: !ruby/object:Gem::Requirement
120
- requirements:
121
- - - "~>"
122
- - !ruby/object:Gem::Version
123
- version: 0.19.0
124
- type: :development
125
- prerelease: false
126
- version_requirements: !ruby/object:Gem::Requirement
127
- requirements:
128
- - - "~>"
129
- - !ruby/object:Gem::Version
130
- version: 0.19.0
40
+ version: '1.18'
131
41
  description: Suomi.fi e-Identification service integration for OmniAuth.
132
42
  email:
133
43
  - antti.hukkanen@mainiotech.fi
@@ -150,7 +60,8 @@ files:
150
60
  homepage: https://github.com/mainio/omniauth-suomifi
151
61
  licenses:
152
62
  - MIT
153
- metadata: {}
63
+ metadata:
64
+ rubygems_mfa_required: 'true'
154
65
  post_install_message:
155
66
  rdoc_options: []
156
67
  require_paths:
@@ -159,14 +70,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
159
70
  requirements:
160
71
  - - ">="
161
72
  - !ruby/object:Gem::Version
162
- version: '2.5'
73
+ version: '3.0'
163
74
  required_rubygems_version: !ruby/object:Gem::Requirement
164
75
  requirements:
165
76
  - - ">="
166
77
  - !ruby/object:Gem::Version
167
78
  version: '0'
168
79
  requirements: []
169
- rubygems_version: 3.0.3
80
+ rubygems_version: 3.5.23
170
81
  signing_key:
171
82
  specification_version: 4
172
83
  summary: Provides a Suomi.fi strategy for OmniAuth.