monk-id 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/.editorconfig +14 -0
- data/.gitattributes +1 -0
- data/.rspec +2 -0
- data/.rubocop.yml +1 -0
- data/.travis.yml +6 -0
- data/Gemfile +3 -1
- data/Guardfile +13 -0
- data/LICENSE +22 -0
- data/README.md +75 -16
- data/Rakefile +9 -0
- data/circle.yml +8 -0
- data/lib/monk/id.rb +52 -40
- data/lib/monk/id/version.rb +8 -1
- data/monk-id.gemspec +19 -7
- data/spec/config/monk_id.yml +15 -0
- data/spec/config/monk_id_alt.yml +6 -0
- data/spec/config/monk_id_invalid.yml +1 -0
- data/spec/helpers.rb +107 -0
- data/spec/lib/monk/id/version_spec.rb +9 -0
- data/spec/lib/monk/id_spec.rb +229 -0
- data/spec/spec_helper.rb +29 -0
- metadata +146 -12
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MGI0YWFmMzVhYWI1NGFjMGZmYTdlMmI5ZDhkZDE2Yzc2OTdlOTg3MA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZTBmZDQ2ZGZkOGNkY2Q2NzRmNzNhZTM3ZTgxMzE2NDJmZDhiNzNjMA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MmQzYTYwN2UwYjA0MWVjZGE3YTQxZTU1ZDg1NTdmY2NlOGY3OTg1MDA2NTg1
|
10
|
+
YTVlMThmY2E1MTFhZjcyYzhjNDM1MjJhNmYwOTgyYjYwNDA0ODlkMWE3OGJj
|
11
|
+
NDM4M2RhNDQyZmNjYTkzNGYxNWI0MDEyODA4ZWViODAwNDhmOGE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZWY1OGU2YWI0ZDY3NzFhYmFjYzhjMjFlMDQwMzc1MGZiZDg2OTFhOGFlYjUw
|
14
|
+
YzQyMDcxNzllOTk0NTJlNTg0Yjg4M2U0NmJhYjVjMGVmOTk5M2ViMzg0MWQy
|
15
|
+
Y2FkYjM1MjgyMmNhNDVhMDhlZDhmYTEwMzljOTBlY2VmMDY0MjY=
|
data/.editorconfig
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# EditorConfig: http://editorconfig.org
|
2
|
+
|
3
|
+
root = true
|
4
|
+
|
5
|
+
[*]
|
6
|
+
indent_style = space
|
7
|
+
indent_size = 2
|
8
|
+
end_of_line = lf
|
9
|
+
charset = utf-8
|
10
|
+
trim_trailing_whitespace = true
|
11
|
+
insert_final_newline = true
|
12
|
+
|
13
|
+
[*.md]
|
14
|
+
trim_trailing_whitespace = false
|
data/.gitattributes
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
* text=auto
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require: rubocop-rspec
|
data/.travis.yml
ADDED
data/Gemfile
CHANGED
data/Guardfile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
guard :rspec, cmd: 'bundle exec rspec' do
|
4
|
+
watch(/^spec\/.+_spec\.rb$/)
|
5
|
+
watch(/^lib\/(.+)\.rb$/) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
6
|
+
watch('spec/helpers.rb') { 'spec' }
|
7
|
+
watch('spec/spec_helper.rb') { 'spec' }
|
8
|
+
end
|
9
|
+
|
10
|
+
guard :rubocop do
|
11
|
+
watch(/.+\.rb$/)
|
12
|
+
watch(/(?:.+\/)?\.rubocop\.yml$/) { |m| File.dirname(m[0]) }
|
13
|
+
end
|
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Monk Development, Inc.
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person
|
4
|
+
obtaining a copy of this software and associated documentation
|
5
|
+
files (the "Software"), to deal in the Software without
|
6
|
+
restriction, including without limitation the rights to use,
|
7
|
+
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
+
copies of the Software, and to permit persons to whom the
|
9
|
+
Software is furnished to do so, subject to the following
|
10
|
+
conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be
|
13
|
+
included in all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
17
|
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
19
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
20
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
21
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
22
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -2,6 +2,11 @@ Monk ID Ruby
|
|
2
2
|
============
|
3
3
|
|
4
4
|
[![Gem Version](https://badge.fury.io/rb/monk-id.png)](http://badge.fury.io/rb/monk-id)
|
5
|
+
[![Build Status](https://travis-ci.org/MonkDev/monk-id-ruby.svg?branch=dev)](https://travis-ci.org/MonkDev/monk-id-ruby)
|
6
|
+
[![Code Climate](https://codeclimate.com/github/MonkDev/monk-id-ruby.png)](https://codeclimate.com/github/MonkDev/monk-id-ruby)
|
7
|
+
[![Coverage Status](https://coveralls.io/repos/MonkDev/monk-id-ruby/badge.png?branch=dev)](https://coveralls.io/r/MonkDev/monk-id-ruby?branch=dev)
|
8
|
+
[![Inline docs](http://inch-ci.org/github/MonkDev/monk-id-ruby.png)](http://inch-ci.org/github/MonkDev/monk-id-ruby)
|
9
|
+
[![Dependency Status](https://gemnasium.com/MonkDev/monk-id-ruby.svg)](https://gemnasium.com/MonkDev/monk-id-ruby)
|
5
10
|
|
6
11
|
Integrate Monk ID authentication and single sign-on for apps and websites on the
|
7
12
|
server-side.
|
@@ -24,7 +29,7 @@ integration.
|
|
24
29
|
Add the gem to your `Gemfile` if using [Bundler](http://bundler.io):
|
25
30
|
|
26
31
|
```ruby
|
27
|
-
gem 'monk-id'
|
32
|
+
gem 'monk-id', '~> 1.0'
|
28
33
|
```
|
29
34
|
|
30
35
|
```bash
|
@@ -93,41 +98,82 @@ and verified.
|
|
93
98
|
Development
|
94
99
|
-----------
|
95
100
|
|
96
|
-
|
101
|
+
[Bundler](http://bundler.io) is used heavily for development, so be sure to have
|
102
|
+
it installed along with a version of Ruby.
|
103
|
+
|
104
|
+
Once those are installed and working, installing the development dependencies:
|
97
105
|
|
98
106
|
```bash
|
99
107
|
$ bundle
|
100
108
|
```
|
101
109
|
|
102
110
|
This requires all subsequent commands be prepended with `bundle exec`, which has
|
103
|
-
been ommitted for conciseness.
|
111
|
+
been ommitted for conciseness going forward.
|
112
|
+
|
113
|
+
### Workflow
|
104
114
|
|
105
|
-
|
106
|
-
|
107
|
-
an app or website that integrates it already. There are a few ways to do this.
|
115
|
+
[Rake](https://github.com/jimweirich/rake) is setup to run the tests and check
|
116
|
+
code quality by default:
|
108
117
|
|
109
|
-
|
118
|
+
```bash
|
119
|
+
$ rake
|
120
|
+
```
|
121
|
+
|
122
|
+
[Guard](http://guardgem.org) takes it a step further and automatically runs the
|
123
|
+
appropriate tasks on file change:
|
124
|
+
|
125
|
+
```bash
|
126
|
+
$ guard
|
127
|
+
```
|
128
|
+
|
129
|
+
It's recommended to run Guard during development.
|
130
|
+
|
131
|
+
### Tests
|
132
|
+
|
133
|
+
Testing is done with [RSpec](https://relishapp.com/rspec). To run the tests:
|
134
|
+
|
135
|
+
```bash
|
136
|
+
$ rake spec
|
137
|
+
```
|
138
|
+
|
139
|
+
[SimpleCov](https://github.com/colszowka/simplecov) automatically generates a
|
140
|
+
code coverage report to the `coverage` directory on every run of the test suite.
|
141
|
+
|
142
|
+
Continuous integration is setup through [Travis CI](https://travis-ci.org/MonkDev/monk-id-ruby)
|
143
|
+
to run the tests against Ruby v1.9.3, v2.0.0, and v2.1.1.
|
144
|
+
([Circle CI](https://circleci.com/gh/MonkDev/monk-id-ruby) is also setup to run
|
145
|
+
the tests against Ruby v1.9.3, but is backup for now until multiple versions can
|
146
|
+
easily be specified.) The SimpleCov results are sent to [Coveralls](https://coveralls.io/r/MonkDev/monk-id-ruby)
|
147
|
+
during CI for tracking over time. Badges for both are dispayed at the top of
|
148
|
+
this README.
|
149
|
+
|
150
|
+
#### Manual
|
151
|
+
|
152
|
+
While the test suite is complete, it's not a bad idea to also test changes
|
153
|
+
manually in real-world integrations.
|
154
|
+
|
155
|
+
##### With Bundler
|
110
156
|
|
111
157
|
Not to be confused with the fact that Bundler is used for development of this
|
112
158
|
library, if Bundler is used in the test app or website, you can either specify a
|
113
159
|
path to the library locally:
|
114
160
|
|
115
161
|
```ruby
|
116
|
-
gem 'monk-id', :
|
162
|
+
gem 'monk-id', path: '/path/to/monk-id-ruby'
|
117
163
|
```
|
118
164
|
|
119
165
|
Or configure Bundler to use a local repository instead of the GitHub repository
|
120
|
-
(more details [in the documentation](http://bundler.io/v1.
|
166
|
+
(more details [in the documentation](http://bundler.io/v1.7/git.html#local)):
|
121
167
|
|
122
168
|
```ruby
|
123
|
-
gem 'monk-id', :
|
169
|
+
gem 'monk-id', github: 'MonkDev/monk-id-ruby', branch: 'master'
|
124
170
|
```
|
125
171
|
|
126
172
|
```bash
|
127
173
|
$ bundle config local.monk-id /path/to/monk-id-ruby
|
128
174
|
```
|
129
175
|
|
130
|
-
|
176
|
+
#### Without Bundler
|
131
177
|
|
132
178
|
If Bundler is not used, you can either build and install the gem as a system
|
133
179
|
gem (this must be done for every change):
|
@@ -155,16 +201,30 @@ you can preview as you document by starting the YARD server:
|
|
155
201
|
$ yard server --reload
|
156
202
|
```
|
157
203
|
|
158
|
-
This hosts the documentation at http://localhost:8808
|
159
|
-
for changes on page refresh.
|
204
|
+
This hosts the documentation at [http://localhost:8808](http://localhost:8808)
|
205
|
+
and automatically watches for changes on page refresh.
|
160
206
|
|
161
|
-
The documentation can also be built to
|
207
|
+
The documentation can also be built to the `doc` directory (that is ignored by
|
162
208
|
git):
|
163
209
|
|
164
210
|
```bash
|
165
211
|
$ yard
|
166
212
|
```
|
167
213
|
|
214
|
+
### Quality
|
215
|
+
|
216
|
+
[RuboCop](https://github.com/bbatsov/rubocop) is configured to enforce the
|
217
|
+
[Ruby Style Guide](https://github.com/bbatsov/ruby-style-guide). While Guard is
|
218
|
+
setup to run it automatically on file change, it can also be run manually:
|
219
|
+
|
220
|
+
```bash
|
221
|
+
$ rake quality
|
222
|
+
```
|
223
|
+
|
224
|
+
[Code Climate](https://codeclimate.com/github/MonkDev/monk-id-ruby) is setup to
|
225
|
+
perform continuous code quality inspection. The quality badge is displayed at
|
226
|
+
the top of this README.
|
227
|
+
|
168
228
|
Deployment
|
169
229
|
----------
|
170
230
|
|
@@ -180,8 +240,7 @@ These steps can be executed individually, but it's easiest to do all at once:
|
|
180
240
|
$ gem bump --version major|minor|patch --tag --release
|
181
241
|
```
|
182
242
|
|
183
|
-
Be sure to choose the correct version by following
|
184
|
-
[Semantic Versioning](http://semver.org).
|
243
|
+
Be sure to choose the correct version by following [Semantic Versioning](http://semver.org).
|
185
244
|
|
186
245
|
### Publish Documentation
|
187
246
|
|
data/Rakefile
CHANGED
data/circle.yml
ADDED
data/lib/monk/id.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
1
3
|
require 'base64'
|
2
4
|
require 'json'
|
3
5
|
require 'openssl'
|
@@ -38,9 +40,9 @@ module Monk
|
|
38
40
|
|
39
41
|
config = YAML.load_file(path)[environment]
|
40
42
|
|
41
|
-
|
43
|
+
valid_config?(config)
|
42
44
|
|
43
|
-
|
45
|
+
@config = config
|
44
46
|
end
|
45
47
|
|
46
48
|
# Get a config value. Attempts to load the config if it hasn't already
|
@@ -50,34 +52,30 @@ module Monk
|
|
50
52
|
# @raise [StandardError] If the config can't be loaded.
|
51
53
|
# @return [*] Config value.
|
52
54
|
def config(key)
|
53
|
-
load_config unless
|
55
|
+
load_config unless @config
|
54
56
|
|
55
|
-
|
57
|
+
@config[key]
|
56
58
|
end
|
57
59
|
|
58
60
|
# Load a payload from the client-side.
|
59
61
|
#
|
60
62
|
# @param encoded_payload [String, #[]] Encoded payload or Hash-like
|
61
63
|
# cookies object to automatically load the payload from.
|
62
|
-
# @return [Hash<Symbol>] Decoded and
|
63
|
-
# payload or it fails
|
64
|
+
# @return [Hash<Symbol>] Decoded and validate payload. Empty if there's no
|
65
|
+
# payload or it fails validation.
|
64
66
|
def load_payload(encoded_payload = nil)
|
65
|
-
|
66
|
-
payload = encoded_payload
|
67
|
-
elsif encoded_payload.respond_to? :[]
|
68
|
-
payload = encoded_payload[COOKIE_NAME]
|
69
|
-
end
|
67
|
+
payload = select_payload(encoded_payload)
|
70
68
|
|
71
|
-
return
|
69
|
+
return @payload = {} unless payload
|
72
70
|
|
73
71
|
begin
|
74
72
|
payload = decode_payload(payload)
|
75
|
-
|
73
|
+
valid = valid_payload?(payload)
|
76
74
|
rescue
|
77
|
-
|
75
|
+
valid = false
|
78
76
|
end
|
79
77
|
|
80
|
-
|
78
|
+
@payload = valid ? payload : {}
|
81
79
|
end
|
82
80
|
|
83
81
|
# Get the signed in user's UUID.
|
@@ -85,7 +83,7 @@ module Monk
|
|
85
83
|
# @return [String] If signed in user.
|
86
84
|
# @return [nil] If no signed in user.
|
87
85
|
def user_id
|
88
|
-
payload_user
|
86
|
+
payload_user(:id)
|
89
87
|
end
|
90
88
|
|
91
89
|
# Get the signed in user's email address.
|
@@ -93,27 +91,27 @@ module Monk
|
|
93
91
|
# @return [String] If signed in user.
|
94
92
|
# @return [nil] If no signed in user.
|
95
93
|
def user_email
|
96
|
-
payload_user
|
94
|
+
payload_user(:email)
|
97
95
|
end
|
98
96
|
|
99
97
|
# Check whether there's a signed in user.
|
100
98
|
#
|
101
99
|
# @return [Boolean] Whether there's a signed in user.
|
102
100
|
def signed_in?
|
103
|
-
|
101
|
+
!user_id.nil?
|
104
102
|
end
|
105
103
|
|
106
|
-
|
104
|
+
protected
|
107
105
|
|
108
106
|
# Loaded config values.
|
109
|
-
|
107
|
+
@config = nil
|
110
108
|
|
111
109
|
# Loaded payload.
|
112
|
-
|
110
|
+
@payload = nil
|
113
111
|
|
114
112
|
# Get the path to the config file from the environment. Supports `ENV`
|
115
113
|
# variable, Rails, and Sinatra.
|
116
|
-
#
|
114
|
+
#
|
117
115
|
# @return [String] Path to the config file.
|
118
116
|
# @return [nil] If not set by the environment.
|
119
117
|
def config_path_from_environment
|
@@ -128,7 +126,7 @@ module Monk
|
|
128
126
|
|
129
127
|
# Get the environment to load within the config. Supports `ENV` variable,
|
130
128
|
# Rails, and Sinatra. Defaults to `development` if none specify.
|
131
|
-
#
|
129
|
+
#
|
132
130
|
# @return [String] Environment name.
|
133
131
|
def config_environment
|
134
132
|
if ENV['MONK_ID_ENV']
|
@@ -142,26 +140,40 @@ module Monk
|
|
142
140
|
end
|
143
141
|
end
|
144
142
|
|
145
|
-
#
|
143
|
+
# Validate that a config has all the required values.
|
146
144
|
#
|
147
145
|
# @param config [Hash<String>] Config values.
|
148
146
|
# @raise [RuntimeError] If invalid.
|
149
147
|
# @return [true] If valid.
|
150
|
-
def
|
151
|
-
|
152
|
-
|
153
|
-
|
148
|
+
def valid_config?(config)
|
149
|
+
fail 'no config loaded' unless config
|
150
|
+
fail 'no `app_id` config value' unless config['app_id']
|
151
|
+
fail 'no `app_secret` config value' unless config['app_secret']
|
154
152
|
|
155
153
|
true
|
156
154
|
end
|
157
155
|
|
156
|
+
# Select a payload from the first place one can be found.
|
157
|
+
#
|
158
|
+
# @param encoded_payload [String, #[]] Encoded payload or Hash-like
|
159
|
+
# cookies object to select the payload from.
|
160
|
+
# @return [String] Encoded payload.
|
161
|
+
# @return [nil] If one can't be found.
|
162
|
+
def select_payload(encoded_payload)
|
163
|
+
if encoded_payload.is_a? String
|
164
|
+
encoded_payload
|
165
|
+
elsif encoded_payload.respond_to? :[]
|
166
|
+
encoded_payload[COOKIE_NAME]
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
158
170
|
# Decode a payload from the client-side.
|
159
171
|
#
|
160
172
|
# @param encoded_payload [String] Encoded payload.
|
161
173
|
# @raise [JSON::ParserError] If invalid JSON.
|
162
174
|
# @return [Hash<Symbol>] Decoded payload.
|
163
175
|
def decode_payload(encoded_payload)
|
164
|
-
JSON.parse(Base64.decode64(encoded_payload), :
|
176
|
+
JSON.parse(Base64.decode64(encoded_payload), symbolize_names: true)
|
165
177
|
end
|
166
178
|
|
167
179
|
# Generate the expected signature of a payload using the app's secret.
|
@@ -172,15 +184,19 @@ module Monk
|
|
172
184
|
payload_clone = payload.clone
|
173
185
|
payload_clone[:user].delete(:signature)
|
174
186
|
|
175
|
-
OpenSSL::HMAC.digest(
|
187
|
+
OpenSSL::HMAC.digest(
|
188
|
+
OpenSSL::Digest::SHA512.new,
|
189
|
+
config('app_secret'),
|
190
|
+
JSON.generate(payload_clone[:user])
|
191
|
+
)
|
176
192
|
end
|
177
193
|
|
178
|
-
#
|
194
|
+
# Validate that a payload hasn't been tampered with or faked by comparing
|
179
195
|
# signatures.
|
180
196
|
#
|
181
197
|
# @param payload [Hash<Symbol>] Decoded payload.
|
182
|
-
# @return [Boolean] Whether the payload is
|
183
|
-
def
|
198
|
+
# @return [Boolean] Whether the payload is valid.
|
199
|
+
def valid_payload?(payload)
|
184
200
|
signature = Base64.decode64(payload[:user][:signature])
|
185
201
|
|
186
202
|
signature == expected_signature(payload)
|
@@ -189,9 +205,9 @@ module Monk
|
|
189
205
|
# Get the loaded payload.
|
190
206
|
#
|
191
207
|
# @return [Hash<Symbol>] Loaded payload. Empty if there's no payload or it
|
192
|
-
# failed
|
208
|
+
# failed validation.
|
193
209
|
def payload
|
194
|
-
|
210
|
+
@payload || load_payload
|
195
211
|
end
|
196
212
|
|
197
213
|
# Get a value from the `user` hash of the loaded payload.
|
@@ -201,11 +217,7 @@ module Monk
|
|
201
217
|
def payload_user(key)
|
202
218
|
payload = self.payload
|
203
219
|
|
204
|
-
|
205
|
-
payload[:user][key]
|
206
|
-
else
|
207
|
-
nil
|
208
|
-
end
|
220
|
+
payload.key?(:user) ? payload[:user][key] : nil
|
209
221
|
end
|
210
222
|
end
|
211
223
|
end
|
data/lib/monk/id/version.rb
CHANGED
@@ -1,6 +1,13 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
# Global Monk namespace.
|
1
4
|
module Monk
|
5
|
+
# Integrate Monk ID on the server-side by accessing payloads from the
|
6
|
+
# client-side JavaScript.
|
7
|
+
#
|
8
|
+
# @author Monk Development, Inc.
|
2
9
|
module Id
|
3
10
|
# Current version of the library.
|
4
|
-
VERSION = '1.1.
|
11
|
+
VERSION = '1.1.1'.freeze
|
5
12
|
end
|
6
13
|
end
|
data/monk-id.gemspec
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
#
|
1
|
+
# encoding: utf-8
|
2
|
+
|
2
3
|
lib = File.expand_path('../lib', __FILE__)
|
3
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
5
|
require 'monk/id/version'
|
@@ -8,19 +9,30 @@ Gem::Specification.new do |spec|
|
|
8
9
|
spec.version = Monk::Id::VERSION.dup
|
9
10
|
spec.authors = ['Monk Development, Inc.']
|
10
11
|
spec.email = ['support@monkdevelopment.com']
|
11
|
-
spec.summary = 'Integrate Monk ID authentication and single sign-on
|
12
|
+
spec.summary = 'Integrate Monk ID authentication and single sign-on ' \
|
13
|
+
'for apps and websites on the server-side.'
|
12
14
|
spec.description = spec.summary
|
13
15
|
spec.homepage = 'https://github.com/MonkDev/monk-id-ruby'
|
14
16
|
spec.license = 'MIT'
|
15
17
|
|
16
18
|
spec.files = `git ls-files -z`.split("\x0")
|
17
|
-
spec.executables = spec.files.grep(
|
18
|
-
spec.test_files = spec.files.grep(
|
19
|
+
spec.executables = spec.files.grep(/^bin\//) { |f| File.basename(f) }
|
20
|
+
spec.test_files = spec.files.grep(/^(test|spec|features)\//)
|
19
21
|
spec.require_paths = ['lib']
|
20
22
|
|
21
|
-
spec.
|
23
|
+
spec.required_ruby_version = '>= 1.9.3'
|
24
|
+
|
25
|
+
spec.add_development_dependency 'bundler', '~> 1.6'
|
26
|
+
spec.add_development_dependency 'coveralls', '~> 0.7'
|
22
27
|
spec.add_development_dependency 'gem-release', '~> 0.7'
|
23
|
-
spec.add_development_dependency '
|
24
|
-
spec.add_development_dependency '
|
28
|
+
spec.add_development_dependency 'guard', '~> 2.6'
|
29
|
+
spec.add_development_dependency 'guard-rspec', '~> 4.3'
|
30
|
+
spec.add_development_dependency 'guard-rubocop', '~> 1.1'
|
31
|
+
spec.add_development_dependency 'rake', '~> 10.3'
|
25
32
|
spec.add_development_dependency 'redcarpet', '~> 3.1'
|
33
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
34
|
+
spec.add_development_dependency 'rubocop', '~> 0.25'
|
35
|
+
spec.add_development_dependency 'rubocop-rspec', '~> 1.2'
|
36
|
+
spec.add_development_dependency 'simplecov', '~> 0.9'
|
37
|
+
spec.add_development_dependency 'yard', '~> 0.8'
|
26
38
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
test:
|
2
|
+
app_id: ca13c9d1-6600-490e-a448-adb99e2eb906
|
3
|
+
app_secret: 98d7ac3f9e22e52f9f23b83ca791db055acad39a27e17dc7
|
4
|
+
|
5
|
+
development:
|
6
|
+
app_id: development_app_id
|
7
|
+
app_secret: development_app_secret
|
8
|
+
|
9
|
+
rails:
|
10
|
+
app_id: rails_app_id
|
11
|
+
app_secret: rails_app_secret
|
12
|
+
|
13
|
+
sinatra:
|
14
|
+
app_id: sinatra_app_id
|
15
|
+
app_secret: sinatra_app_secret
|
@@ -0,0 +1 @@
|
|
1
|
+
invalid
|
data/spec/helpers.rb
ADDED
@@ -0,0 +1,107 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
# Helpers that are included in every spec.
|
4
|
+
module Helpers
|
5
|
+
def spec_path
|
6
|
+
File.expand_path(File.dirname(__FILE__))
|
7
|
+
end
|
8
|
+
|
9
|
+
def config_path
|
10
|
+
"#{spec_path}/config"
|
11
|
+
end
|
12
|
+
|
13
|
+
def config_file_path
|
14
|
+
"#{config_path}/monk_id.yml"
|
15
|
+
end
|
16
|
+
|
17
|
+
def config_file_alt_path
|
18
|
+
"#{config_path}/monk_id_alt.yml"
|
19
|
+
end
|
20
|
+
|
21
|
+
def valid_payload
|
22
|
+
'eyJ1c2VyIjp7ImVtYWlsIjoianN0YXl0b25AbW9ua2RldmVsb3BtZW50LmNvbSIsImlkIjoi' \
|
23
|
+
'NjJjOTg4YmEtMTNkOC00NzNlLWFkZWItOGY3ZDJjNjI4NDZhIiwic2lnbmF0dXJlIjoiOWlG' \
|
24
|
+
'YStLWHlTZTEvS29uM0hXRitLZlRQVDJ2MVl3QyttVEFBQko0QXpsRWZkNmR0UG1HWWpVend2' \
|
25
|
+
'OUtYXG5vbXJreWFMQi9oQjcrWExHQW41OTlLKzlFdz09XG4ifX0='
|
26
|
+
end
|
27
|
+
|
28
|
+
def expected_payload
|
29
|
+
{
|
30
|
+
user: {
|
31
|
+
id: '62c988ba-13d8-473e-adeb-8f7d2c62846a',
|
32
|
+
email: 'jstayton@monkdevelopment.com'
|
33
|
+
}
|
34
|
+
}
|
35
|
+
end
|
36
|
+
|
37
|
+
def invalid_payload
|
38
|
+
'eyJ1c2VyIjp7ImVtYWlsIjoianN0YXl0b25AbW9ua2RldmVsb3BtZW50LmNvbSIsImlkIjoi' \
|
39
|
+
'NjJjOTg4YmEtMTNkOC00NzNlLWFkZWItOGY3ZDJjNjI4NDZhIiwic2lnbmF0dXJlIjoiUlRG' \
|
40
|
+
'cXhIK3dPbzh4V0JGQko0cTNTRnVSc3VOTWxUTE5iak1wTjBFclYxNzh0U3pwS2VlU2J2T29S' \
|
41
|
+
'QzNUXG4zVTkxVCtLK3FQc3JoMjVycEN5QVMrYlFEdz09XG4ifX0='
|
42
|
+
end
|
43
|
+
|
44
|
+
def reset_payload
|
45
|
+
Monk::Id.instance_variable_set(:@payload, nil)
|
46
|
+
end
|
47
|
+
|
48
|
+
def config_env
|
49
|
+
'test'
|
50
|
+
end
|
51
|
+
|
52
|
+
def load_config
|
53
|
+
Monk::Id.load_config(config_file_path, config_env)
|
54
|
+
end
|
55
|
+
|
56
|
+
def expected_config(environment)
|
57
|
+
{
|
58
|
+
'app_id' => "#{environment}_app_id",
|
59
|
+
'app_secret' => "#{environment}_app_secret"
|
60
|
+
}
|
61
|
+
end
|
62
|
+
|
63
|
+
def expected_config_test
|
64
|
+
{
|
65
|
+
'app_id' => 'ca13c9d1-6600-490e-a448-adb99e2eb906',
|
66
|
+
'app_secret' => '98d7ac3f9e22e52f9f23b83ca791db055acad39a27e17dc7'
|
67
|
+
}
|
68
|
+
end
|
69
|
+
|
70
|
+
def set_config_env
|
71
|
+
ENV['MONK_ID_CONFIG'] = config_file_alt_path
|
72
|
+
ENV['MONK_ID_ENV'] = 'env'
|
73
|
+
end
|
74
|
+
|
75
|
+
def reset_config
|
76
|
+
Monk::Id.instance_variable_set(:@config, nil)
|
77
|
+
|
78
|
+
ENV['MONK_ID_CONFIG'] = nil
|
79
|
+
ENV['MONK_ID_ENV'] = nil
|
80
|
+
end
|
81
|
+
|
82
|
+
def mock_rails
|
83
|
+
Object.const_set(:Rails, Class.new)
|
84
|
+
|
85
|
+
allow(Rails).to receive(:root).and_return(spec_path)
|
86
|
+
allow(Rails).to receive(:env).and_return('rails')
|
87
|
+
end
|
88
|
+
|
89
|
+
def remove_rails
|
90
|
+
Object.send(:remove_const, :Rails)
|
91
|
+
end
|
92
|
+
|
93
|
+
def mock_sinatra
|
94
|
+
Object.const_set(:Sinatra, Module.new)
|
95
|
+
Sinatra.const_set(:Application, Module.new)
|
96
|
+
|
97
|
+
allow(Sinatra::Application)
|
98
|
+
.to receive_message_chain(:settings, :root).and_return(spec_path)
|
99
|
+
allow(Sinatra::Application)
|
100
|
+
.to receive_message_chain(:settings, :environment).and_return(:sinatra)
|
101
|
+
end
|
102
|
+
|
103
|
+
def remove_sinatra
|
104
|
+
Sinatra.send(:remove_const, :Application)
|
105
|
+
Object.send(:remove_const, :Sinatra)
|
106
|
+
end
|
107
|
+
end
|
@@ -0,0 +1,229 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe Monk::Id do
|
6
|
+
before(:all) { load_config }
|
7
|
+
|
8
|
+
describe '::CONFIG_FILE' do
|
9
|
+
it { expect(described_class::CONFIG_FILE).to eq('config/monk_id.yml') }
|
10
|
+
end
|
11
|
+
|
12
|
+
describe '::COOKIE_NAME' do
|
13
|
+
it { expect(described_class::COOKIE_NAME).to eq('_monkIdPayload') }
|
14
|
+
end
|
15
|
+
|
16
|
+
describe '.config' do
|
17
|
+
context 'when a config value is set' do
|
18
|
+
it 'returns the config value' do
|
19
|
+
expect(described_class.config('app_id'))
|
20
|
+
.to eq('ca13c9d1-6600-490e-a448-adb99e2eb906')
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
context 'when a config value is not set' do
|
25
|
+
it { expect(described_class.config('not_set')).to be_nil }
|
26
|
+
end
|
27
|
+
|
28
|
+
context 'when a config is not loaded' do
|
29
|
+
before(:each) { reset_config }
|
30
|
+
after(:all) { load_config }
|
31
|
+
|
32
|
+
it 'loads a config from the environment' do
|
33
|
+
set_config_env
|
34
|
+
|
35
|
+
expect(described_class.config('app_id')).to eq('env_app_id')
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
describe '.load_config' do
|
41
|
+
before(:each) { reset_config }
|
42
|
+
after(:all) { load_config }
|
43
|
+
|
44
|
+
describe '(path)' do
|
45
|
+
context 'when the path is specified' do
|
46
|
+
it 'loads the config file from the path' do
|
47
|
+
expect(described_class.load_config(config_file_path, config_env))
|
48
|
+
.to eq(expected_config_test)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
context 'when the path is not specified' do
|
53
|
+
it 'loads the config file from ENV["MONK_ID_CONFIG"]' do
|
54
|
+
set_config_env
|
55
|
+
|
56
|
+
expect(described_class.load_config(nil, 'env'))
|
57
|
+
.to eq(expected_config('env'))
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
context 'when the path does not exist' do
|
62
|
+
it do
|
63
|
+
path = '/does/not/exist.yml'
|
64
|
+
|
65
|
+
expect { described_class.load_config(path, config_env) }
|
66
|
+
.to raise_error(StandardError)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
describe '(environment)' do
|
72
|
+
context 'when the environment is specified' do
|
73
|
+
it 'loads the environment' do
|
74
|
+
expect(described_class.load_config(config_file_path, config_env))
|
75
|
+
.to eq(expected_config_test)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
context 'when the environment is not specified' do
|
80
|
+
it 'uses the environment from ENV["MONK_ID_ENV"]' do
|
81
|
+
set_config_env
|
82
|
+
|
83
|
+
expect(described_class.load_config(config_file_alt_path, nil))
|
84
|
+
.to eq(expected_config('env'))
|
85
|
+
end
|
86
|
+
|
87
|
+
it 'defaults to "development"' do
|
88
|
+
expect(described_class.load_config(config_file_path, nil))
|
89
|
+
.to eq(expected_config('development'))
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
context 'when the environment does not exist' do
|
94
|
+
it do
|
95
|
+
expect { described_class.load_config(config_file_path, 'invalid') }
|
96
|
+
.to raise_error(StandardError)
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
context 'when the environment is Rails' do
|
102
|
+
before(:each) { mock_rails }
|
103
|
+
after(:each) { remove_rails }
|
104
|
+
|
105
|
+
context 'when the path is not specified' do
|
106
|
+
it 'loads ::CONFIG_FILE relative to Rails' do
|
107
|
+
expect(described_class.load_config(nil, 'rails'))
|
108
|
+
.to eq(expected_config('rails'))
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
context 'when the environment is not specified' do
|
113
|
+
it 'uses the Rails environment' do
|
114
|
+
expect(described_class.load_config(config_file_path, nil))
|
115
|
+
.to eq(expected_config('rails'))
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
context 'when the environment is Sinatra' do
|
121
|
+
before(:each) { mock_sinatra }
|
122
|
+
after(:each) { remove_sinatra }
|
123
|
+
|
124
|
+
context 'when the path is not specified' do
|
125
|
+
it 'loads ::CONFIG_FILE relative to Sinatra' do
|
126
|
+
expect(described_class.load_config(nil, 'sinatra'))
|
127
|
+
.to eq(expected_config('sinatra'))
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
context 'when the environment is not specified' do
|
132
|
+
it 'uses the Sinatra environment' do
|
133
|
+
expect(described_class.load_config(config_file_path, nil))
|
134
|
+
.to eq(expected_config('sinatra'))
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
context 'when the config is not valid' do
|
140
|
+
it do
|
141
|
+
path = "#{config_path}/monk_id_invalid.yml"
|
142
|
+
|
143
|
+
expect { described_class.load_config(path, config_env) }
|
144
|
+
.to raise_error(StandardError)
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
context 'when a required config value is not set' do
|
149
|
+
it 'fails with a StandardError' do
|
150
|
+
error_message = 'no `app_secret` config value'
|
151
|
+
|
152
|
+
expect { described_class.load_config(config_file_alt_path, 'required') }
|
153
|
+
.to raise_error(StandardError, error_message)
|
154
|
+
end
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
describe '.load_payload' do
|
159
|
+
before(:each) { reset_payload }
|
160
|
+
after(:all) { reset_payload }
|
161
|
+
|
162
|
+
context 'when the payload is valid' do
|
163
|
+
context 'when the payload is a string' do
|
164
|
+
it 'loads the payload' do
|
165
|
+
expect(described_class.load_payload(valid_payload))
|
166
|
+
.to eq(expected_payload)
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
context 'when the payload responds to #[]' do
|
171
|
+
it 'loads the payload from ::COOKIE_NAME' do
|
172
|
+
cookies = { Monk::Id::COOKIE_NAME => valid_payload }
|
173
|
+
|
174
|
+
expect(described_class.load_payload(cookies)).to eq(expected_payload)
|
175
|
+
end
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
context 'when the payload is not valid' do
|
180
|
+
context 'when the payload cannot be decoded' do
|
181
|
+
it { expect(described_class.load_payload('invalid')).to be_empty }
|
182
|
+
end
|
183
|
+
|
184
|
+
context 'when the payload cannot be validated (wrong signature)' do
|
185
|
+
it { expect(described_class.load_payload(invalid_payload)).to be_empty }
|
186
|
+
end
|
187
|
+
|
188
|
+
context 'when the payload is nil' do
|
189
|
+
it { expect(described_class.load_payload(nil)).to be_empty }
|
190
|
+
end
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
context 'when signed in' do
|
195
|
+
before(:all) { described_class.load_payload(valid_payload) }
|
196
|
+
after(:all) { reset_payload }
|
197
|
+
|
198
|
+
describe '.signed_in?' do
|
199
|
+
it { expect(described_class.signed_in?).to be }
|
200
|
+
end
|
201
|
+
|
202
|
+
describe '.user_email' do
|
203
|
+
it 'returns the email of the user' do
|
204
|
+
expect(described_class.user_email).to eq('jstayton@monkdevelopment.com')
|
205
|
+
end
|
206
|
+
end
|
207
|
+
|
208
|
+
describe '.user_id' do
|
209
|
+
it 'returns the UUID of the user' do
|
210
|
+
expect(described_class.user_id)
|
211
|
+
.to eq('62c988ba-13d8-473e-adeb-8f7d2c62846a')
|
212
|
+
end
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
context 'when signed out' do
|
217
|
+
describe '.signed_in?' do
|
218
|
+
it { expect(described_class.signed_in?).not_to be }
|
219
|
+
end
|
220
|
+
|
221
|
+
describe '.user_email' do
|
222
|
+
it { expect(described_class.user_email).to be_nil }
|
223
|
+
end
|
224
|
+
|
225
|
+
describe '.user_id' do
|
226
|
+
it { expect(described_class.user_id).to be_nil }
|
227
|
+
end
|
228
|
+
end
|
229
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'helpers'
|
4
|
+
require 'simplecov'
|
5
|
+
require 'coveralls'
|
6
|
+
|
7
|
+
Coveralls.wear!
|
8
|
+
|
9
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
10
|
+
SimpleCov::Formatter::HTMLFormatter,
|
11
|
+
Coveralls::SimpleCov::Formatter
|
12
|
+
]
|
13
|
+
|
14
|
+
SimpleCov.start do
|
15
|
+
add_filter '/spec/'
|
16
|
+
end
|
17
|
+
|
18
|
+
require 'monk/id'
|
19
|
+
|
20
|
+
RSpec.configure do |config|
|
21
|
+
config.run_all_when_everything_filtered = true
|
22
|
+
config.filter_run :focus
|
23
|
+
config.order = 'random'
|
24
|
+
config.include Helpers
|
25
|
+
|
26
|
+
config.expect_with :rspec do |c|
|
27
|
+
c.syntax = :expect
|
28
|
+
end
|
29
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: monk-id
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Monk Development, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03
|
11
|
+
date: 2014-09-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,14 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
19
|
+
version: '1.6'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1.
|
26
|
+
version: '1.6'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: coveralls
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.7'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.7'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: gem-release
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -39,33 +53,61 @@ dependencies:
|
|
39
53
|
- !ruby/object:Gem::Version
|
40
54
|
version: '0.7'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
56
|
+
name: guard
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
59
|
- - ~>
|
46
60
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
61
|
+
version: '2.6'
|
48
62
|
type: :development
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
66
|
- - ~>
|
53
67
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
68
|
+
version: '2.6'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
70
|
+
name: guard-rspec
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
73
|
- - ~>
|
60
74
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
75
|
+
version: '4.3'
|
62
76
|
type: :development
|
63
77
|
prerelease: false
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
65
79
|
requirements:
|
66
80
|
- - ~>
|
67
81
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
82
|
+
version: '4.3'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: guard-rubocop
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ~>
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '1.1'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ~>
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '1.1'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rake
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ~>
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '10.3'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ~>
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '10.3'
|
69
111
|
- !ruby/object:Gem::Dependency
|
70
112
|
name: redcarpet
|
71
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,6 +122,76 @@ dependencies:
|
|
80
122
|
- - ~>
|
81
123
|
- !ruby/object:Gem::Version
|
82
124
|
version: '3.1'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rspec
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ~>
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '3.0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ~>
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '3.0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: rubocop
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ~>
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0.25'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ~>
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0.25'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: rubocop-rspec
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ~>
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '1.2'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ~>
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '1.2'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: simplecov
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - ~>
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0.9'
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - ~>
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '0.9'
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: yard
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - ~>
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: '0.8'
|
188
|
+
type: :development
|
189
|
+
prerelease: false
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - ~>
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: '0.8'
|
83
195
|
description: Integrate Monk ID authentication and single sign-on for apps and websites
|
84
196
|
on the server-side.
|
85
197
|
email:
|
@@ -88,15 +200,30 @@ executables: []
|
|
88
200
|
extensions: []
|
89
201
|
extra_rdoc_files: []
|
90
202
|
files:
|
203
|
+
- .editorconfig
|
204
|
+
- .gitattributes
|
91
205
|
- .gitignore
|
206
|
+
- .rspec
|
207
|
+
- .rubocop.yml
|
208
|
+
- .travis.yml
|
92
209
|
- .yardopts
|
93
210
|
- Gemfile
|
211
|
+
- Guardfile
|
212
|
+
- LICENSE
|
94
213
|
- README.md
|
95
214
|
- Rakefile
|
215
|
+
- circle.yml
|
96
216
|
- config/monk_id.sample.yml
|
97
217
|
- lib/monk/id.rb
|
98
218
|
- lib/monk/id/version.rb
|
99
219
|
- monk-id.gemspec
|
220
|
+
- spec/config/monk_id.yml
|
221
|
+
- spec/config/monk_id_alt.yml
|
222
|
+
- spec/config/monk_id_invalid.yml
|
223
|
+
- spec/helpers.rb
|
224
|
+
- spec/lib/monk/id/version_spec.rb
|
225
|
+
- spec/lib/monk/id_spec.rb
|
226
|
+
- spec/spec_helper.rb
|
100
227
|
homepage: https://github.com/MonkDev/monk-id-ruby
|
101
228
|
licenses:
|
102
229
|
- MIT
|
@@ -109,7 +236,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
109
236
|
requirements:
|
110
237
|
- - ! '>='
|
111
238
|
- !ruby/object:Gem::Version
|
112
|
-
version:
|
239
|
+
version: 1.9.3
|
113
240
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
114
241
|
requirements:
|
115
242
|
- - ! '>='
|
@@ -122,5 +249,12 @@ signing_key:
|
|
122
249
|
specification_version: 4
|
123
250
|
summary: Integrate Monk ID authentication and single sign-on for apps and websites
|
124
251
|
on the server-side.
|
125
|
-
test_files:
|
252
|
+
test_files:
|
253
|
+
- spec/config/monk_id.yml
|
254
|
+
- spec/config/monk_id_alt.yml
|
255
|
+
- spec/config/monk_id_invalid.yml
|
256
|
+
- spec/helpers.rb
|
257
|
+
- spec/lib/monk/id/version_spec.rb
|
258
|
+
- spec/lib/monk/id_spec.rb
|
259
|
+
- spec/spec_helper.rb
|
126
260
|
has_rdoc:
|