omniauth-line-openid-connect 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4087d0473565ecd3909586da91020f00def10d16
4
+ data.tar.gz: 739cd155dbdb4d1bf93ccf7198725729329d1489
5
+ SHA512:
6
+ metadata.gz: 1b087ebf8ba91b97c9927548320ae80bec68ffc80a3a8a13a18f584c508494451f13199ac13ff2d6d7219a9468f443fb0c36b44e41cff07f3adb792830890189
7
+ data.tar.gz: 2215bf66631948c28977c5fca44be1e25d94d3b5a8bcd586902a1c89239f00068886968ee7e76ec6f82d3c6d0c7f67de297473f1bebc0324c3d489cd2b78461a
@@ -0,0 +1,13 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ /vendor/
10
+ /.idea/
11
+
12
+ # rspec failure tracking
13
+ .rspec_status
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.4.1
5
+ before_install: gem install bundler -v 1.16.0.pre.3
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-line-openid-connect.gemspec
6
+ gemspec
@@ -0,0 +1,112 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ omniauth-line-openid-connect (0.1.0)
5
+ omniauth_openid_connect
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ activemodel (5.1.4)
11
+ activesupport (= 5.1.4)
12
+ activesupport (5.1.4)
13
+ concurrent-ruby (~> 1.0, >= 1.0.2)
14
+ i18n (~> 0.7)
15
+ minitest (~> 5.1)
16
+ tzinfo (~> 1.1)
17
+ addressable (2.5.2)
18
+ public_suffix (>= 2.0.2, < 4.0)
19
+ attr_required (1.0.1)
20
+ bindata (2.4.1)
21
+ concurrent-ruby (1.0.5)
22
+ diff-lcs (1.3)
23
+ hashie (3.5.6)
24
+ httpclient (2.8.3)
25
+ i18n (0.8.6)
26
+ json (2.1.0)
27
+ json-jwt (1.7.2)
28
+ activesupport
29
+ bindata
30
+ multi_json (>= 1.3)
31
+ securecompare
32
+ url_safe_base64
33
+ mail (2.6.6)
34
+ mime-types (>= 1.16, < 4)
35
+ mime-types (3.1)
36
+ mime-types-data (~> 3.2015)
37
+ mime-types-data (3.2016.0521)
38
+ minitest (5.10.3)
39
+ multi_json (1.12.2)
40
+ omniauth (1.7.1)
41
+ hashie (>= 3.4.6, < 3.6.0)
42
+ rack (>= 1.6.2, < 3)
43
+ omniauth_openid_connect (0.1)
44
+ addressable (~> 2.5)
45
+ omniauth (~> 1.3)
46
+ openid_connect (~> 0.12.0)
47
+ openid_connect (0.12.0)
48
+ activemodel
49
+ attr_required (>= 1.0.0)
50
+ json (>= 1.4.3)
51
+ json-jwt (>= 1.5.0)
52
+ rack-oauth2 (>= 1.3.1)
53
+ swd (>= 1.0.0)
54
+ tzinfo
55
+ validate_email
56
+ validate_url
57
+ webfinger (>= 1.0.1)
58
+ public_suffix (3.0.0)
59
+ rack (2.0.3)
60
+ rack-oauth2 (1.6.2)
61
+ activesupport (>= 2.3)
62
+ attr_required (>= 0.0.5)
63
+ httpclient (>= 2.4)
64
+ multi_json (>= 1.3.6)
65
+ rack (>= 1.1)
66
+ rake (10.5.0)
67
+ rspec (3.6.0)
68
+ rspec-core (~> 3.6.0)
69
+ rspec-expectations (~> 3.6.0)
70
+ rspec-mocks (~> 3.6.0)
71
+ rspec-core (3.6.0)
72
+ rspec-support (~> 3.6.0)
73
+ rspec-expectations (3.6.0)
74
+ diff-lcs (>= 1.2.0, < 2.0)
75
+ rspec-support (~> 3.6.0)
76
+ rspec-mocks (3.6.0)
77
+ diff-lcs (>= 1.2.0, < 2.0)
78
+ rspec-support (~> 3.6.0)
79
+ rspec-support (3.6.0)
80
+ securecompare (1.0.0)
81
+ swd (1.0.1)
82
+ activesupport (>= 3)
83
+ attr_required (>= 0.0.5)
84
+ httpclient (>= 2.4)
85
+ i18n
86
+ json (>= 1.4.3)
87
+ thread_safe (0.3.6)
88
+ tzinfo (1.2.3)
89
+ thread_safe (~> 0.1)
90
+ url_safe_base64 (0.2.2)
91
+ validate_email (0.1.6)
92
+ activemodel (>= 3.0)
93
+ mail (>= 2.2.5)
94
+ validate_url (1.0.2)
95
+ activemodel (>= 3.0.0)
96
+ addressable
97
+ webfinger (1.0.2)
98
+ activesupport
99
+ httpclient (>= 2.4)
100
+ multi_json
101
+
102
+ PLATFORMS
103
+ ruby
104
+
105
+ DEPENDENCIES
106
+ bundler (~> 1.15.0)
107
+ omniauth-line-openid-connect!
108
+ rake (~> 10.0)
109
+ rspec (~> 3.0)
110
+
111
+ BUNDLED WITH
112
+ 1.15.4
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Makoto Tajitsu
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
13
+ all 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
21
+ THE SOFTWARE.
@@ -0,0 +1,44 @@
1
+ # OmniAuth::LineOpenidConnect
2
+
3
+ Omniauth Provider for [LINE](https://line.me/)
4
+ This provider uses openid connect protocol for authentication process.
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```ruby
11
+ gem 'omniauth-line-openid-connect'
12
+ ```
13
+
14
+ And then execute:
15
+
16
+ $ bundle
17
+
18
+ Or install it yourself as:
19
+
20
+ $ gem install omniauth-line-openid-connect
21
+
22
+ ## Usage
23
+
24
+ Put the following code to config/initializers/omniauth.rb
25
+
26
+ ```ruby
27
+ Rails.application.config.middleware.use OmniAuth::Builder do
28
+ provider :line_openid_connect, ENV['LINE_CHANNEL_ID'], ENV['LINE_CHANNEL_SECRET']
29
+ end
30
+ ```
31
+
32
+ ## Development
33
+
34
+ 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.
35
+
36
+ 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).
37
+
38
+ ## Contributing
39
+
40
+ Bug reports and pull requests are welcome on GitHub at https://github.com/tzmfreedom/omniauth-line-openid-connect.
41
+
42
+ ## License
43
+
44
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -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/line/openid/connect"
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,2 @@
1
+ require "omniauth/line-openid-connect/version"
2
+ require "omniauth/strategies/line-openid-connect"
@@ -0,0 +1,5 @@
1
+ module OmniAuth
2
+ module LineOpenidConnect
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,59 @@
1
+ require 'omniauth_openid_connect'
2
+
3
+ module OmniAuth
4
+ module Strategies
5
+ class LineOpenidConnect < ::OmniAuth::Strategies::OpenIDConnect
6
+
7
+ args [:client_id, :client_secret]
8
+
9
+ option :name, :line
10
+ option :scope, [:openid, :profile]
11
+ option :response_type, :code
12
+ option :client_id
13
+ option :client_secret
14
+ option :issuer, 'https://access.line.me'
15
+ option :client_auth_method, :body
16
+ option :client_signing_alg, :HS256
17
+ option :client_options, {
18
+ port: 443,
19
+ scheme: 'https',
20
+ host: 'access.line.me',
21
+ identifier: nil,
22
+ secret: nil,
23
+ redirect_uri: nil,
24
+ authorization_endpoint: '/oauth2/v2.1/authorize',
25
+ token_endpoint: '/oauth2/v2.1/token',
26
+ userinfo_endpoint: '/v2/profile'
27
+ }
28
+
29
+ uid { user_info.raw_attributes['userId'] }
30
+
31
+ info do
32
+ {
33
+ name: user_info.raw_attributes['displayName'],
34
+ image: user_info.raw_attributes['pictureUrl'],
35
+ description: user_info.raw_attributes['statusMessage']
36
+ }
37
+ end
38
+
39
+ def request_phase
40
+ options[:client_options].merge!(identifier: options[:client_id],
41
+ secret: options[:client_secret],
42
+ redirect_uri: callback_url)
43
+ super
44
+ end
45
+
46
+ def callback_phase
47
+ options[:client_options].merge!(identifier: options[:client_id],
48
+ secret: options[:client_secret],
49
+ redirect_uri: callback_url,
50
+ host: 'api.line.me')
51
+ super
52
+ end
53
+
54
+ def callback_url
55
+ full_host + script_name + callback_path
56
+ end
57
+ end
58
+ end
59
+ 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/line-openid-connect/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "omniauth-line-openid-connect"
8
+ spec.version = OmniAuth::LineOpenidConnect::VERSION
9
+ spec.authors = ["tzmfreedom"]
10
+ spec.email = ["makoto_tajitsu@hotmail.co.jp"]
11
+
12
+ spec.summary = %q{OmniAuth Provider for LINE with OpenID Connect}
13
+ spec.description = %q{OmniAuth Provider for LINE with OpenID Connect}
14
+ spec.homepage = "https://github.com/tzmfreedom/omniauth-line-openid-connect"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
18
+ f.match(%r{^(test|spec|features)/})
19
+ end
20
+ spec.bindir = "exe"
21
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
+ spec.require_paths = ["lib"]
23
+
24
+ spec.add_runtime_dependency "omniauth_openid_connect"
25
+ spec.add_development_dependency "bundler", "~> 1.15.0"
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-line-openid-connect
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - tzmfreedom
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-10-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: omniauth_openid_connect
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 1.15.0
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 1.15.0
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: OmniAuth Provider for LINE with OpenID Connect
70
+ email:
71
+ - makoto_tajitsu@hotmail.co.jp
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - ".rspec"
78
+ - ".travis.yml"
79
+ - Gemfile
80
+ - Gemfile.lock
81
+ - LICENSE.txt
82
+ - README.md
83
+ - Rakefile
84
+ - bin/console
85
+ - bin/setup
86
+ - lib/omniauth-line-openid-connect.rb
87
+ - lib/omniauth/line-openid-connect/version.rb
88
+ - lib/omniauth/strategies/line-openid-connect.rb
89
+ - omniauth-line-openid-connect.gemspec
90
+ homepage: https://github.com/tzmfreedom/omniauth-line-openid-connect
91
+ licenses:
92
+ - MIT
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.6.11
111
+ signing_key:
112
+ specification_version: 4
113
+ summary: OmniAuth Provider for LINE with OpenID Connect
114
+ test_files: []