omniauth-smile 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 +7 -0
- data/.github/probots.yml +2 -0
- data/.gitignore +2 -0
- data/Gemfile +7 -0
- data/README.md +39 -0
- data/Rakefile +9 -0
- data/lib/omniauth-smile.rb +1 -0
- data/lib/omniauth/smile.rb +2 -0
- data/lib/omniauth/smile/version.rb +5 -0
- data/lib/omniauth/strategies/smile.rb +43 -0
- data/omniauth-smile.gemspec +24 -0
- data/shipit.rubygems.yml +1 -0
- metadata +97 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f57e28f3ac071e2f27a26e1f69376709aede0c2a
|
4
|
+
data.tar.gz: 16b856fd1acd1a97aa5af14a40e8618ea491f908
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b7ed71253005114ba4b40e9e3038d08ff91140e25d57ef4b5994e7eb6998d4c71696614eed68a43bf8038c6b977b45de50e75d614751bf6da90d885df939beb5
|
7
|
+
data.tar.gz: 1f4c9371e79bbe92114166a1b8ad4170e1ca73d746efbd3b226c0923771143c5c87a1bc723e29ad4524ac6a583d29f270706a9d9310811620953194a4f2807a5
|
data/.github/probots.yml
ADDED
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# OmniAuth Smile
|
2
|
+
|
3
|
+
Smile OAuth2 Strategy for OmniAuth 1.0.
|
4
|
+
|
5
|
+
## Installing
|
6
|
+
|
7
|
+
Add to your `Gemfile`:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'omniauth-smile'
|
11
|
+
```
|
12
|
+
|
13
|
+
Then `bundle install`.
|
14
|
+
|
15
|
+
## Usage
|
16
|
+
|
17
|
+
`OmniAuth::Strategies::Smile` is simply a Rack middleware. Read [the OmniAuth 1.0 docs](https://github.com/intridea/omniauth) for detailed instructions.
|
18
|
+
|
19
|
+
Here's a quick example, adding the middleware to a Rails app in `config/initializers/omniauth.rb`:
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
Rails.application.config.middleware.use OmniAuth::Builder do
|
23
|
+
provider :smile, ENV['SMILE_CLIENT_ID'], ENV['SMILE_CLIENT_SECRET']
|
24
|
+
end
|
25
|
+
```
|
26
|
+
## Configuring
|
27
|
+
|
28
|
+
### Scope
|
29
|
+
|
30
|
+
You can configure the scope, which you pass in to the `provider` method via a `Hash`:
|
31
|
+
|
32
|
+
* `scope`: A comma-separated list of permissions you want to request from the user.
|
33
|
+
|
34
|
+
```ruby
|
35
|
+
Rails.application.config.middleware.use OmniAuth::Builder do
|
36
|
+
provider :smile, ENV['SMILE_CLIENT_ID'], ENV['SMILE_CLIENT_SECRET'], scope: 'customer:read'
|
37
|
+
end
|
38
|
+
```
|
39
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'omniauth/smile'
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module OmniAuth
|
2
|
+
module Strategies
|
3
|
+
class Smile < OmniAuth::Strategies::OAuth2
|
4
|
+
option :name, "smile"
|
5
|
+
|
6
|
+
option :client_options,
|
7
|
+
site: ENV.fetch('SMILE_AUTH_URL', 'https://connect.smile.io'),
|
8
|
+
authorize_url: '/oauth2/authorize',
|
9
|
+
token_url: '/oauth2/token',
|
10
|
+
scope: 'customer:read',
|
11
|
+
callback_path: '/integrations/smile/oauth_callback'
|
12
|
+
|
13
|
+
option :auth_token_params, {
|
14
|
+
grant_type: 'authorization_code',
|
15
|
+
scope: 'customer:read'
|
16
|
+
}
|
17
|
+
|
18
|
+
credentials do
|
19
|
+
{
|
20
|
+
code: request.params[:code],
|
21
|
+
scope: 'customer:read',
|
22
|
+
}
|
23
|
+
end
|
24
|
+
|
25
|
+
##
|
26
|
+
# @return [String] Base callback URI without the params since adding the params in (which is default) makes the Smile API return a 4xx error
|
27
|
+
def callback_base_url
|
28
|
+
full_host + script_name + callback_path
|
29
|
+
end
|
30
|
+
|
31
|
+
def token_params
|
32
|
+
super.merge(
|
33
|
+
headers: {
|
34
|
+
'Authorization' => "Basic #{Base64.strict_encode64("#{options.client_id}:#{options.client_secret}")}"
|
35
|
+
},
|
36
|
+
redirect_uri: callback_base_url
|
37
|
+
)
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path('../lib', __FILE__)
|
3
|
+
require 'omniauth/smile/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = 'omniauth-smile'
|
7
|
+
s.version = OmniAuth::Smile::VERSION
|
8
|
+
s.authors = ['Jay El-Kaake']
|
9
|
+
s.email = ['dev@feracommerce.com']
|
10
|
+
s.summary = 'Smile strategy for OmniAuth'
|
11
|
+
s.homepage = 'https://github.com/feracommerce/omniauth-smile'
|
12
|
+
s.license = 'MIT'
|
13
|
+
|
14
|
+
s.files = `git ls-files`.split("\n")
|
15
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
16
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
17
|
+
s.require_paths = ['lib']
|
18
|
+
s.required_ruby_version = '>= 2.1.9'
|
19
|
+
|
20
|
+
s.add_runtime_dependency 'omniauth-oauth2', '~> 1.5.0'
|
21
|
+
s.add_runtime_dependency 'activesupport'
|
22
|
+
|
23
|
+
s.add_development_dependency 'rake'
|
24
|
+
end
|
data/shipit.rubygems.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# using the default shipit config
|
metadata
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omniauth-smile
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jay El-Kaake
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-10-22 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: omniauth-oauth2
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.5.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.5.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: activesupport
|
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: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description:
|
56
|
+
email:
|
57
|
+
- dev@feracommerce.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".github/probots.yml"
|
63
|
+
- ".gitignore"
|
64
|
+
- Gemfile
|
65
|
+
- README.md
|
66
|
+
- Rakefile
|
67
|
+
- lib/omniauth-smile.rb
|
68
|
+
- lib/omniauth/smile.rb
|
69
|
+
- lib/omniauth/smile/version.rb
|
70
|
+
- lib/omniauth/strategies/smile.rb
|
71
|
+
- omniauth-smile.gemspec
|
72
|
+
- shipit.rubygems.yml
|
73
|
+
homepage: https://github.com/feracommerce/omniauth-smile
|
74
|
+
licenses:
|
75
|
+
- MIT
|
76
|
+
metadata: {}
|
77
|
+
post_install_message:
|
78
|
+
rdoc_options: []
|
79
|
+
require_paths:
|
80
|
+
- lib
|
81
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: 2.1.9
|
86
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
requirements: []
|
92
|
+
rubyforge_project:
|
93
|
+
rubygems_version: 2.6.10
|
94
|
+
signing_key:
|
95
|
+
specification_version: 4
|
96
|
+
summary: Smile strategy for OmniAuth
|
97
|
+
test_files: []
|