omniauth-barong-oauth2 1.0.0.rc4 → 1.0.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 +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +21 -0
- data/lib/omniauth-barong-oauth2/strategy.rb +11 -9
- data/lib/omniauth-barong-oauth2/version.rb +1 -1
- data/omniauth-barong-oauth2.gemspec +1 -1
- metadata +5 -5
- data/.idea/dictionaries/yaroslav.xml +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d0e7124b82ace5611a512f57e375b9b6a069ea7ea1380a8ef5fd7faaad1e085
|
4
|
+
data.tar.gz: 993427163311e1297209e35ed1cf58db577c37fbab7ef25ffd5488202c965a49
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3be2369d1c9092afa48af25a218c8c279ba67381c7eb64295f3a2fb504d93e1c0736b19f91db993be639ce0af60c1a3bb9b8ce7c88a5014fc764f6985c235835
|
7
|
+
data.tar.gz: aa3bf6a7878c020169ff9517f1016f8080ea4acdd8dc552d9bf162770b59bebf53b9a9ea8af06cb0ccf7e86886ea51c64b5ae92f937066f12707b999b6ab679b
|
data/Gemfile.lock
CHANGED
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 :
|
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
|
16
|
-
options.client_options.
|
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 {
|
24
|
+
uid { account.fetch("uid") }
|
26
25
|
|
27
|
-
|
26
|
+
def account
|
27
|
+
@account ||= access_token.get(URI.join(root_url, options.account_path).to_s).parsed
|
28
|
+
end
|
28
29
|
|
29
|
-
|
30
|
-
|
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
|
@@ -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
|
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
|
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:
|
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
|
81
|
+
summary: OmniAuth strategy for Barong OAuth2.
|
82
82
|
test_files: []
|