omniauth-barong 0.1.1 → 0.1.2
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 +17 -1
- data/lib/omniauth/barong/version.rb +1 -1
- data/lib/omniauth/strategies/barong.rb +14 -9
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c02c2b256349e2bbb171f53df69c515da44ca312870bc0916e2f78934aebd479
|
4
|
+
data.tar.gz: f24c5f98ed88d501f5c886535f662f978dbeb9dfbc50319e4219cd8a01150680
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 05c9880578ab631b5f1a12e1bb6e7f4d8b0b91aeddbe62ec7b0d9b665c4f83035ea6043179ffc9fff35d3dcd582c713e77b4e86b5dfce13a3545c43949296408
|
7
|
+
data.tar.gz: 1fd40b267d5c4e10d1798afc56f11d542c6375dcb0cfd677f1998a4cf67840f517e5686f91ff08e233683617bc65e18df75a39d2a48a67492210efe1bec604cb
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -22,7 +22,23 @@ Or install it yourself as:
|
|
22
22
|
|
23
23
|
## Usage
|
24
24
|
|
25
|
-
|
25
|
+
`OmniAuth::Strategies::Barong` is simply a Rack middleware. Read the OmniAuth docs for detailed instructions: https://github.com/intridea/omniauth.
|
26
|
+
|
27
|
+
Here's a quick example, adding the middleware to a Rails app in `config/initializers/omniauth.rb`:
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
Rails.application.config.middleware.use OmniAuth::Builder do
|
31
|
+
provider :barong, ENV.fetch('BARONG_CLIENT_ID'), ENV.fetch('BARONG_CLIENT_SECRET')
|
32
|
+
end
|
33
|
+
```
|
34
|
+
|
35
|
+
## Configuration
|
36
|
+
|
37
|
+
You can configure several options, which you pass in to the `provider` method via a hash:
|
38
|
+
|
39
|
+
* `callback_url`(default: `your-application-url/auth/barong/callback`): Override callback_url used by barong server.
|
40
|
+
* `domain`(default: `barong.io`): Barong server domain where your application is configured.
|
41
|
+
* `use_https`(default: `true`) Enable https on your barong sever redirection (disable for test purpose).
|
26
42
|
|
27
43
|
## Development
|
28
44
|
|
@@ -11,10 +11,11 @@ module OmniAuth
|
|
11
11
|
option :name, :barong
|
12
12
|
option :callback_url
|
13
13
|
option :domain, 'barong.io'
|
14
|
+
option :use_https, true
|
14
15
|
|
15
16
|
# This option is temporary dynamic due to barong development.
|
16
17
|
option :authorize_url, '/oauth/authorize'
|
17
|
-
option :raw_info_url, 'api/account'
|
18
|
+
option :raw_info_url, '/api/account'
|
18
19
|
|
19
20
|
args [
|
20
21
|
:client_id,
|
@@ -29,22 +30,21 @@ module OmniAuth
|
|
29
30
|
super
|
30
31
|
end
|
31
32
|
|
32
|
-
# TODO: if we use 'localhost' as options.domain this will rise exception.
|
33
|
-
# Need to change to be able to use localhost as domain for testing.
|
34
|
-
# Temporary 'http://localhost' could be used.
|
35
33
|
def domain_url
|
36
34
|
domain_url = URI(options.domain)
|
37
|
-
domain_url = URI("
|
35
|
+
domain_url = URI("#{scheme}://#{domain_url}") unless domain_url.class.in? ([URI::HTTP, URI::HTTPS])
|
38
36
|
domain_url.to_s
|
39
37
|
end
|
40
38
|
|
41
|
-
|
39
|
+
|
40
|
+
uid { raw_info['uid'] }
|
42
41
|
|
43
42
|
info do
|
44
43
|
{
|
45
|
-
:
|
46
|
-
:
|
47
|
-
:
|
44
|
+
email: raw_info['email'],
|
45
|
+
role: raw_info['role'],
|
46
|
+
level: raw_info['level'],
|
47
|
+
state: raw_info['state']
|
48
48
|
}
|
49
49
|
end
|
50
50
|
|
@@ -55,6 +55,11 @@ module OmniAuth
|
|
55
55
|
def callback_url
|
56
56
|
options.callback_url || (full_host + script_name + callback_path)
|
57
57
|
end
|
58
|
+
|
59
|
+
private
|
60
|
+
def scheme
|
61
|
+
options.use_https ? 'https' : 'http'
|
62
|
+
end
|
58
63
|
end
|
59
64
|
end
|
60
65
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-barong
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Louis Bellet
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-
|
12
|
+
date: 2018-02-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: omniauth-oauth2
|