omniauth-nextengine 0.1.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 6fd7f26f5aa172e1c3de5eced547e9ea1cd4356fb66184c4d49941fd2cb34221
4
+ data.tar.gz: 34e74cbdcc0eece1c8295ba6b159e8a4a711bb3dec3ef18ddb510571eedf04c9
5
+ SHA512:
6
+ metadata.gz: b3d28976abccc7d064bc78fae8e9a22bdc42a748b881ee18cac2d81248e27a5b17735040ad123b83185e1ab9ff4a086f3330890bb7c273aeb2afa65518fca009
7
+ data.tar.gz: 3f4dbcbaf24cade13b266c02c4bc497203c3473dcce06d9f0caa7b1b535b341ac647e8aa795e0310f655db3e4f65eb6f38dadf6a4762b38511414518bc4efbd0
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ vendor
2
+ .bundle
3
+ example/Gemfile.lock
4
+ .ruby-version
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-nextengine.gemspec
6
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,56 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ omniauth-nextengine (0.1.0)
5
+ omniauth (~> 1.2)
6
+ omniauth-oauth2 (~> 1.5)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ diff-lcs (1.3)
12
+ faraday (0.15.4)
13
+ multipart-post (>= 1.2, < 3)
14
+ hashie (3.6.0)
15
+ jwt (2.1.0)
16
+ multi_json (1.13.1)
17
+ multi_xml (0.6.0)
18
+ multipart-post (2.0.0)
19
+ oauth2 (1.4.1)
20
+ faraday (>= 0.8, < 0.16.0)
21
+ jwt (>= 1.0, < 3.0)
22
+ multi_json (~> 1.3)
23
+ multi_xml (~> 0.5)
24
+ rack (>= 1.2, < 3)
25
+ omniauth (1.9.0)
26
+ hashie (>= 3.4.6, < 3.7.0)
27
+ rack (>= 1.6.2, < 3)
28
+ omniauth-oauth2 (1.6.0)
29
+ oauth2 (~> 1.1)
30
+ omniauth (~> 1.9)
31
+ rack (2.0.6)
32
+ rake (10.5.0)
33
+ rspec (3.8.0)
34
+ rspec-core (~> 3.8.0)
35
+ rspec-expectations (~> 3.8.0)
36
+ rspec-mocks (~> 3.8.0)
37
+ rspec-core (3.8.0)
38
+ rspec-support (~> 3.8.0)
39
+ rspec-expectations (3.8.2)
40
+ diff-lcs (>= 1.2.0, < 2.0)
41
+ rspec-support (~> 3.8.0)
42
+ rspec-mocks (3.8.0)
43
+ diff-lcs (>= 1.2.0, < 2.0)
44
+ rspec-support (~> 3.8.0)
45
+ rspec-support (3.8.0)
46
+
47
+ PLATFORMS
48
+ ruby
49
+
50
+ DEPENDENCIES
51
+ omniauth-nextengine!
52
+ rake (~> 10.0)
53
+ rspec (~> 3.0)
54
+
55
+ BUNDLED WITH
56
+ 2.0.1
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2019
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,35 @@
1
+ # OmniAuth::Nextengine
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/nextengine`. 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-nextengine'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install omniauth-nextengine
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ 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.
30
+
31
+ 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).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/ntakanashi/omniauth-nextengine.
data/Rakefile ADDED
@@ -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
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "omniauth-nextengine"
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,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
data/example/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'sinatra'
4
+ gem 'omniauth'
5
+ gem 'omniauth-nextengine', :path => '../'
data/example/config.ru ADDED
@@ -0,0 +1,32 @@
1
+ require 'sinatra'
2
+ require 'omniauth'
3
+ require 'omniauth-nextengine'
4
+ require 'logger'
5
+ logger = Logger.new(STDOUT)
6
+
7
+ class App < Sinatra::Base
8
+ get '/' do
9
+ <<-HTML
10
+ <a href='/auth/nextengine'>Sign in with Twitter</a>
11
+ HTML
12
+ end
13
+
14
+ get '/auth/:name/callback' do
15
+ auth = request.env['omniauth.auth']
16
+ pp "Aaaaaaaaaa"
17
+ logger.info(auth)
18
+ pp JSON.pretty_generate(auth)
19
+ pp "Aaaaaaaaaa"
20
+ p 'a'
21
+ end
22
+ end
23
+
24
+ use Rack::Session::Cookie, secret: 'foobar'
25
+ use OmniAuth::Builder do
26
+ provider :nextengine, 'client_id', 'client_secret', {
27
+
28
+ provider_ignores_state: true
29
+ }
30
+ end
31
+
32
+ run App.new
@@ -0,0 +1 @@
1
+ require 'omniauth/nextengine'
@@ -0,0 +1,2 @@
1
+ require 'omniauth/nextengine/version'
2
+ require 'omniauth/strategies/nextengine'
@@ -0,0 +1,5 @@
1
+ module OmniAuth
2
+ module Nextengine
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,47 @@
1
+ require 'omniauth-oauth2'
2
+
3
+ module OmniAuth
4
+ module Strategies
5
+ class Nextengine < OmniAuth::Strategies::OAuth2
6
+
7
+ option :name, 'nextengine'
8
+
9
+ option :client_options, {
10
+ :site => 'https://api.next-engine.org',
11
+ :authorize_url => 'https://base.next-engine.org/users/sign_in',
12
+ :token_url => 'https://api.next-engine.org/api_neauth'
13
+ }
14
+
15
+ uid do
16
+ request.params['uid']
17
+ end
18
+
19
+ credentials do
20
+ {
21
+ 'access_token' => access_token.token,
22
+ 'refresh_token' => access_token.refresh_token,
23
+ }
24
+ end
25
+
26
+ def raw_info
27
+ @raw_info ||= access_token.get('user').parsed
28
+ end
29
+
30
+ def request_phase
31
+ redirect client.auth_code.authorize_url({:redirect_uri => callback_url}.merge(authorize_params))
32
+ end
33
+
34
+ def callback_url
35
+ full_host + script_name + callback_path
36
+ end
37
+
38
+ def build_access_token
39
+ client.auth_code.get_token('', {
40
+ uid: request.params['uid'],
41
+ state: request.params['state'],
42
+ client_secret: options[:client_secret],
43
+ }.merge(token_params.to_hash(:symbolize_keys => true)), deep_symbolize(options.auth_token_params))
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,28 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "omniauth/nextengine/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "omniauth-nextengine"
8
+ spec.version = OmniAuth::Nextengine::VERSION
9
+ spec.authors = ["ntakanashi"]
10
+ spec.email = ["nao.takanash123@gmail.com"]
11
+ spec.license = 'MIT'
12
+ spec.summary = "Next Engine strategy for OmniAuth"
13
+ spec.description = spec.summary
14
+ spec.homepage = "https://github.com/ntakanashi/omniauth-nextengine"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
17
+ f.match(%r{^(test|spec|features)/})
18
+ end
19
+ spec.bindir = "exe"
20
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
+ spec.require_paths = ["lib"]
22
+
23
+ spec.add_runtime_dependency 'omniauth', '~> 1.2'
24
+ spec.add_dependency 'omniauth-oauth2', '~> 1.5'
25
+
26
+ spec.add_development_dependency "rake", "~> 10.0"
27
+ spec.add_development_dependency "rspec", "~> 3.0"
28
+ end
metadata ADDED
@@ -0,0 +1,114 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-nextengine
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - ntakanashi
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2019-03-05 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: omniauth
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.2'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.2'
27
+ - !ruby/object:Gem::Dependency
28
+ name: omniauth-oauth2
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.5'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.5'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.0'
69
+ description: Next Engine strategy for OmniAuth
70
+ email:
71
+ - nao.takanash123@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - Gemfile
78
+ - Gemfile.lock
79
+ - LICENSE
80
+ - README.md
81
+ - Rakefile
82
+ - bin/console
83
+ - bin/setup
84
+ - example/Gemfile
85
+ - example/config.ru
86
+ - lib/omniauth-nextengine.rb
87
+ - lib/omniauth/nextengine.rb
88
+ - lib/omniauth/nextengine/version.rb
89
+ - lib/omniauth/strategies/nextengine.rb
90
+ - omniauth-nextengine.gemspec
91
+ homepage: https://github.com/ntakanashi/omniauth-nextengine
92
+ licenses:
93
+ - MIT
94
+ metadata: {}
95
+ post_install_message:
96
+ rdoc_options: []
97
+ require_paths:
98
+ - lib
99
+ required_ruby_version: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ required_rubygems_version: !ruby/object:Gem::Requirement
105
+ requirements:
106
+ - - ">="
107
+ - !ruby/object:Gem::Version
108
+ version: '0'
109
+ requirements: []
110
+ rubygems_version: 3.0.1
111
+ signing_key:
112
+ specification_version: 4
113
+ summary: Next Engine strategy for OmniAuth
114
+ test_files: []