omniauth-vonage 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 587e5b5082fb64f2ebb4baf3dcfeb01178e6164ce875a3c09f1de0e2c11675b6
4
+ data.tar.gz: 56e8c54ca6de18e217fa9555b7e256d96b3af1f56839838302742d4b7c536cf9
5
+ SHA512:
6
+ metadata.gz: 50d4b5aeb3e3c928a2f99bd91b180cef7d7ad71d70f753c44fdc876cb219c2a20342d5ce51e36c2863585c03f0ab1cbf7428eb0777e45cca5a3ac731ff4d406a
7
+ data.tar.gz: '0449883b529929fbc497de1abd43bc11101a2bbeaf75f2351f23e9f0568f8d1caef98fd86886b1d5146b68380d968ea54b22e8ae14cdb5e2a58bb30c938e5d6b'
data/.gitignore ADDED
@@ -0,0 +1,56 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /spec/examples.txt
9
+ /test/tmp/
10
+ /test/version_tmp/
11
+ /tmp/
12
+
13
+ # Used by dotenv library to load environment variables.
14
+ # .env
15
+
16
+ # Ignore Byebug command history file.
17
+ .byebug_history
18
+
19
+ ## Specific to RubyMotion:
20
+ .dat*
21
+ .repl_history
22
+ build/
23
+ *.bridgesupport
24
+ build-iPhoneOS/
25
+ build-iPhoneSimulator/
26
+
27
+ ## Specific to RubyMotion (use of CocoaPods):
28
+ #
29
+ # We recommend against adding the Pods directory to your .gitignore. However
30
+ # you should judge for yourself, the pros and cons are mentioned at:
31
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
32
+ #
33
+ # vendor/Pods/
34
+
35
+ ## Documentation cache and generated files:
36
+ /.yardoc/
37
+ /_yardoc/
38
+ /doc/
39
+ /rdoc/
40
+
41
+ ## Environment normalization:
42
+ /.bundle/
43
+ /vendor/bundle
44
+ /lib/bundler/man/
45
+
46
+ # for a library or gem, you might want to ignore these files since the code is
47
+ # intended to run in multiple environments; otherwise, check them in:
48
+ # Gemfile.lock
49
+ # .ruby-version
50
+ # .ruby-gemset
51
+
52
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
53
+ .rvmrc
54
+
55
+ # Used by RuboCop. Remote config files pulled in from inherit_from directive.
56
+ # .rubocop-https?--*
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 Alexander Vangelov
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,2 @@
1
+ # omniauth-vonage
2
+ OmniAuth strategy for Vonage
@@ -0,0 +1,65 @@
1
+ require 'omniauth-oauth2'
2
+ require 'jwt'
3
+
4
+ module OmniAuth
5
+ module Strategies
6
+ class Vonage < OmniAuth::Strategies::OAuth2
7
+
8
+ option :name, 'vonage'
9
+
10
+ option :authorize_options, [
11
+ :scope,
12
+ :schema,
13
+ :state,
14
+ :prompt,
15
+ :redirect_uri
16
+ ]
17
+
18
+ option :client_options, {
19
+ :site => 'https://login.auth.vonage.com',
20
+ :authorize_url => '/oauth2/authorize',
21
+ :token_url => '/oauth2/token'
22
+ }
23
+
24
+ uid { raw_info['sub'] }
25
+
26
+ info do
27
+ {
28
+ :name => raw_info['sub'].split('@')[0]
29
+ }
30
+ end
31
+
32
+ extra do
33
+ {
34
+ :raw_info => raw_info
35
+ }
36
+ end
37
+
38
+ def raw_info
39
+ @raw_info ||= access_token.get('/oauth2/userinfo').parsed
40
+ end
41
+
42
+ def callback_url
43
+ options[:redirect_uri] || (full_host + script_name + callback_path)
44
+ end
45
+
46
+ def get_access_token(request)
47
+ verifier = request.params['code']
48
+ client_get_token(verifier, callback_url)
49
+ end
50
+
51
+ def client_get_token(verifier, redirect_uri)
52
+ client.auth_code.get_token(verifier, get_token_options(redirect_uri), get_token_params)
53
+ end
54
+
55
+ def get_token_params
56
+ deep_symbolize(options.auth_token_params || {})
57
+ end
58
+
59
+ def get_token_options(redirect_uri = '')
60
+ { redirect_uri: redirect_uri }.merge(token_params.to_hash(symbolize_keys: true))
61
+ end
62
+
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,5 @@
1
+ module OmniAuth
2
+ module Vonage
3
+ VERSION = '1.0.0'
4
+ end
5
+ end
@@ -0,0 +1 @@
1
+ require 'omniauth/strategies/vonage'
@@ -0,0 +1 @@
1
+ require 'omniauth/vonage'
@@ -0,0 +1,28 @@
1
+
2
+ require File.expand_path('../lib/omniauth/vonage/version', __FILE__)
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = "omniauth-vonage"
6
+ s.version = OmniAuth::Vonage::VERSION
7
+ s.authors = ['Alex Vangelov']
8
+ s.email = ['avangelov@vonage.com']
9
+ s.date = "2020-03-28"
10
+ s.description = %q{This gem provides OmniAuth strategy for https://developer.vonage.com}
11
+ s.summary = %q{OmniAuth strategy for Vonage}
12
+ s.homepage = 'https://github.com/AlexanderVangelov/omniauth-vonage.git'
13
+ s.license = 'MIT'
14
+
15
+ s.files = `git ls-files`.split($/)
16
+ s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ s.test_files = s.files.grep(%r{^(test|spec|features)/})
18
+ s.require_paths = ["lib"]
19
+
20
+ s.required_ruby_version = '>= 2.1.0'
21
+
22
+ s.add_dependency 'omniauth', '~> 1.0'
23
+ s.add_dependency 'omniauth-oauth2', '~> 1.6', '>= 1.6.0'
24
+ s.add_runtime_dependency 'jwt', '~> 2.0'
25
+
26
+ s.add_development_dependency "bundler", "~> 1.3"
27
+ s.add_development_dependency "rake", '~> 0'
28
+ end
metadata ADDED
@@ -0,0 +1,128 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: omniauth-vonage
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Alex Vangelov
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-03-28 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.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.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.6.0
34
+ - - "~>"
35
+ - !ruby/object:Gem::Version
36
+ version: '1.6'
37
+ type: :runtime
38
+ prerelease: false
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: 1.6.0
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '1.6'
47
+ - !ruby/object:Gem::Dependency
48
+ name: jwt
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '2.0'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '2.0'
61
+ - !ruby/object:Gem::Dependency
62
+ name: bundler
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '1.3'
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: '1.3'
75
+ - !ruby/object:Gem::Dependency
76
+ name: rake
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ description: This gem provides OmniAuth strategy for https://developer.vonage.com
90
+ email:
91
+ - avangelov@vonage.com
92
+ executables: []
93
+ extensions: []
94
+ extra_rdoc_files: []
95
+ files:
96
+ - ".gitignore"
97
+ - LICENSE
98
+ - README.md
99
+ - lib/omniauth-vonage.rb
100
+ - lib/omniauth/strategies/vonage.rb
101
+ - lib/omniauth/vonage.rb
102
+ - lib/omniauth/vonage/version.rb
103
+ - omniauth-vonage.gemspec
104
+ homepage: https://github.com/AlexanderVangelov/omniauth-vonage.git
105
+ licenses:
106
+ - MIT
107
+ metadata: {}
108
+ post_install_message:
109
+ rdoc_options: []
110
+ require_paths:
111
+ - lib
112
+ required_ruby_version: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - ">="
115
+ - !ruby/object:Gem::Version
116
+ version: 2.1.0
117
+ required_rubygems_version: !ruby/object:Gem::Requirement
118
+ requirements:
119
+ - - ">="
120
+ - !ruby/object:Gem::Version
121
+ version: '0'
122
+ requirements: []
123
+ rubyforge_project:
124
+ rubygems_version: 2.7.8
125
+ signing_key:
126
+ specification_version: 4
127
+ summary: OmniAuth strategy for Vonage
128
+ test_files: []