omniauth-barong 0.1.1 → 0.1.2

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: d814adf1dfdf69a96f98cd550efeaf874aef7b2e3c22c055d8e0173a84cb5d3f
4
- data.tar.gz: 2dd0874ea5ad4f00d724d5ac843cff2c81f4d4c5bc8efbdd94778548a4cdb072
3
+ metadata.gz: c02c2b256349e2bbb171f53df69c515da44ca312870bc0916e2f78934aebd479
4
+ data.tar.gz: f24c5f98ed88d501f5c886535f662f978dbeb9dfbc50319e4219cd8a01150680
5
5
  SHA512:
6
- metadata.gz: 2ba012351bba70ee7d9058bd848dda5371b5b784905dde3458726d8eeda2fcb75db77f0b13ffcad8d1e0791aec05f3148c694fc66424df5f306833e2963791f3
7
- data.tar.gz: faa5bd999ed0a90dcb87ffaa7eddb1f02461cc2bf8eb979f4d7b4eb02114d2371f43208956112271e07abc438e1ce6d66fc1e2c3f908c10d26e5d65e59ee3678
6
+ metadata.gz: 05c9880578ab631b5f1a12e1bb6e7f4d8b0b91aeddbe62ec7b0d9b665c4f83035ea6043179ffc9fff35d3dcd582c713e77b4e86b5dfce13a3545c43949296408
7
+ data.tar.gz: 1fd40b267d5c4e10d1798afc56f11d542c6375dcb0cfd677f1998a4cf67840f517e5686f91ff08e233683617bc65e18df75a39d2a48a67492210efe1bec604cb
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- omniauth-barong (0.1.1)
4
+ omniauth-barong (0.1.2)
5
5
  omniauth-oauth2 (~> 1.5)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -22,7 +22,23 @@ Or install it yourself as:
22
22
 
23
23
  ## Usage
24
24
 
25
- TODO: Write usage instructions here
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
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module OmniAuth
4
4
  module Barong
5
- VERSION = '0.1.1'
5
+ VERSION = '0.1.2'
6
6
  end
7
7
  end
@@ -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("https://#{domain_url}") if domain_url.scheme.nil?
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
- uid { raw_info["id"] }
39
+
40
+ uid { raw_info['uid'] }
42
41
 
43
42
  info do
44
43
  {
45
- :email => raw_info['email'],
46
- :role => raw_info['role'],
47
- :level => @raw_info['level']
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.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-01-27 00:00:00.000000000 Z
12
+ date: 2018-02-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: omniauth-oauth2