rapid-rack 0.0.1 → 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 +4 -4
- data/.simplecov +8 -1
- data/.travis.yml +8 -0
- data/README.md +21 -3
- data/lib/rapid_rack/default_receiver.rb +3 -3
- data/lib/rapid_rack/version.rb +1 -1
- data/rapid-rack.gemspec +1 -0
- data/spec/lib/rapid_rack/default_receiver_spec.rb +4 -4
- data/spec/lib/rapid_rack/engine_spec.rb +2 -2
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af245c337b3548052eb181b90d9e817a0c7f993d
|
4
|
+
data.tar.gz: 4d8dabe27aeadf4221dedcfa547c8e3cfc16a11d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fca522118573223624ea3ba0d22d7ea8634ea87a4e293134cef252a8fda9d928da05b97fe03111b0047d3dd63fbbec9ff1e9fb97bda040e3041bfb1e00df53ea
|
7
|
+
data.tar.gz: ff9bebca1bf46e73e8ffbfb45b3b58bc244b1c5e984506f52356183741b5351e97152ed6c5fea008b054dde63176e00d866ab342bbdb58e3c2f8739f68ffefbf
|
data/.simplecov
CHANGED
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,5 +1,23 @@
|
|
1
1
|
# RapidRack
|
2
2
|
|
3
|
+
[![Gem Version][GV img]][Gem Version]
|
4
|
+
[![Build Status][BS img]][Build Status]
|
5
|
+
[![Dependency Status][DS img]][Dependency Status]
|
6
|
+
[![Code Climate][CC img]][Code Climate]
|
7
|
+
[![Coverage Status][CS img]][Coverage Status]
|
8
|
+
|
9
|
+
[Gem Version]: https://rubygems.org/gems/rapid-rack
|
10
|
+
[Build Status]: https://travis-ci.org/ausaccessfed/rapid-rack
|
11
|
+
[Dependency Status]: https://gemnasium.com/ausaccessfed/rapid-rack
|
12
|
+
[Code Climate]: https://codeclimate.com/github/ausaccessfed/rapid-rack
|
13
|
+
[Coverage Status]: https://coveralls.io/r/ausaccessfed/rapid-rack
|
14
|
+
|
15
|
+
[GV img]: https://img.shields.io/gem/v/rapid-rack.svg
|
16
|
+
[BS img]: https://img.shields.io/travis/ausaccessfed/rapid-rack/develop.svg
|
17
|
+
[DS img]: https://img.shields.io/gemnasium/ausaccessfed/rapid-rack.svg
|
18
|
+
[CC img]: https://img.shields.io/codeclimate/github/ausaccessfed/rapid-rack.svg
|
19
|
+
[CS img]: https://img.shields.io/coveralls/ausaccessfed/rapid-rack.svg
|
20
|
+
|
3
21
|
[AAF Rapid Connect](https://rapid.aaf.edu.au) authentication plugin for
|
4
22
|
Rack-based web applications. Contains Rails-specific extensions for consumption
|
5
23
|
by Rails applications.
|
@@ -51,7 +69,7 @@ module MyApplication
|
|
51
69
|
# Receives the contents of the 'https://aaf.edu.au/attributes' claim from
|
52
70
|
# Rapid Connect, and returns a set of attributes appropriate for passing in
|
53
71
|
# to the `subject` method.
|
54
|
-
def map_attributes(attrs)
|
72
|
+
def map_attributes(_env, attrs)
|
55
73
|
{
|
56
74
|
targeted_id: attrs['edupersontargetedid'],
|
57
75
|
name: attrs['displayname'],
|
@@ -65,7 +83,7 @@ module MyApplication
|
|
65
83
|
#
|
66
84
|
# Must return the subject, and the subject must have an `id` method to work
|
67
85
|
# with the DefaultReceiver mixin.
|
68
|
-
def subject(attrs)
|
86
|
+
def subject(_env, attrs)
|
69
87
|
identifier = attrs.slice(:targeted_id)
|
70
88
|
MyOwnUserClass.find_or_initialize_by(identifier).tap do |subject|
|
71
89
|
subject.update_attributes!(attrs)
|
@@ -99,7 +117,7 @@ that is:
|
|
99
117
|
* `secret` — Your extremely secure secret
|
100
118
|
* `issuer` — The `iss` claim to expect. This is the identifier of the
|
101
119
|
Rapid Connect server you're authenticating against
|
102
|
-
* `audience` — The `
|
120
|
+
* `audience` — The `aud` claim to expect. This is your own service's
|
103
121
|
identifier
|
104
122
|
* `receiver` — **String** representing the fully qualified class name of
|
105
123
|
your receiver class
|
@@ -1,12 +1,12 @@
|
|
1
1
|
module RapidRack
|
2
2
|
module DefaultReceiver
|
3
3
|
def receive(env, claims)
|
4
|
-
attrs = map_attributes(claims['https://aaf.edu.au/attributes'])
|
5
|
-
store_id(env, subject(attrs).id)
|
4
|
+
attrs = map_attributes(env, claims['https://aaf.edu.au/attributes'])
|
5
|
+
store_id(env, subject(env, attrs).id)
|
6
6
|
finish(env)
|
7
7
|
end
|
8
8
|
|
9
|
-
def map_attributes(attrs)
|
9
|
+
def map_attributes(_env, attrs)
|
10
10
|
attrs
|
11
11
|
end
|
12
12
|
|
data/lib/rapid_rack/version.rb
CHANGED
data/rapid-rack.gemspec
CHANGED
@@ -28,6 +28,7 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.add_development_dependency 'sqlite3'
|
29
29
|
spec.add_development_dependency 'fakeredis'
|
30
30
|
spec.add_development_dependency 'redis'
|
31
|
+
spec.add_development_dependency 'coveralls'
|
31
32
|
|
32
33
|
spec.add_development_dependency 'guard'
|
33
34
|
spec.add_development_dependency 'guard-rspec'
|
@@ -26,7 +26,7 @@ module RapidRack
|
|
26
26
|
|
27
27
|
context '#receive' do
|
28
28
|
before do
|
29
|
-
allow(creator).to receive(:subject).with(anything)
|
29
|
+
allow(creator).to receive(:subject).with(anything, anything)
|
30
30
|
.and_return(authenticated_subject)
|
31
31
|
end
|
32
32
|
|
@@ -35,7 +35,7 @@ module RapidRack
|
|
35
35
|
end
|
36
36
|
|
37
37
|
it 'passes the attributes through to the subject method' do
|
38
|
-
expect(creator).to receive(:subject).with(attrs)
|
38
|
+
expect(creator).to receive(:subject).with(env, attrs)
|
39
39
|
.and_return(authenticated_subject)
|
40
40
|
|
41
41
|
run
|
@@ -52,14 +52,14 @@ module RapidRack
|
|
52
52
|
context 'with an overridden `map_attributes` method' do
|
53
53
|
let(:overrides) do
|
54
54
|
Module.new do
|
55
|
-
def map_attributes(_)
|
55
|
+
def map_attributes(_, _)
|
56
56
|
{ 'remapped' => true }
|
57
57
|
end
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
61
|
it 'passes the mapped attributes through to the subject method' do
|
62
|
-
expect(creator).to receive(:subject).with('remapped' => true)
|
62
|
+
expect(creator).to receive(:subject).with(env, 'remapped' => true)
|
63
63
|
.and_return(authenticated_subject)
|
64
64
|
|
65
65
|
run
|
@@ -29,7 +29,7 @@ module RapidRack
|
|
29
29
|
include DefaultReceiver
|
30
30
|
include RedisRegistry
|
31
31
|
|
32
|
-
def map_attributes(attrs)
|
32
|
+
def map_attributes(_env, attrs)
|
33
33
|
{
|
34
34
|
targeted_id: attrs['edupersontargetedid'],
|
35
35
|
email: attrs['mail'],
|
@@ -37,7 +37,7 @@ module RapidRack
|
|
37
37
|
}
|
38
38
|
end
|
39
39
|
|
40
|
-
def subject(attrs)
|
40
|
+
def subject(_env, attrs)
|
41
41
|
identifier = attrs.slice(:targeted_id)
|
42
42
|
TestSubject.find_or_initialize_by(identifier).tap do |subject|
|
43
43
|
subject.update_attributes!(attrs)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rapid-rack
|
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
|
- Shaun Mangelsdorf
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json-jwt
|
@@ -150,6 +150,20 @@ dependencies:
|
|
150
150
|
- - ">="
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: coveralls
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ">="
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0'
|
153
167
|
- !ruby/object:Gem::Dependency
|
154
168
|
name: guard
|
155
169
|
requirement: !ruby/object:Gem::Requirement
|
@@ -217,6 +231,7 @@ files:
|
|
217
231
|
- ".rspec"
|
218
232
|
- ".rubocop.yml"
|
219
233
|
- ".simplecov"
|
234
|
+
- ".travis.yml"
|
220
235
|
- Gemfile
|
221
236
|
- Guardfile
|
222
237
|
- LICENSE
|