omniauth-sageone 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/.rspec +1 -0
- data/Gemfile +11 -0
- data/Guardfile +10 -0
- data/LICENSE +21 -0
- data/README.md +11 -0
- data/Rakefile +12 -0
- data/lib/omniauth/strategies/sage_one.rb +33 -0
- data/lib/omniauth-sageone/version.rb +5 -0
- data/lib/omniauth-sageone.rb +2 -0
- data/omniauth-sageone.gemspec +25 -0
- data/spec/omniauth/strategies/sageone_spec.rb +7 -0
- data/spec/spec_helper.rb +15 -0
- metadata +143 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 9643d1d139cadb1e4151aeaf552cf365d983b337
|
4
|
+
data.tar.gz: 7a1920ffca755c363c72623fb910e7b157fca786
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2911bd73748bf718dd5ae352ac8ccf9a530b53247b70d7b7c8abbf680b18d4b2574e3fc742116ab2d069c2151fd74cf3024fd67794d736cb63a6a279e935c35f
|
7
|
+
data.tar.gz: 27db4f043197e11aa833ec33a6bb08055a7293c569b68b370676ca5085f74aac74e57b3b9e0510a952b64af75e51b52fff9d363e0921f6ab39d6bf4936abccac
|
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--colour
|
data/Gemfile
ADDED
data/Guardfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2017 Jetbuilt
|
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,11 @@
|
|
1
|
+
# OmniAuth SageOne
|
2
|
+
|
3
|
+
This is an unofficial OmniAuth strategy for authenticating to SageOne. To use it, you'll need to sign up for a Sage One OAuth2 Application ID and Secret.
|
4
|
+
|
5
|
+
## Basic Usage
|
6
|
+
|
7
|
+
use OmniAuth::Builder do
|
8
|
+
provider :sageone, ENV['SAGE_CLIENT_ID'], ENV['SAGE_CLIENT_SECRET'], scope: 'full_access'
|
9
|
+
end
|
10
|
+
|
11
|
+
Options for `scope` are either `readonly` or `full_access`.
|
data/Rakefile
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'omniauth-oauth2'
|
2
|
+
|
3
|
+
module OmniAuth
|
4
|
+
module Strategies
|
5
|
+
class SageOne < OmniAuth::Strategies::OAuth2
|
6
|
+
option :client_options, {
|
7
|
+
authorize_url: 'https://www.sageone.com/oauth2/auth',
|
8
|
+
token_url: 'https://api.sageone.com/oauth2/token'
|
9
|
+
}
|
10
|
+
|
11
|
+
option :authorize_params, {
|
12
|
+
response_type: 'code'
|
13
|
+
}
|
14
|
+
|
15
|
+
protected
|
16
|
+
|
17
|
+
# Override this method to remove the query string from the callback_url because SageOne
|
18
|
+
# requires an exact match
|
19
|
+
def build_access_token
|
20
|
+
verifier = request.params['code']
|
21
|
+
client.auth_code.get_token(
|
22
|
+
verifier,
|
23
|
+
{
|
24
|
+
redirect_uri: callback_url.split('?').first
|
25
|
+
}.merge(token_params.to_hash(symbolize_keys: true)),
|
26
|
+
deep_symbolize(options.auth_token_params)
|
27
|
+
)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
OmniAuth.config.add_camelization 'sageone', 'SageOne'
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/omniauth-sageone/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Jared Moody"]
|
6
|
+
gem.email = ["jared@jetbuilt.com"]
|
7
|
+
gem.description = %q{OmniAuth strategy for SageOne.}
|
8
|
+
gem.summary = %q{OmniAuth strategy for SageOne.}
|
9
|
+
gem.homepage = "https://github.com/jetbuilt/omniauth-sageone"
|
10
|
+
gem.licenses = "MIT"
|
11
|
+
|
12
|
+
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
13
|
+
gem.files = `git ls-files`.split("\n")
|
14
|
+
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
15
|
+
gem.name = "omniauth-sageone"
|
16
|
+
gem.require_paths = ["lib"]
|
17
|
+
gem.version = OmniAuth::SageOne::VERSION
|
18
|
+
|
19
|
+
gem.add_dependency 'omniauth', '~> 1.0'
|
20
|
+
gem.add_dependency 'omniauth-oauth2', '~> 1.0'
|
21
|
+
gem.add_development_dependency 'rspec', '~> 2.7'
|
22
|
+
gem.add_development_dependency 'rack-test'
|
23
|
+
gem.add_development_dependency 'simplecov'
|
24
|
+
gem.add_development_dependency 'webmock'
|
25
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
$:.unshift File.expand_path('..', __FILE__)
|
2
|
+
$:.unshift File.expand_path('../../lib', __FILE__)
|
3
|
+
require 'simplecov'
|
4
|
+
SimpleCov.start
|
5
|
+
require 'rspec'
|
6
|
+
require 'rack/test'
|
7
|
+
require 'webmock/rspec'
|
8
|
+
require 'omniauth'
|
9
|
+
require 'omniauth-sageone'
|
10
|
+
|
11
|
+
RSpec.configure do |config|
|
12
|
+
config.include WebMock::API
|
13
|
+
config.include Rack::Test::Methods
|
14
|
+
config.extend OmniAuth::Test::StrategyMacros, :type => :strategy
|
15
|
+
end
|
metadata
ADDED
@@ -0,0 +1,143 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: omniauth-sageone
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jared Moody
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-05-18 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.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '2.7'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2.7'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rack-test
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: simplecov
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: webmock
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
description: OmniAuth strategy for SageOne.
|
98
|
+
email:
|
99
|
+
- jared@jetbuilt.com
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- .gitignore
|
105
|
+
- .rspec
|
106
|
+
- Gemfile
|
107
|
+
- Guardfile
|
108
|
+
- LICENSE
|
109
|
+
- README.md
|
110
|
+
- Rakefile
|
111
|
+
- lib/omniauth-sageone.rb
|
112
|
+
- lib/omniauth-sageone/version.rb
|
113
|
+
- lib/omniauth/strategies/sage_one.rb
|
114
|
+
- omniauth-sageone.gemspec
|
115
|
+
- spec/omniauth/strategies/sageone_spec.rb
|
116
|
+
- spec/spec_helper.rb
|
117
|
+
homepage: https://github.com/jetbuilt/omniauth-sageone
|
118
|
+
licenses:
|
119
|
+
- MIT
|
120
|
+
metadata: {}
|
121
|
+
post_install_message:
|
122
|
+
rdoc_options: []
|
123
|
+
require_paths:
|
124
|
+
- lib
|
125
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
126
|
+
requirements:
|
127
|
+
- - '>='
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: '0'
|
130
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
131
|
+
requirements:
|
132
|
+
- - '>='
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: '0'
|
135
|
+
requirements: []
|
136
|
+
rubyforge_project:
|
137
|
+
rubygems_version: 2.0.14.1
|
138
|
+
signing_key:
|
139
|
+
specification_version: 4
|
140
|
+
summary: OmniAuth strategy for SageOne.
|
141
|
+
test_files:
|
142
|
+
- spec/omniauth/strategies/sageone_spec.rb
|
143
|
+
- spec/spec_helper.rb
|