omniauth-barong-referral 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 494b48aa1fc67e3687e0175e7f2558257dd9c7cfdb17447ab76d22e5fc92ce8f
4
+ data.tar.gz: ea97d6235679967d0a95683e90b5c3ab0bb04547aa2d60458189c01433d1059d
5
+ SHA512:
6
+ metadata.gz: 892ee6af1a6f59e1bc6441ab5f212a3ce0c95c3501e9dcef7ab45b6a9145b912ed0cb664db01a7e12c0f456bd42501a899fbdefcd7c888762f7dbe40e5e928cc
7
+ data.tar.gz: 2c246890ecd2b13d63dac603aaf6b1f44894cfa87deaeb6ecaaaf4f9e944b66af99ac05ccab4d23438a23ebf654644ce3e3d9f17ae2f3faa37505f4035f484f6
@@ -0,0 +1,21 @@
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
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.5.0
5
+ before_install: gem install bundler -v 1.16.1
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in omniauth-barong.gemspec
6
+ gemspec
@@ -0,0 +1,56 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ omniauth-barong-referral (0.1.4)
5
+ omniauth-oauth2 (~> 1.5)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ diff-lcs (1.3)
11
+ faraday (0.15.3)
12
+ multipart-post (>= 1.2, < 3)
13
+ hashie (3.5.7)
14
+ jwt (2.1.0)
15
+ multi_json (1.13.1)
16
+ multi_xml (0.6.0)
17
+ multipart-post (2.0.0)
18
+ oauth2 (1.4.1)
19
+ faraday (>= 0.8, < 0.16.0)
20
+ jwt (>= 1.0, < 3.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.6)
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-referral!
52
+ rake (~> 10.0)
53
+ rspec (~> 3.0)
54
+
55
+ BUNDLED WITH
56
+ 1.17.1
@@ -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.
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -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__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'omniauth/barong'
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'omniauth/strategies/barong'
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OmniAuth
4
+ module Barong
5
+ VERSION = '0.1.4'
6
+ end
7
+ end
@@ -0,0 +1,71 @@
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
+ }
51
+ end
52
+
53
+ def raw_info
54
+ @raw_info ||= access_token.get(raw_info_url).parsed
55
+ end
56
+
57
+ def raw_info_url
58
+ options.raw_info_url || "/api/#{options.api_version}/accounts/me"
59
+ end
60
+
61
+ def callback_url
62
+ options.callback_url || (full_host + script_name + callback_path)
63
+ end
64
+
65
+ private
66
+ def scheme
67
+ options.use_https ? 'https' : 'http'
68
+ end
69
+ end
70
+ end
71
+ 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-barong-referral"
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,114 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-barong-referral
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: 2019-01-18 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-barong-referral.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
+ rubyforge_project:
110
+ rubygems_version: 2.7.6
111
+ signing_key:
112
+ specification_version: 4
113
+ summary: Authentification strategy for referral Barong server
114
+ test_files: []