omniauth-barong 0.1.0 → 0.1.1

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: e47192bcf761ac6954d5e2676d0093157015bdbf827286c177b95b7bdf4c7d7f
4
- data.tar.gz: 430ed989d229db57571bec2984c036cf91fbe0338c731983a04bb0b17e767d1d
3
+ metadata.gz: d814adf1dfdf69a96f98cd550efeaf874aef7b2e3c22c055d8e0173a84cb5d3f
4
+ data.tar.gz: 2dd0874ea5ad4f00d724d5ac843cff2c81f4d4c5bc8efbdd94778548a4cdb072
5
5
  SHA512:
6
- metadata.gz: c1da0b4d6a303568b62aacfc936ebd191db400220e574153b68ebced181ec5ba23fe36489b14a4367f753ca0927317c63289428ed7788683b2b462e405c9c817
7
- data.tar.gz: 9cf8b9729389a005c7c1fc4ea74cf2aa0aac94568c394b492cb2cb2fd451c3f694989bed6bd36a0feda6ed55c79e2508ef839cd43555e64001d68db19072c032
6
+ metadata.gz: 2ba012351bba70ee7d9058bd848dda5371b5b784905dde3458726d8eeda2fcb75db77f0b13ffcad8d1e0791aec05f3148c694fc66424df5f306833e2963791f3
7
+ data.tar.gz: faa5bd999ed0a90dcb87ffaa7eddb1f02461cc2bf8eb979f4d7b4eb02114d2371f43208956112271e07abc438e1ce6d66fc1e2c3f908c10d26e5d65e59ee3678
data/.gitignore CHANGED
@@ -9,3 +9,13 @@
9
9
 
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
+
13
+ # Ignore RubyMine files
14
+ .idea
15
+
16
+ /vendor/bundle
17
+ /vendor/assets/yarn_components
18
+ .env
19
+ .DS_Store
20
+ .agignore
21
+ **/*.tgz
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- omniauth-barong (0.1.0)
4
+ omniauth-barong (0.1.1)
5
5
  omniauth-oauth2 (~> 1.5)
6
6
 
7
7
  GEM
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'omniauth/barong'
@@ -1,7 +1,3 @@
1
- require "omniauth/barong/version"
1
+ # frozen_string_literal: true
2
2
 
3
- module Omniauth
4
- module Barong
5
- # Your code goes here...
6
- end
7
- end
3
+ require 'omniauth/strategies/barong'
@@ -1,5 +1,7 @@
1
- module Omniauth
1
+ # frozen_string_literal: true
2
+
3
+ module OmniAuth
2
4
  module Barong
3
- VERSION = "0.1.0"
5
+ VERSION = '0.1.1'
4
6
  end
5
7
  end
@@ -0,0 +1,60 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'multi_json'
4
+ require 'jwt'
5
+ require 'omniauth/strategies/oauth2'
6
+ require 'uri'
7
+
8
+ module OmniAuth
9
+ module Strategies
10
+ class Barong < OmniAuth::Strategies::OAuth2
11
+ option :name, :barong
12
+ option :callback_url
13
+ option :domain, 'barong.io'
14
+
15
+ # This option is temporary dynamic due to barong development.
16
+ option :authorize_url, '/oauth/authorize'
17
+ option :raw_info_url, 'api/account'
18
+
19
+ args [
20
+ :client_id,
21
+ :client_secret,
22
+ :domain
23
+ ]
24
+
25
+ def client
26
+ options.client_options.site = domain_url
27
+ options.client_options.authorize_url = options.authorize_url
28
+ options.client_options.redirect_uri = callback_url
29
+ super
30
+ end
31
+
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
+ def domain_url
36
+ domain_url = URI(options.domain)
37
+ domain_url = URI("https://#{domain_url}") if domain_url.scheme.nil?
38
+ domain_url.to_s
39
+ end
40
+
41
+ uid { raw_info["id"] }
42
+
43
+ info do
44
+ {
45
+ :email => raw_info['email'],
46
+ :role => raw_info['role'],
47
+ :level => @raw_info['level']
48
+ }
49
+ end
50
+
51
+ def raw_info
52
+ @raw_info ||= access_token.get(options.raw_info_url).parsed
53
+ end
54
+
55
+ def callback_url
56
+ options.callback_url || (full_host + script_name + callback_path)
57
+ end
58
+ end
59
+ end
60
+ end
@@ -5,9 +5,9 @@ require "omniauth/barong/version"
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "omniauth-barong"
8
- spec.version = Omniauth::Barong::VERSION
9
- spec.authors = ["Louis Bellet"]
10
- spec.email = ["lbellet@heliostech.fr"]
8
+ spec.version = OmniAuth::Barong::VERSION
9
+ spec.authors = ["Louis Bellet","Yaroslav Savchuk"]
10
+ spec.email = ["lbellet@heliostech.fr","ysavchuk@heliostech.fr"]
11
11
 
12
12
  spec.summary = %q{Authentification strategy for Barong server}
13
13
  spec.description = %q{Barong is an opensource OAuth and KyC server}
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-barong
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Louis Bellet
8
+ - Yaroslav Savchuk
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2018-01-26 00:00:00.000000000 Z
12
+ date: 2018-01-27 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: omniauth-oauth2
@@ -69,6 +70,7 @@ dependencies:
69
70
  description: Barong is an opensource OAuth and KyC server
70
71
  email:
71
72
  - lbellet@heliostech.fr
73
+ - ysavchuk@heliostech.fr
72
74
  executables: []
73
75
  extensions: []
74
76
  extra_rdoc_files: []
@@ -82,8 +84,10 @@ files:
82
84
  - Rakefile
83
85
  - bin/console
84
86
  - bin/setup
87
+ - lib/omniauth-barong.rb
85
88
  - lib/omniauth/barong.rb
86
89
  - lib/omniauth/barong/version.rb
90
+ - lib/omniauth/strategies/barong.rb
87
91
  - omniauth-barong.gemspec
88
92
  homepage: https://www.peatio.tech/
89
93
  licenses: []