rapid-rack 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 831e03b9b52922e691d108fb9024efba4023466d
4
- data.tar.gz: 2414708416a8601ea94973d7621a4bb9b6ecee9f
3
+ metadata.gz: af245c337b3548052eb181b90d9e817a0c7f993d
4
+ data.tar.gz: 4d8dabe27aeadf4221dedcfa547c8e3cfc16a11d
5
5
  SHA512:
6
- metadata.gz: d6c8d860e14a7d95c5b7492608ec2c9ce79d8ec529887788a3ee91a61ef33fdb8a0703cb1d1cdf4b7fb8b620385feab85d61a97dd9387cfe5510913e2c3f9965
7
- data.tar.gz: 063184cd00302abfb4a13309c63203edc90e37832b157c5e9215ef52b3dbb600a99726014662c11d8c85d6800020864f4809db2622a96970653758ebfaaed29b
6
+ metadata.gz: fca522118573223624ea3ba0d22d7ea8634ea87a4e293134cef252a8fda9d928da05b97fe03111b0047d3dd63fbbec9ff1e9fb97bda040e3041bfb1e00df53ea
7
+ data.tar.gz: ff9bebca1bf46e73e8ffbfb45b3b58bc244b1c5e984506f52356183741b5351e97152ed6c5fea008b054dde63176e00d866ab342bbdb58e3c2f8739f68ffefbf
data/.simplecov CHANGED
@@ -1,3 +1,10 @@
1
+ require 'coveralls'
2
+
3
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
4
+ SimpleCov::Formatter::HTMLFormatter,
5
+ Coveralls::SimpleCov::Formatter
6
+ ]
7
+
1
8
  SimpleCov.start do
2
- add_filter 'spec'
9
+ add_filter('spec')
3
10
  end
@@ -0,0 +1,8 @@
1
+ ---
2
+ language: ruby
3
+ rvm:
4
+ - 2.1.1
5
+ branches:
6
+ only:
7
+ - master
8
+ - develop
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 `aus` claim to expect. This is your own service's
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
 
@@ -1,3 +1,3 @@
1
1
  module RapidRack
2
- VERSION = '0.0.1'
2
+ VERSION = '0.1.0'
3
3
  end
@@ -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.1
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-21 00:00:00.000000000 Z
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