omniauth-gov 0.1.6 → 0.1.8

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: 7e8838d0aa21b42f3fd34e55119cd4e09b0b0a06f8f270b763eb89c02dcbc965
4
- data.tar.gz: feefa806757d036278f21b0631f43c49212ee2faa286297686ee04ab3155c308
3
+ metadata.gz: 829aa13e5c71fc5063a31135b0300dcf748f0fdd5cc4451e6160d57b8e9e20d5
4
+ data.tar.gz: e3fae85613ff0d66feb47ed29e66e1b3203481223912fe3c53a4e00ed5e55abc
5
5
  SHA512:
6
- metadata.gz: 287b802208398e3bfbc99d560fb2402878a1029035d053ef0dd0dc75f1ed5c48c09f9ed12dabe8a2f25c89258d840e59dc15d88d6a2f22c58ffbaad0280cb009
7
- data.tar.gz: fe04c521d519f874bc91596dba667bfbd7dc12de4eab13a104067dfc24073767a6d1523e9785fab53e45e1354e3b94ee28e5e579e42c581cf84512d3920952dc
6
+ metadata.gz: 7b5ea3b42e416f91c8ff2a0a46dc2a32fc23b23793396f47d6d3818aa0824ff1dbe5b6326b82365c448b28971b80d266185c1d6c99737285dd3d65fc0b6a4682
7
+ data.tar.gz: 47de0c020b5864231ab58f0300b0805396c8074d563c52f9c2c06377a70a88d60bd5263b978fe15750ac502a44f08f80949e64891cbca9604ee29b45fb98ddba
data/README.md CHANGED
@@ -24,7 +24,12 @@ Em `config/initializers/devise.rb.rb`
24
24
  ENV['client_id'],
25
25
  ENV['client_secret'],
26
26
  scope: 'openid+email+profile+govbr_confiabilidades+',
27
- callback_path: '/callback-da-aplicacao'
27
+ callback_path: '/callback-da-aplicacao',
28
+ client_options: {
29
+ site: 'https://sso.acesso.gov.br', # Ambiente de produção.
30
+ authorize_url: 'https://sso.acesso.gov.br/authorize', # Ambiente de produção.
31
+ token_url: 'https://sso.acesso.gov.br/token' # Ambiente de produção.
32
+ }
28
33
 
29
34
  config.omniauth_path_prefix = '/prefixo-devise/prefixo-omniauth'
30
35
  end
@@ -34,7 +39,7 @@ Em `config/initializers/devise.rb.rb`
34
39
  Em `config/initializer/omniauth.rb`
35
40
 
36
41
  ```ruby
37
- OmniAuth.config.full_host = "<host-da-aplicacao-com-protocolo>"
42
+ OmniAuth.config.full_host = "https://endereco-do-app.gov.br"
38
43
  OmniAuth.config.logger = Rails.logger
39
44
  ```
40
45
 
@@ -121,6 +126,16 @@ devise :database_authenticatable,
121
126
 
122
127
  ```
123
128
 
129
+ ## View
130
+ Em `sessions/new.html.erb`
131
+ ```ruby
132
+ <%= button_to omniauth_authorize_path(resource_name, :gov), class: 'gov-br-btn sign-in br-button middle sign-in w-100 is-primary mt-3 mb-3', data: { turbo: false } do %>
133
+ <i class="icon fa fa-user fa-lg" style="color: rgb(255, 255, 255);"></i>&nbsp;
134
+ <span style="font-weight: normal;">Entrar com</span>&nbsp;
135
+ <span style="font-size: 20px; font-weight: bold;"> gov.br</span>
136
+ <% end %>
137
+ ```
138
+
124
139
  ## Licença
125
140
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
126
141
 
@@ -74,11 +74,10 @@ module Omniauth
74
74
 
75
75
  def build_access_token
76
76
  verifier = request.params["code"]
77
- redirect_uri = "#{OmniAuth.config.full_host}/#{options.callback_path}".gsub!(%r{/+}, '/')
78
77
 
79
78
  atoken = client.auth_code.get_token(
80
79
  verifier,
81
- {"grant_type": "authorization_code", "code": verifier, "redirect_uri": redirect_uri, "code_verifier": session["omniauth.pkce.verifier"]},
80
+ {"grant_type": "authorization_code", "code": verifier, "redirect_uri": OmniAuth.config.full_host+options.callback_path, "code_verifier": session["omniauth.pkce.verifier"]},
82
81
  {"Content-Type" => "application/x-www-form-urlencoded", "Authorization" => "Basic #{Base64.strict_encode64(options.client_id+":"+options.client_secret)}" })
83
82
  atoken
84
83
  end
@@ -86,7 +85,4 @@ module Omniauth
86
85
  end
87
86
  end
88
87
 
89
- end
90
- end
91
-
92
- OmniAuth.config.add_camelization 'gov', 'Gov'
88
+ OmniAuth.config.add_camelization 'gov', 'Gov'
@@ -1,5 +1,5 @@
1
1
  module OmniAuth
2
2
  module Gov
3
- VERSION = "0.1.6"
3
+ VERSION = "0.1.8"
4
4
  end
5
5
  end
data/lib/omniauth-gov.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  require "omniauth-gov/version"
2
- require 'omniauth/strategies/gov'
3
- require 'gov_br/params_encoder'
2
+ require 'gov_br/params_encoder'
3
+ require 'omniauth/strategies/gov'
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.6
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonas Ricardo
@@ -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.2.3
152
+ rubygems_version: 3.4.19
153
153
  signing_key:
154
154
  specification_version: 4
155
155
  summary: Official OmniAuth strategy for GitHub.