omniauth-referral-barong 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +22 -0
- data/.rspec +3 -0
- data/.travis.yml +5 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +56 -0
- data/README.md +51 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/omniauth-referral-barong.rb +3 -0
- data/lib/omniauth/barong.rb +3 -0
- data/lib/omniauth/barong/version.rb +7 -0
- data/lib/omniauth/strategies/barong.rb +74 -0
- data/omniauth-referral-barong.gemspec +27 -0
- metadata +113 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 1afd3faedc938e109c577996aadcee1fefa6cd04463327e67a46b5951913dacd
|
4
|
+
data.tar.gz: fea9f5c34dd6f0f8e5f3f2ae8984307c2d28cf2a75dae508e1535eb95c8def9b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 17169c28b346cc9215762684907593aa5e2d3a55673d6acbde88709ded03afd2f1ca4b1410ba561d7f59499f01745064cd9adac12f3ddeb059aa5792f154e4b5
|
7
|
+
data.tar.gz: d834c06c6a05996ce7554210ab461490512fde7e3fc44be61eeed962dcfbb7f7f9cf5e1c65f6f9bab476bb2e36ee5008e0321369743194dda2f8a31f4b467fc9
|
data/.gitignore
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
/.bundle/
|
2
|
+
/.yardoc
|
3
|
+
/_yardoc/
|
4
|
+
/coverage/
|
5
|
+
/doc/
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/tmp/
|
9
|
+
|
10
|
+
# rspec failure tracking
|
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
|
22
|
+
*.gem
|
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
omniauth-barong (0.1.2)
|
5
|
+
omniauth-oauth2 (~> 1.5)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
diff-lcs (1.3)
|
11
|
+
faraday (0.12.2)
|
12
|
+
multipart-post (>= 1.2, < 3)
|
13
|
+
hashie (3.5.7)
|
14
|
+
jwt (1.5.6)
|
15
|
+
multi_json (1.13.1)
|
16
|
+
multi_xml (0.6.0)
|
17
|
+
multipart-post (2.0.0)
|
18
|
+
oauth2 (1.4.0)
|
19
|
+
faraday (>= 0.8, < 0.13)
|
20
|
+
jwt (~> 1.0)
|
21
|
+
multi_json (~> 1.3)
|
22
|
+
multi_xml (~> 0.5)
|
23
|
+
rack (>= 1.2, < 3)
|
24
|
+
omniauth (1.8.1)
|
25
|
+
hashie (>= 3.4.6, < 3.6.0)
|
26
|
+
rack (>= 1.6.2, < 3)
|
27
|
+
omniauth-oauth2 (1.5.0)
|
28
|
+
oauth2 (~> 1.1)
|
29
|
+
omniauth (~> 1.2)
|
30
|
+
rack (2.0.3)
|
31
|
+
rake (10.5.0)
|
32
|
+
rspec (3.7.0)
|
33
|
+
rspec-core (~> 3.7.0)
|
34
|
+
rspec-expectations (~> 3.7.0)
|
35
|
+
rspec-mocks (~> 3.7.0)
|
36
|
+
rspec-core (3.7.1)
|
37
|
+
rspec-support (~> 3.7.0)
|
38
|
+
rspec-expectations (3.7.0)
|
39
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
40
|
+
rspec-support (~> 3.7.0)
|
41
|
+
rspec-mocks (3.7.0)
|
42
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
43
|
+
rspec-support (~> 3.7.0)
|
44
|
+
rspec-support (3.7.0)
|
45
|
+
|
46
|
+
PLATFORMS
|
47
|
+
ruby
|
48
|
+
|
49
|
+
DEPENDENCIES
|
50
|
+
bundler (~> 1.16)
|
51
|
+
omniauth-barong!
|
52
|
+
rake (~> 10.0)
|
53
|
+
rspec (~> 3.0)
|
54
|
+
|
55
|
+
BUNDLED WITH
|
56
|
+
1.16.1
|
data/README.md
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
# Omniauth::Barong
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/omniauth/barong`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'omniauth-referral-barong'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install omniauth-referral-barong
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
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).
|
42
|
+
|
43
|
+
## Development
|
44
|
+
|
45
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
46
|
+
|
47
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
48
|
+
|
49
|
+
## Contributing
|
50
|
+
|
51
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/omniauth-barong.
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "omniauth/barong"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,74 @@
|
|
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
|
+
option :use_https, true
|
15
|
+
|
16
|
+
option :api_version, 'v1'
|
17
|
+
|
18
|
+
option :authorize_url, '/oauth/authorize'
|
19
|
+
option :raw_info_url
|
20
|
+
|
21
|
+
args [
|
22
|
+
:client_id,
|
23
|
+
:client_secret,
|
24
|
+
:domain
|
25
|
+
]
|
26
|
+
|
27
|
+
def client
|
28
|
+
options.client_options.site = domain_url
|
29
|
+
options.client_options.authorize_url = options.authorize_url
|
30
|
+
options.client_options.redirect_uri = callback_url
|
31
|
+
super
|
32
|
+
end
|
33
|
+
|
34
|
+
def domain_url
|
35
|
+
domain_url = URI(options.domain)
|
36
|
+
domain_url = URI("#{scheme}://#{domain_url}") unless domain_url.class.in? ([URI::HTTP, URI::HTTPS])
|
37
|
+
domain_url.to_s
|
38
|
+
end
|
39
|
+
|
40
|
+
|
41
|
+
uid { raw_info['uid'] }
|
42
|
+
|
43
|
+
info do
|
44
|
+
{
|
45
|
+
email: raw_info['email'],
|
46
|
+
role: raw_info['role'],
|
47
|
+
level: raw_info['level'],
|
48
|
+
state: raw_info['state'],
|
49
|
+
referral_code: raw_info['referral_code'],
|
50
|
+
code: raw_info['uid'],
|
51
|
+
first_name: raw_info['first_name'],
|
52
|
+
last_name: raw_info['last_name']
|
53
|
+
}
|
54
|
+
end
|
55
|
+
|
56
|
+
def raw_info
|
57
|
+
@raw_info ||= access_token.get(raw_info_url).parsed
|
58
|
+
end
|
59
|
+
|
60
|
+
def raw_info_url
|
61
|
+
options.raw_info_url || "/api/#{options.api_version}/accounts/me"
|
62
|
+
end
|
63
|
+
|
64
|
+
def callback_url
|
65
|
+
options.callback_url || (full_host + script_name + callback_path)
|
66
|
+
end
|
67
|
+
|
68
|
+
private
|
69
|
+
def scheme
|
70
|
+
options.use_https ? 'https' : 'http'
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "omniauth/barong/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "omniauth-referral-barong"
|
8
|
+
spec.version = OmniAuth::Barong::VERSION
|
9
|
+
spec.authors = ["Louis Bellet","Yaroslav Savchuk"]
|
10
|
+
spec.email = ["riguang102@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Authentification strategy for referral Barong server}
|
13
|
+
spec.description = %q{Barong is an opensource OAuth and KyC server}
|
14
|
+
spec.homepage = "https://www.peatio.tech/"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
17
|
+
f.match(%r{^(test|spec|features)/})
|
18
|
+
end
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_runtime_dependency 'omniauth-oauth2', '~> 1.5'
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
24
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
25
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
26
|
+
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,113 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omniauth-referral-barong
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.4
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Louis Bellet
|
8
|
+
- Yaroslav Savchuk
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2020-07-14 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: omniauth-oauth2
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - "~>"
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '1.5'
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - "~>"
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '1.5'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: bundler
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - "~>"
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '1.16'
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - "~>"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '1.16'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: rake
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - "~>"
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '10.0'
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - "~>"
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '10.0'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: rspec
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '3.0'
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '3.0'
|
70
|
+
description: Barong is an opensource OAuth and KyC server
|
71
|
+
email:
|
72
|
+
- riguang102@gmail.com
|
73
|
+
executables: []
|
74
|
+
extensions: []
|
75
|
+
extra_rdoc_files: []
|
76
|
+
files:
|
77
|
+
- ".gitignore"
|
78
|
+
- ".rspec"
|
79
|
+
- ".travis.yml"
|
80
|
+
- Gemfile
|
81
|
+
- Gemfile.lock
|
82
|
+
- README.md
|
83
|
+
- Rakefile
|
84
|
+
- bin/console
|
85
|
+
- bin/setup
|
86
|
+
- lib/omniauth-referral-barong.rb
|
87
|
+
- lib/omniauth/barong.rb
|
88
|
+
- lib/omniauth/barong/version.rb
|
89
|
+
- lib/omniauth/strategies/barong.rb
|
90
|
+
- omniauth-referral-barong.gemspec
|
91
|
+
homepage: https://www.peatio.tech/
|
92
|
+
licenses: []
|
93
|
+
metadata: {}
|
94
|
+
post_install_message:
|
95
|
+
rdoc_options: []
|
96
|
+
require_paths:
|
97
|
+
- lib
|
98
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
103
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
104
|
+
requirements:
|
105
|
+
- - ">="
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
version: '0'
|
108
|
+
requirements: []
|
109
|
+
rubygems_version: 3.0.3
|
110
|
+
signing_key:
|
111
|
+
specification_version: 4
|
112
|
+
summary: Authentification strategy for referral Barong server
|
113
|
+
test_files: []
|