omniauth-barong-oauth2 1.0.0.rc4 → 1.0.0

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: c6ddf97518fa9ddd9bce31cd0c339a8468b2412ad50d2d3cf55bce9f370fe7f7
4
- data.tar.gz: 6d84f2193befe3f12d91559db66c6f34bd6faa790798e0e9ef07adff1520461a
3
+ metadata.gz: 1d0e7124b82ace5611a512f57e375b9b6a069ea7ea1380a8ef5fd7faaad1e085
4
+ data.tar.gz: 993427163311e1297209e35ed1cf58db577c37fbab7ef25ffd5488202c965a49
5
5
  SHA512:
6
- metadata.gz: e7e9c4b80a249ddc2e8ac8c95908daae28d8239fa94e4e479e51f30cc390d9fb9637f053691c511beb54bbb2b0c379bc82b40a5ebdc1f065d7b10d4fafd8923a
7
- data.tar.gz: 9225568f71fb31584cd6277a6d97e1e591bcdee018802bd7f4fda5813e72ab955c9faa6f1454d5f4a81b6369ed4e7490b1f7f8800842351164b014535bf37e08
6
+ metadata.gz: 3be2369d1c9092afa48af25a218c8c279ba67381c7eb64295f3a2fb504d93e1c0736b19f91db993be639ce0af60c1a3bb9b8ce7c88a5014fc764f6985c235835
7
+ data.tar.gz: aa3bf6a7878c020169ff9517f1016f8080ea4acdd8dc552d9bf162770b59bebf53b9a9ea8af06cb0ccf7e86886ea51c64b5ae92f937066f12707b999b6ab679b
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- omniauth-barong-oauth2 (1.0.0.rc3)
4
+ omniauth-barong-oauth2 (1.0.0)
5
5
  omniauth-oauth2 (~> 1.5)
6
6
 
7
7
  GEM
data/README.md ADDED
@@ -0,0 +1,21 @@
1
+ # OmniAuth strategy for Barong OAuth2
2
+
3
+ ## Usage
4
+
5
+ `config/initializers/omniauth.rb`:
6
+
7
+ ```ruby
8
+ # encoding: UTF-8
9
+ # frozen_string_literal: true
10
+
11
+ Rails.logger.warn { "Enabling Barong OAuth2." }
12
+ require "omniauth-barong-oauth2"
13
+ Rails.application.config.middleware.use OmniAuth::Builder do
14
+ provider :barong,
15
+ ENV.fetch("BARONG_ROOT_URL"),
16
+ ENV.fetch("BARONG_CLIENT_ID"),
17
+ ENV.fetch("BARONG_CLIENT_SECRET"),
18
+ authorize_path: "/oauth/authorize", # Optional.
19
+ account_path: "/oauth/account" # Optional.
20
+ end
21
+ ```
@@ -8,26 +8,28 @@ module OmniAuth::Strategies
8
8
  class Barong < OAuth2
9
9
  option :name, "barong"
10
10
  option :authorize_path, "/oauth/authorize"
11
- option :resource_path, "/oauth/account"
11
+ option :account_path, "/oauth/account"
12
12
  args %i[ root_url client_id client_secret ]
13
13
 
14
14
  def client
15
- options.client_options.site = root_url
16
- options.client_options.authorize_url = URI.join(root_url, options.authorize_path)
17
- options.client_options.redirect_uri = full_host + script_name + callback_path
15
+ options.client_options.site = root_url
16
+ options.client_options.authorize_path = options.authorize_path
18
17
  super
19
18
  end
20
19
 
21
20
  def root_url
22
- @root_url ||= URI.parse(options.root_url)
21
+ @root_url ||= URI.parse(options.root_url).to_s
23
22
  end
24
23
 
25
- uid { resource.fetch("uid") }
24
+ uid { account.fetch("uid") }
26
25
 
27
- info { OmniAuth.config.logger.debug { response.to_json }; resource }
26
+ def account
27
+ @account ||= access_token.get(URI.join(root_url, options.account_path).to_s).parsed
28
+ end
28
29
 
29
- def resource
30
- @resource ||= access_token.get(URI.join(root_url, options.resource_path)).parsed
30
+ # See https://github.com/omniauth/omniauth-oauth2/issues/81
31
+ def callback_url
32
+ full_host + script_name + callback_path
31
33
  end
32
34
  end
33
35
  end
@@ -2,5 +2,5 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module OmniAuthBarongOAuth2
5
- VERSION = "1.0.0.rc4"
5
+ VERSION = "1.0.0"
6
6
  end
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
8
8
  s.version = OmniAuthBarongOAuth2::VERSION
9
9
  s.author = "Yaroslav Konoplov"
10
10
  s.email = "eahome00@gmail.com"
11
- s.summary = "OmniAuth OAuth2 strategy for Barong."
11
+ s.summary = "OmniAuth strategy for Barong OAuth2."
12
12
  s.description = "The OmniAuth strategy for authenticating users using Barong (open-source OAuth2 and KyC server powered by Doorkeeper)."
13
13
  s.homepage = "https://github.com/yivo/omniauth-barong-oauth2"
14
14
  s.license = "Apache-2.0"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-barong-oauth2
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.rc4
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yaroslav Konoplov
@@ -46,11 +46,11 @@ extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
48
  - ".gitignore"
49
- - ".idea/dictionaries/yaroslav.xml"
50
49
  - ".ruby-version"
51
50
  - Gemfile
52
51
  - Gemfile.lock
53
52
  - LICENSE
53
+ - README.md
54
54
  - lib/omniauth-barong-oauth2.rb
55
55
  - lib/omniauth-barong-oauth2/strategy.rb
56
56
  - lib/omniauth-barong-oauth2/version.rb
@@ -70,13 +70,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
70
70
  version: '0'
71
71
  required_rubygems_version: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">"
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: 1.3.1
75
+ version: '0'
76
76
  requirements: []
77
77
  rubyforge_project:
78
78
  rubygems_version: 2.7.6
79
79
  signing_key:
80
80
  specification_version: 4
81
- summary: OmniAuth OAuth2 strategy for Barong.
81
+ summary: OmniAuth strategy for Barong OAuth2.
82
82
  test_files: []
@@ -1,11 +0,0 @@
1
- <component name="ProjectDictionaryState">
2
- <dictionary name="yaroslav">
3
- <words>
4
- <w>barong</w>
5
- <w>konoplov</w>
6
- <w>omni</w>
7
- <w>omniauth</w>
8
- <w>yaroslav</w>
9
- </words>
10
- </dictionary>
11
- </component>