omniauth-zenpayroll 0.0.9 → 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 +5 -13
- data/README.md +25 -1
- data/lib/omniauth-zenpayroll/version.rb +1 -1
- data/lib/omniauth/strategies/zenpayroll.rb +5 -9
- metadata +16 -16
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
ODJkNTkyYjM2NTIzYWMzOTIwOGQ3YzJiNmQ3MTU5ZTNmZjdmOTAxMw==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 97c55cf7f69277c91d0ffdff83579b0829d0c9b6
|
4
|
+
data.tar.gz: 957cc37d144f7fc46843041aed3b17c87ee02446
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
OWIzMzE0MjUzZWYyMGQ0M2FlY2RhNTgwYjRjOTlkM2EyMWRiNzZiZWQyMzdl
|
11
|
-
OTQxNjk4MDcwMTllOTg1NTk2Y2JhYWY3YTdiNzVhYzY4ZjFiYmY=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
Y2FlNGY1ZDZjNWI0M2EwZmI4ZDUzN2Q3ZjFhN2IxZTQ4ZjhmNDY5MzMyOGM5
|
14
|
-
MzI1MmRkOTE1ZjYwNTMxNjg2YjQxMGY0N2QwNjE0OTFkNDA3NWRhYzZmZGQ1
|
15
|
-
ZjhjMmE4MWFhYWJmYjc3ZjFiN2ZjOTU2NThmNjhiY2NkYTVjZDA=
|
6
|
+
metadata.gz: b343ae6ec69ef022f8f402fc5f4e3fcd3c6753c6603f83c68e32c3babef1ad787713bae7be493ef2a7397e6f4101cb7d4085592cb4a54ed5015997ca774717ff
|
7
|
+
data.tar.gz: 0266452622b7b39879c0e4c4a6a3f11feca8ef66736ba68805fc408d2293582438afa12a2377e72d6e775bfad48abcd22fccd73a3e50fcfa00cd4d76af5aaadd
|
data/README.md
CHANGED
@@ -20,6 +20,8 @@ your application will use these to authenticate against the ZenPayroll API.
|
|
20
20
|
|
21
21
|
## Using This Strategy
|
22
22
|
|
23
|
+
##### Installation
|
24
|
+
|
23
25
|
Add the gem to your Gemfile:
|
24
26
|
|
25
27
|
```ruby
|
@@ -32,6 +34,8 @@ If you need to use the latest HEAD version, you can do so with:
|
|
32
34
|
gem 'omniauth-zenpayroll', :github => 'shiftdock/omniauth-zenpayroll'
|
33
35
|
```
|
34
36
|
|
37
|
+
##### Usage
|
38
|
+
|
35
39
|
Next, tell OmniAuth about this provider. For a Rails app, your `config/initializers/omniauth.rb` file should look like this:
|
36
40
|
|
37
41
|
```ruby
|
@@ -42,15 +46,35 @@ end
|
|
42
46
|
|
43
47
|
Replace `CLIENT_ID` and `CLIENT_SECRET` with the appropriate values you obtained from ZenPayroll earlier.
|
44
48
|
|
49
|
+
##### Configuration: The Redirect URI
|
50
|
+
|
45
51
|
If you need to override the Redirect URI (i.e. if yours deviates from the default) you can do so by setting it as the
|
46
52
|
`callback_url` in an `authorize_params` options hash.
|
47
53
|
|
48
54
|
```ruby
|
49
55
|
Rails.application.config.middleware.user OmniAuth:Builder do
|
50
|
-
provider :zenpayroll, "CLIENT_ID", "CLIENT_SECRET",
|
56
|
+
provider :zenpayroll, "CLIENT_ID", "CLIENT_SECRET",
|
57
|
+
:authorize_params => {:callback_url => '/my/app/callback/url'}
|
51
58
|
end
|
52
59
|
```
|
53
60
|
|
61
|
+
##### Configuration: Live vs. Demo
|
62
|
+
|
63
|
+
ZenPayroll provide a demo site at `zenpayroll-demo.com` for all testing. You'll usually want every environment but
|
64
|
+
the production environment to use this API instead of the live one. The `setup` option allows you to use a `lambda` to
|
65
|
+
pick which API you want based on the Rails environment:
|
66
|
+
|
67
|
+
```ruby
|
68
|
+
Rails.application.config.middleware.user OmniAuth:Builder do
|
69
|
+
provider :zenpayroll, "CLIENT_ID", "CLIENT_SECRET",
|
70
|
+
:authorize_params => {:callback_url => '/my/app/callback/url'},
|
71
|
+
:setup => lambda { |env| env['omniauth.strategy'].options[:client_options][:site] = Rails.env.production? ? 'https://zenpayroll.com/' : 'https://zenpayroll-demo.com/' }
|
72
|
+
end
|
73
|
+
```
|
74
|
+
|
75
|
+
Of course you could use anything; e.g. a global configuration file or environment variables, but this is probably the
|
76
|
+
most common use case.
|
77
|
+
|
54
78
|
#### UID Gotcha
|
55
79
|
|
56
80
|
As the ZenPayroll API doesn't expose a unique ID for the user being authenticated we have to use their email address
|
@@ -6,19 +6,15 @@ module OmniAuth
|
|
6
6
|
class ZenPayroll < OmniAuth::Strategies::OAuth2
|
7
7
|
|
8
8
|
option :name, 'zenpayroll'
|
9
|
-
|
9
|
+
|
10
10
|
option :client_options, { authorize_url: '/oauth/authorize',
|
11
11
|
token_url: '/oauth/token',
|
12
12
|
site: 'https://zenpayroll.com/' }
|
13
|
-
|
13
|
+
|
14
14
|
option :token_params, {
|
15
15
|
parse: :json,
|
16
16
|
grant_type: 'authorization_code'
|
17
17
|
}
|
18
|
-
=======
|
19
|
-
option :client_options, {:authorize_path => '/oauth/authorize',
|
20
|
-
:site => 'https://zenpayroll-demo.com'}
|
21
|
-
>>>>>>> df6131f... First stage authentication routing works
|
22
18
|
|
23
19
|
option :auth_token_params, {
|
24
20
|
param_name: 'access_token',
|
@@ -36,13 +32,13 @@ module OmniAuth
|
|
36
32
|
extra do
|
37
33
|
{ :raw_info => raw_info }
|
38
34
|
end
|
39
|
-
|
35
|
+
|
40
36
|
# ZenPayroll are strict on redirect_uri.
|
41
37
|
# Pass 'origin=...' as parameter to provider url to pass through.
|
42
38
|
def callback_url
|
43
39
|
options.authorize_params.callback_url or super
|
44
40
|
end
|
45
|
-
|
41
|
+
|
46
42
|
def request_phase
|
47
43
|
redirect client.auth_code.authorize_url({:redirect_uri => callback_url}.merge(options.authorize_params))
|
48
44
|
end
|
@@ -64,7 +60,7 @@ module OmniAuth
|
|
64
60
|
client_id: client.id,
|
65
61
|
client_secret: client.secret
|
66
62
|
})
|
67
|
-
|
63
|
+
|
68
64
|
client.get_token(token_params, deep_symbolize(options.auth_token_params))
|
69
65
|
end
|
70
66
|
end
|
metadata
CHANGED
@@ -1,83 +1,83 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-zenpayroll
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John M. Hope
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-09-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.3'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.3'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: omniauth-oauth2
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 1.1.1
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 1.1.1
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rack-test
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: simplecov
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: webmock
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
description: OmniAuth strategy for ZenPayroll
|
@@ -87,7 +87,7 @@ executables: []
|
|
87
87
|
extensions: []
|
88
88
|
extra_rdoc_files: []
|
89
89
|
files:
|
90
|
-
- .gitignore
|
90
|
+
- ".gitignore"
|
91
91
|
- Gemfile
|
92
92
|
- README.md
|
93
93
|
- Rakefile
|
@@ -105,17 +105,17 @@ require_paths:
|
|
105
105
|
- lib
|
106
106
|
required_ruby_version: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
112
112
|
requirements:
|
113
|
-
- -
|
113
|
+
- - ">="
|
114
114
|
- !ruby/object:Gem::Version
|
115
115
|
version: '0'
|
116
116
|
requirements: []
|
117
117
|
rubyforge_project: omniauth-zenpayroll
|
118
|
-
rubygems_version: 2.
|
118
|
+
rubygems_version: 2.4.5
|
119
119
|
signing_key:
|
120
120
|
specification_version: 4
|
121
121
|
summary: OmniAuth strategy for ZenPayroll
|