omniauth-web3id 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: ce2c648ad78e065bd5be10922b1fa290ee14f696e9e125268bc303c3913cf710
4
+ data.tar.gz: 97a727a5b97740a41992c12e2a985510b6691a11c5e9c8c24aa93b1c18cfeb29
5
+ SHA512:
6
+ metadata.gz: fcc06f54cbfaac73a6cb9779e3929ae7e9c405b23ef4332fab29da493d5f4785a053c79c2be2eeb4a49f25ed70e3376917f35b222e395353c04fcec1f23b92af
7
+ data.tar.gz: c5dd9628289bcf766aa956a01a8968ef60dbc62c959cb313c91d0cf74907a71c030c6477d9e314c2c6f8c4ae6a836098ff51c90ae27d9082fe8aaaa040924c51
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,17 @@
1
+ AllCops:
2
+ NewCops: enable
3
+ TargetRubyVersion: 2.6
4
+
5
+ Style/StringLiterals:
6
+ Enabled: true
7
+ EnforcedStyle: double_quotes
8
+
9
+ Style/StringLiteralsInInterpolation:
10
+ Enabled: true
11
+ EnforcedStyle: double_quotes
12
+
13
+ Layout/LineLength:
14
+ Max: 120
15
+
16
+ Metrics/BlockLength:
17
+ Max: 150
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2022-07-30
4
+
5
+ - Initial release
data/Gemfile ADDED
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in omniauth-web3id.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+
10
+ gem "rspec", "~> 3.0"
11
+
12
+ gem "rubocop", "~> 1.21"
13
+ gem "rubocop-rake"
14
+ gem "rubocop-rspec"
data/Gemfile.lock ADDED
@@ -0,0 +1,101 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ omniauth-web3id (0.1.0)
5
+ omniauth
6
+ omniauth-oauth2
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ ast (2.4.2)
12
+ coderay (1.1.3)
13
+ diff-lcs (1.5.0)
14
+ faraday (2.4.0)
15
+ faraday-net_http (~> 2.0)
16
+ ruby2_keywords (>= 0.0.4)
17
+ faraday-net_http (2.1.0)
18
+ hashie (5.0.0)
19
+ json (2.6.2)
20
+ jwt (2.4.1)
21
+ method_source (1.0.0)
22
+ multi_xml (0.6.0)
23
+ oauth2 (2.0.6)
24
+ faraday (>= 0.17.3, < 3.0)
25
+ jwt (>= 1.0, < 3.0)
26
+ multi_xml (~> 0.5)
27
+ rack (>= 1.2, < 3)
28
+ rash_alt (>= 0.4, < 1)
29
+ version_gem (~> 1.1)
30
+ omniauth (2.1.0)
31
+ hashie (>= 3.4.6)
32
+ rack (>= 2.2.3)
33
+ rack-protection
34
+ omniauth-oauth2 (1.8.0)
35
+ oauth2 (>= 1.4, < 3)
36
+ omniauth (~> 2.0)
37
+ parallel (1.22.1)
38
+ parser (3.1.2.0)
39
+ ast (~> 2.4.1)
40
+ pry (0.14.1)
41
+ coderay (~> 1.1)
42
+ method_source (~> 1.0)
43
+ rack (2.2.4)
44
+ rack-protection (2.2.2)
45
+ rack
46
+ rainbow (3.1.1)
47
+ rake (13.0.6)
48
+ rash_alt (0.4.12)
49
+ hashie (>= 3.4)
50
+ regexp_parser (2.5.0)
51
+ rexml (3.2.5)
52
+ rspec (3.11.0)
53
+ rspec-core (~> 3.11.0)
54
+ rspec-expectations (~> 3.11.0)
55
+ rspec-mocks (~> 3.11.0)
56
+ rspec-core (3.11.0)
57
+ rspec-support (~> 3.11.0)
58
+ rspec-expectations (3.11.0)
59
+ diff-lcs (>= 1.2.0, < 2.0)
60
+ rspec-support (~> 3.11.0)
61
+ rspec-mocks (3.11.1)
62
+ diff-lcs (>= 1.2.0, < 2.0)
63
+ rspec-support (~> 3.11.0)
64
+ rspec-support (3.11.0)
65
+ rubocop (1.32.0)
66
+ json (~> 2.3)
67
+ parallel (~> 1.10)
68
+ parser (>= 3.1.0.0)
69
+ rainbow (>= 2.2.2, < 4.0)
70
+ regexp_parser (>= 1.8, < 3.0)
71
+ rexml (>= 3.2.5, < 4.0)
72
+ rubocop-ast (>= 1.19.1, < 2.0)
73
+ ruby-progressbar (~> 1.7)
74
+ unicode-display_width (>= 1.4.0, < 3.0)
75
+ rubocop-ast (1.19.1)
76
+ parser (>= 3.1.1.0)
77
+ rubocop-rake (0.6.0)
78
+ rubocop (~> 1.0)
79
+ rubocop-rspec (2.12.1)
80
+ rubocop (~> 1.31)
81
+ ruby-progressbar (1.11.0)
82
+ ruby2_keywords (0.0.5)
83
+ unicode-display_width (2.2.0)
84
+ version_gem (1.1.0)
85
+
86
+ PLATFORMS
87
+ arm64-darwin-21
88
+ x86_64-linux
89
+
90
+ DEPENDENCIES
91
+ bundler (>= 1.6)
92
+ omniauth-web3id!
93
+ pry (>= 0.10.3)
94
+ rake (~> 13.0)
95
+ rspec (~> 3.0)
96
+ rubocop (~> 1.21)
97
+ rubocop-rake
98
+ rubocop-rspec
99
+
100
+ BUNDLED WITH
101
+ 2.3.7
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 Robin Bortlik
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.
data/README.md ADDED
@@ -0,0 +1,49 @@
1
+ # OmniAuth::Web3ID
2
+
3
+ Web3ID OAuth2 Strategy for OmniAuth.
4
+
5
+ ### What is web3id?
6
+
7
+ - please refer to [official website](https://www.dock.io/web3id)
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ ```ruby
14
+ gem 'omniauth-web3id'
15
+ ```
16
+
17
+ And then execute:
18
+
19
+ $ bundle
20
+
21
+ Or install it yourself as:
22
+
23
+ $ gem install omniauth-web3id
24
+
25
+ ## Usage
26
+
27
+ - Generate your `key/secret` by following [oauth2 setup instructions](https://github.com/docknetwork/auth-server/blob/master/docs/oauth2_setup.md).
28
+
29
+ - Add omniauth builder middleware to your ruby app
30
+
31
+ ```ruby
32
+ Rails.application.config.middleware.use OmniAuth::Builder do
33
+ provider :web3id, ENV['WEB3ID_KEY'], ENV['WEB3ID_SECRET']
34
+ end
35
+ ```
36
+
37
+ ## Devise integration
38
+
39
+ - Please refer to [example rails application](https://github.com/robinbortlik/web3id-rails)
40
+
41
+ ## Showcase
42
+
43
+
44
+ https://user-images.githubusercontent.com/228502/184993116-945f2cb3-70d3-4902-b7ac-81c23e5892ac.mov
45
+
46
+
47
+ ## Final note
48
+
49
+ This gem was heavily inspired by [omniauth-microsoft-office365](https://github.com/murbanski/omniauth-microsoft-office365) gem. Thank you guys for your hard work.
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require "rubocop/rake_task"
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[spec rubocop]
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "omniauth-oauth2"
4
+
5
+ module OmniAuth
6
+ module Strategies
7
+ # Web3ID authentication strategy.
8
+ class Web3ID < OmniAuth::Strategies::OAuth2
9
+ option :name, :web3id
10
+
11
+ DEFAULT_SCOPE = "public email"
12
+
13
+ option :client_options, {
14
+ site: "https://auth.dock.io",
15
+ authorize_url: "/oauth2/authorize?response_type=code",
16
+ token_url: "/oauth2/token",
17
+ profile_url: "/oauth2/userinfo"
18
+ }
19
+ option :authorize_params, { grant_type: "authorization_code", scope: DEFAULT_SCOPE }
20
+ option :authorize_options, %w[scope]
21
+ option :provider_ignores_state, true
22
+
23
+ uid { raw_info_did }
24
+
25
+ info do
26
+ {
27
+ did: raw_info_did,
28
+ email: raw_info["email"],
29
+ name: raw_info["name"]
30
+ }
31
+ end
32
+
33
+ extra do
34
+ {
35
+ "raw_info" => raw_info
36
+ }
37
+ end
38
+
39
+ def raw_info_did
40
+ raw_info["id"] || raw_info["user_id"]
41
+ end
42
+
43
+ def raw_info
44
+ @raw_info ||= access_token.get(client.options[:profile_url]).parsed
45
+ end
46
+
47
+ def callback_url
48
+ options[:redirect_uri] || (full_host + script_name + callback_path)
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OmniAuth
4
+ module Web3ID
5
+ VERSION = "0.1.0"
6
+ end
7
+ end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "web3id/version"
4
+ require_relative "strategies/web3id"
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/omniauth/web3id/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "omniauth-web3id"
7
+ spec.version = OmniAuth::Web3ID::VERSION
8
+ spec.authors = ["Robin Bortlik"]
9
+ spec.email = ["robinbortlik@gmail.com"]
10
+
11
+ spec.summary = "OmniAuth extension for WEB3ID authentication"
12
+ spec.homepage = "https://github.com/robinbortlik/OmniAuth-web3id"
13
+ spec.license = "MIT"
14
+ spec.required_ruby_version = ">= 2.6.0"
15
+
16
+ spec.metadata["allowed_push_host"] = "https://rubygems.org/"
17
+
18
+ spec.metadata["homepage_uri"] = spec.homepage
19
+ spec.metadata["source_code_uri"] = "https://github.com/robinbortlik/omniauth-web3id"
20
+ spec.metadata["changelog_uri"] = "https://github.com/robinbortlik/omniauth-web3id/CHANGELOG.md"
21
+
22
+ # Specify which files should be added to the gem when it is released.
23
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
24
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
25
+ `git ls-files -z`.split("\x0").reject do |f|
26
+ (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
27
+ end
28
+ end
29
+ spec.bindir = "exe"
30
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
31
+ spec.require_paths = ["lib"]
32
+
33
+ spec.add_runtime_dependency "omniauth"
34
+ spec.add_runtime_dependency "omniauth-oauth2"
35
+
36
+ spec.add_development_dependency "bundler", ">= 1.6"
37
+ spec.add_development_dependency "pry", ">= 0.10.3"
38
+ spec.add_development_dependency "rake", ">= 11.1.2"
39
+ spec.add_development_dependency "rspec", ">= 3.4.0"
40
+ spec.metadata["rubygems_mfa_required"] = "true"
41
+ end
@@ -0,0 +1,6 @@
1
+ module OmniAuth
2
+ module Web3ID
3
+ VERSION: String
4
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
5
+ end
6
+ end
metadata ADDED
@@ -0,0 +1,145 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-web3id
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Robin Bortlik
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2022-08-16 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: '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: omniauth-oauth2
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '1.6'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '1.6'
55
+ - !ruby/object:Gem::Dependency
56
+ name: pry
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: 0.10.3
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: 0.10.3
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: 11.1.2
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: 11.1.2
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: 3.4.0
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: 3.4.0
97
+ description:
98
+ email:
99
+ - robinbortlik@gmail.com
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - ".rspec"
105
+ - ".rubocop.yml"
106
+ - CHANGELOG.md
107
+ - Gemfile
108
+ - Gemfile.lock
109
+ - LICENSE.txt
110
+ - README.md
111
+ - Rakefile
112
+ - lib/omniauth/strategies/web3id.rb
113
+ - lib/omniauth/web3id.rb
114
+ - lib/omniauth/web3id/version.rb
115
+ - omniauth-web3id.gemspec
116
+ - sig/omniauth/web3id.rbs
117
+ homepage: https://github.com/robinbortlik/OmniAuth-web3id
118
+ licenses:
119
+ - MIT
120
+ metadata:
121
+ allowed_push_host: https://rubygems.org/
122
+ homepage_uri: https://github.com/robinbortlik/OmniAuth-web3id
123
+ source_code_uri: https://github.com/robinbortlik/omniauth-web3id
124
+ changelog_uri: https://github.com/robinbortlik/omniauth-web3id/CHANGELOG.md
125
+ rubygems_mfa_required: 'true'
126
+ post_install_message:
127
+ rdoc_options: []
128
+ require_paths:
129
+ - lib
130
+ required_ruby_version: !ruby/object:Gem::Requirement
131
+ requirements:
132
+ - - ">="
133
+ - !ruby/object:Gem::Version
134
+ version: 2.6.0
135
+ required_rubygems_version: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - ">="
138
+ - !ruby/object:Gem::Version
139
+ version: '0'
140
+ requirements: []
141
+ rubygems_version: 3.3.7
142
+ signing_key:
143
+ specification_version: 4
144
+ summary: OmniAuth extension for WEB3ID authentication
145
+ test_files: []