omniauth-gov 0.1.5 → 0.1.6

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: 9a78473bf035ebd11bccaff000615db2459c9b117a43f206be6c3222ffc5f768
4
- data.tar.gz: 280a14547cb019b1adae1dc052992d3fc6db111826449a54fcd34daf6b56ad48
3
+ metadata.gz: 7e8838d0aa21b42f3fd34e55119cd4e09b0b0a06f8f270b763eb89c02dcbc965
4
+ data.tar.gz: feefa806757d036278f21b0631f43c49212ee2faa286297686ee04ab3155c308
5
5
  SHA512:
6
- metadata.gz: 4920fcdd29bb499c30c921f982be4517268c72d70287a66e8c4ac3a6c0080fc61c2d3865bd3ef5bc029355095cf6b59bdfb7442d3c6410c74358cb24c6b6f815
7
- data.tar.gz: 5fd852141ac9740ca2bed96c707f1f98cc287f8ea652cea10a8be1f811071a49705a2460f5766ad20836321b9389b987e6a19ef4d0fa575c123d1440ab53308a
6
+ metadata.gz: 287b802208398e3bfbc99d560fb2402878a1029035d053ef0dd0dc75f1ed5c48c09f9ed12dabe8a2f25c89258d840e59dc15d88d6a2f22c58ffbaad0280cb009
7
+ data.tar.gz: fe04c521d519f874bc91596dba667bfbd7dc12de4eab13a104067dfc24073767a6d1523e9785fab53e45e1354e3b94ee28e5e579e42c581cf84512d3920952dc
@@ -3,11 +3,6 @@ require 'omniauth-oauth2'
3
3
  module Omniauth
4
4
  module Strategies
5
5
  class Gov < OmniAuth::Strategies::OAuth2
6
- option :client_options, {
7
- site: 'https://sso.acesso.gov.br',
8
- authorize_url: 'https://sso.acesso.gov.br/authorize',
9
- token_url: 'https://sso.acesso.gov.br/token'
10
- }
11
6
  option :pkce, true
12
7
 
13
8
  credentials do
@@ -40,7 +35,16 @@ module Omniauth
40
35
  'raw_info': raw_info
41
36
  }
42
37
  end
38
+
39
+ def client
40
+ options.client_options.merge!({connection_opts: {request: {params_encoder: GovBr::ParamsEncoder}}})
41
+ ::OAuth2::Client.new(options.client_id, options.client_secret, deep_symbolize(options.client_options))
42
+ end
43
43
 
44
+ def request_phase
45
+ redirect client.auth_code.authorize_url({:redirect_uri => callback_url}.merge(authorize_params))
46
+ end
47
+
44
48
  def raw_info
45
49
  @raw_info ||= JWT.decode(credentials["id_token"], nil, false)[0]
46
50
  end
@@ -52,11 +56,6 @@ module Omniauth
52
56
  end
53
57
  end
54
58
 
55
- def client
56
- options.client_options.merge!({connection_opts: {request: {params_encoder: GovBr::ParamsEncoder}}})
57
- ::OAuth2::Client.new(options.client_id, options.client_secret, deep_symbolize(options.client_options))
58
- end
59
-
60
59
  def authorize_params # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
61
60
  options.authorize_params[:state] = SecureRandom.hex(24)
62
61
  options.authorize_params[:client_id] = options[:client_id]
@@ -87,4 +86,7 @@ module Omniauth
87
86
  end
88
87
  end
89
88
 
89
+ end
90
+ end
91
+
90
92
  OmniAuth.config.add_camelization 'gov', 'Gov'
@@ -1,5 +1,5 @@
1
1
  module OmniAuth
2
2
  module Gov
3
- VERSION = "0.1.5"
3
+ VERSION = "0.1.6"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-gov
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonas Ricardo
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2024-07-30 00:00:00.000000000 Z
12
+ date: 2024-08-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: omniauth
@@ -149,7 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
149
149
  - !ruby/object:Gem::Version
150
150
  version: '0'
151
151
  requirements: []
152
- rubygems_version: 3.4.19
152
+ rubygems_version: 3.2.3
153
153
  signing_key:
154
154
  specification_version: 4
155
155
  summary: Official OmniAuth strategy for GitHub.