omniauth-vatsimsso 0.1.1

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: c99dd841cbf3f02a30ce340dc5b21d88c72f05611bf3a5f49760f2840069e64f
4
+ data.tar.gz: 899e6b48b6b39f728cd369ad73279ed1298434c6718c57ec4cc99f82f5cc42a8
5
+ SHA512:
6
+ metadata.gz: d43a9dc587c99cb2e82a8225a4cabdb001e4f08d706218814072f71cab9aef49536e1ea7c1b0ab796f4c3d1b71153bb496468f777f71b9a64071c060bb885da8
7
+ data.tar.gz: 8e597417dfb244f2069656cc850a10bfb9385d00b573a0b731f76a96b6c05f4732ac4775e26483fe33a305fe1bedce905e63727a3d238f422cd9a3f541874f3f
data/.idea/misc.xml ADDED
@@ -0,0 +1,4 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectRootManager" version="2" project-jdk-name="RVM: ruby-2.7.2" project-jdk-type="RUBY_SDK" />
4
+ </project>
data/.idea/modules.xml ADDED
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/omniauth-vatsimsso.iml" filepath="$PROJECT_DIR$/.idea/omniauth-vatsimsso.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
@@ -0,0 +1,34 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="RUBY_MODULE" version="4">
3
+ <component name="ModuleRunConfigurationManager">
4
+ <shared />
5
+ </component>
6
+ <component name="NewModuleRootManager">
7
+ <content url="file://$MODULE_DIR$">
8
+ <sourceFolder url="file://$MODULE_DIR$/features" isTestSource="true" />
9
+ <sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
10
+ <sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
11
+ </content>
12
+ <orderEntry type="inheritedJdk" />
13
+ <orderEntry type="sourceFolder" forTests="false" />
14
+ <orderEntry type="library" scope="PROVIDED" name="bundler (v2.2.31, RVM: ruby-2.7.2) [gem]" level="application" />
15
+ <orderEntry type="library" scope="PROVIDED" name="faraday (v2.7.4, RVM: ruby-2.7.2) [gem]" level="application" />
16
+ <orderEntry type="library" scope="PROVIDED" name="faraday-net_http (v3.0.2, RVM: ruby-2.7.2) [gem]" level="application" />
17
+ <orderEntry type="library" scope="PROVIDED" name="hashie (v5.0.0, RVM: ruby-2.7.2) [gem]" level="application" />
18
+ <orderEntry type="library" scope="PROVIDED" name="jwt (v2.6.0, RVM: ruby-2.7.2) [gem]" level="application" />
19
+ <orderEntry type="library" scope="PROVIDED" name="multi_xml (v0.6.0, RVM: ruby-2.7.2) [gem]" level="application" />
20
+ <orderEntry type="library" scope="PROVIDED" name="oauth2 (v2.0.9, RVM: ruby-2.7.2) [gem]" level="application" />
21
+ <orderEntry type="library" scope="PROVIDED" name="omniauth (v2.1.1, RVM: ruby-2.7.2) [gem]" level="application" />
22
+ <orderEntry type="library" scope="PROVIDED" name="omniauth-oauth2 (v1.8.0, RVM: ruby-2.7.2) [gem]" level="application" />
23
+ <orderEntry type="library" scope="PROVIDED" name="rack (v3.0.4.1, RVM: ruby-2.7.2) [gem]" level="application" />
24
+ <orderEntry type="library" scope="PROVIDED" name="rack-protection (v3.0.5, RVM: ruby-2.7.2) [gem]" level="application" />
25
+ <orderEntry type="library" scope="PROVIDED" name="ruby2_keywords (v0.0.5, RVM: ruby-2.7.2) [gem]" level="application" />
26
+ <orderEntry type="library" scope="PROVIDED" name="snaky_hash (v2.0.1, RVM: ruby-2.7.2) [gem]" level="application" />
27
+ <orderEntry type="library" scope="PROVIDED" name="version_gem (v1.1.1, RVM: ruby-2.7.2) [gem]" level="application" />
28
+ </component>
29
+ <component name="RakeTasksCache">
30
+ <option name="myRootTask">
31
+ <RakeTaskImpl id="rake" />
32
+ </option>
33
+ </component>
34
+ </module>
data/.idea/vcs.xml ADDED
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
+ </component>
6
+ </project>
@@ -0,0 +1,89 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ChangeListManager">
4
+ <list default="true" id="3b405ffe-d82a-4684-bb10-80ad5f3d3fc3" name="Changes" comment="">
5
+ <change afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" />
6
+ <change afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
7
+ <change afterPath="$PROJECT_DIR$/.idea/modules.xml" afterDir="false" />
8
+ <change afterPath="$PROJECT_DIR$/.idea/omniauth-vatsimsso.iml" afterDir="false" />
9
+ <change afterPath="$PROJECT_DIR$/.idea/vcs.xml" afterDir="false" />
10
+ <change afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
11
+ <change afterPath="$PROJECT_DIR$/Gemfile" afterDir="false" />
12
+ <change afterPath="$PROJECT_DIR$/Gemfile.lock" afterDir="false" />
13
+ <change afterPath="$PROJECT_DIR$/LICENSE.txt" afterDir="false" />
14
+ <change afterPath="$PROJECT_DIR$/README.md" afterDir="false" />
15
+ <change afterPath="$PROJECT_DIR$/Rakefile" afterDir="false" />
16
+ <change afterPath="$PROJECT_DIR$/bin/console" afterDir="false" />
17
+ <change afterPath="$PROJECT_DIR$/bin/setup" afterDir="false" />
18
+ <change afterPath="$PROJECT_DIR$/lib/omniauth-vatsimsso.rb" afterDir="false" />
19
+ <change afterPath="$PROJECT_DIR$/lib/omniauth-vatsimsso/version.rb" afterDir="false" />
20
+ <change afterPath="$PROJECT_DIR$/lib/omniauth/strategies/vatsimsso.rb" afterDir="false" />
21
+ <change afterPath="$PROJECT_DIR$/omniauth-vatsimsso.gemspec" afterDir="false" />
22
+ <change afterPath="$PROJECT_DIR$/test/omniauth/vatsimsso_test.rb" afterDir="false" />
23
+ <change afterPath="$PROJECT_DIR$/test/test_helper.rb" afterDir="false" />
24
+ </list>
25
+ <option name="SHOW_DIALOG" value="false" />
26
+ <option name="HIGHLIGHT_CONFLICTS" value="true" />
27
+ <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
28
+ <option name="LAST_RESOLUTION" value="IGNORE" />
29
+ </component>
30
+ <component name="Git.Settings">
31
+ <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
32
+ </component>
33
+ <component name="MarkdownSettingsMigration">
34
+ <option name="stateVersion" value="1" />
35
+ </component>
36
+ <component name="ProjectId" id="2KdFOhGjChY1Rh2EwXNfnbPWzzq" />
37
+ <component name="ProjectLevelVcsManager" settingsEditedManually="true">
38
+ <ConfirmationsSetting value="2" id="Add" />
39
+ </component>
40
+ <component name="ProjectViewState">
41
+ <option name="hideEmptyMiddlePackages" value="true" />
42
+ <option name="showLibraryContents" value="true" />
43
+ </component>
44
+ <component name="PropertiesComponent">{
45
+ &quot;keyToString&quot;: {
46
+ &quot;RunOnceActivity.OpenProjectViewOnStart&quot;: &quot;true&quot;,
47
+ &quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
48
+ &quot;WebServerToolWindowFactoryState&quot;: &quot;false&quot;,
49
+ &quot;last_opened_file_path&quot;: &quot;/home/polostyanoy/RubymineProjects/omniauth-vatsimsso&quot;,
50
+ &quot;nodejs_package_manager_path&quot;: &quot;npm&quot;,
51
+ &quot;ruby.rails.projectView.checked&quot;: &quot;true&quot;
52
+ }
53
+ }</component>
54
+ <component name="RecentsManager">
55
+ <key name="MoveFile.RECENT_KEYS">
56
+ <recent name="$PROJECT_DIR$/lib/omniauth-vatsimsso" />
57
+ <recent name="$PROJECT_DIR$/lib/omniauth/strategies" />
58
+ <recent name="$PROJECT_DIR$/lib" />
59
+ </key>
60
+ </component>
61
+ <component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
62
+ <component name="SpringUtil" SPRING_PRE_LOADER_OPTION="true" RAKE_SPRING_PRE_LOADER_OPTION="true" RAILS_SPRING_PRE_LOADER_OPTION="true" />
63
+ <component name="TaskManager">
64
+ <task active="true" id="Default" summary="Default task">
65
+ <changelist id="3b405ffe-d82a-4684-bb10-80ad5f3d3fc3" name="Changes" comment="" />
66
+ <created>1674296522833</created>
67
+ <option name="number" value="Default" />
68
+ <option name="presentableId" value="Default" />
69
+ <updated>1674296522833</updated>
70
+ <workItem from="1674296525371" duration="640000" />
71
+ <workItem from="1674297176465" duration="1309000" />
72
+ </task>
73
+ <servers />
74
+ </component>
75
+ <component name="TypeScriptGeneratedFilesManager">
76
+ <option name="version" value="3" />
77
+ </component>
78
+ <component name="Vcs.Log.Tabs.Properties">
79
+ <option name="TAB_STATES">
80
+ <map>
81
+ <entry key="MAIN">
82
+ <value>
83
+ <State />
84
+ </value>
85
+ </entry>
86
+ </map>
87
+ </option>
88
+ </component>
89
+ </project>
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in omniauth-vatsimsso.gemspec
6
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,48 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ omniauth-vatsimsso (0.1.0)
5
+ omniauth (~> 2.0)
6
+ omniauth-oauth2 (~> 1.8)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ faraday (2.7.4)
12
+ faraday-net_http (>= 2.0, < 3.1)
13
+ ruby2_keywords (>= 0.0.4)
14
+ faraday-net_http (3.0.2)
15
+ hashie (5.0.0)
16
+ jwt (2.6.0)
17
+ multi_xml (0.6.0)
18
+ oauth2 (2.0.9)
19
+ faraday (>= 0.17.3, < 3.0)
20
+ jwt (>= 1.0, < 3.0)
21
+ multi_xml (~> 0.5)
22
+ rack (>= 1.2, < 4)
23
+ snaky_hash (~> 2.0)
24
+ version_gem (~> 1.1)
25
+ omniauth (2.1.1)
26
+ hashie (>= 3.4.6)
27
+ rack (>= 2.2.3)
28
+ rack-protection
29
+ omniauth-oauth2 (1.8.0)
30
+ oauth2 (>= 1.4, < 3)
31
+ omniauth (~> 2.0)
32
+ rack (3.0.4.1)
33
+ rack-protection (3.0.5)
34
+ rack
35
+ ruby2_keywords (0.0.5)
36
+ snaky_hash (2.0.1)
37
+ hashie
38
+ version_gem (~> 1.1, >= 1.1.1)
39
+ version_gem (1.1.1)
40
+
41
+ PLATFORMS
42
+ x86_64-linux
43
+
44
+ DEPENDENCIES
45
+ omniauth-vatsimsso!
46
+
47
+ BUNDLED WITH
48
+ 2.2.31
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2023 Valerapol
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,46 @@
1
+ # Omniauth::Vatsim::Oauth2
2
+
3
+ OmniAuth::Strategies::Vatsim is an OmniAuth strategy for authenticating with the VATSIM SSO with OAuth2.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'omniauth-vatsimsso', '~> 0.1.0'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle install
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install omniauth-vatsimsso
20
+
21
+ ## Usage
22
+
23
+ Here's an example for adding the middleware to a Rails app in `config/initializers/omniauth.rb`:
24
+
25
+ ```ruby
26
+ Rails.application.config.middleware.use OmniAuth::Builder do
27
+ provider :vatsimsso, ENV['CLIENT_ID'], ENV['CLIENT_SECRET'],
28
+ client_options: {
29
+ site: 'URL', # default to demo site
30
+ response_type: 'code',
31
+ token_method: :post,
32
+ grant_type: 'authorization_code',
33
+ redirect_uri: 'redirect_uri'
34
+ },
35
+ scope: 'full_name vatsim_details email country'
36
+ end
37
+ ```
38
+ You can now access the OmniAuth VATSIM OAuth2 URL: `/auth/authorize`
39
+
40
+ ## Contributing
41
+
42
+ Bug reports and pull requests are welcome on GitHub at https://github.com/Valerapol/omniauth-vatsimsso.
43
+
44
+ ## License
45
+
46
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rake/testtask"
5
+
6
+ Rake::TestTask.new(:test) do |t|
7
+ t.libs << "test"
8
+ t.libs << "lib"
9
+ t.test_files = FileList["test/**/*_test.rb"]
10
+ end
11
+
12
+ task default: :test
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "omniauth/vatsimsso"
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require "irb"
15
+ 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
@@ -0,0 +1,37 @@
1
+ require 'omniauth-oauth2'
2
+
3
+ module OmniAuth
4
+ module Strategies
5
+ class Vatsimsso < OmniAuth::Strategies::OAuth2
6
+ option :name, 'vatsimsso'
7
+ option :client_options,
8
+ site: 'https://auth-dev.vatsim.net',
9
+ authorize_url: '/oauth/authorize',
10
+ token_url: '/oauth/token'
11
+
12
+ uid do
13
+ raw_info.dig('data', 'cid').to_s
14
+ end
15
+
16
+ info do
17
+ {
18
+ name_full: raw_info.dig('data', 'personal', 'name_full'),
19
+ email: raw_info.dig('data', 'personal', 'email'),
20
+ rating: raw_info.dig('data', 'vatsim', 'rating', 'short')
21
+ }
22
+ end
23
+
24
+ extra do
25
+ { raw_info: raw_info }
26
+ end
27
+
28
+ def raw_info
29
+ @raw_info ||= access_token.get('/api/user').parsed
30
+ end
31
+
32
+ def callback_url
33
+ full_host + script_name + callback_path
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Omniauth
4
+ module Vatsimsso
5
+ VERSION = "0.1.1"
6
+ end
7
+ end
@@ -0,0 +1,2 @@
1
+ require 'omniauth-vatsimsso/version'
2
+ require 'omniauth/strategies/vatsimsso'
Binary file
metadata ADDED
@@ -0,0 +1,89 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-vatsimsso
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - V.Polostyanoy
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2023-01-21 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: '2.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.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: '1.8'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.8'
41
+ description: OmniAuth strategy for VATSIM OAuth2.
42
+ email:
43
+ - polostyanoy@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".idea/misc.xml"
49
+ - ".idea/modules.xml"
50
+ - ".idea/omniauth-vatsimsso.iml"
51
+ - ".idea/vcs.xml"
52
+ - ".idea/workspace.xml"
53
+ - Gemfile
54
+ - Gemfile.lock
55
+ - LICENSE.txt
56
+ - README.md
57
+ - Rakefile
58
+ - bin/console
59
+ - bin/setup
60
+ - lib/omniauth-vatsimsso.rb
61
+ - lib/omniauth-vatsimsso/version.rb
62
+ - lib/omniauth/strategies/vatsimsso.rb
63
+ - omniauth-vatsimsso-0.1.0.gem
64
+ homepage: https://github.com/Valerapol/omniauth-vatsimsso
65
+ licenses:
66
+ - MIT
67
+ metadata:
68
+ homepage_uri: https://github.com/Valerapol/omniauth-vatsimsso
69
+ source_code_uri: https://github.com/Valerapol/omniauth-vatsimsso
70
+ post_install_message:
71
+ rdoc_options: []
72
+ require_paths:
73
+ - lib
74
+ required_ruby_version: !ruby/object:Gem::Requirement
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
79
+ required_rubygems_version: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ requirements: []
85
+ rubygems_version: 3.2.31
86
+ signing_key:
87
+ specification_version: 4
88
+ summary: OmniAuth strategy for VATSIM OAuth2.
89
+ test_files: []