aker 3.0.0.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. data/CHANGELOG.md +210 -0
  2. data/README.md +282 -0
  3. data/assets/aker/form/login.css +73 -0
  4. data/assets/aker/form/login.html.erb +44 -0
  5. data/lib/aker/authorities/automatic_access.rb +36 -0
  6. data/lib/aker/authorities/composite.rb +301 -0
  7. data/lib/aker/authorities/static.rb +283 -0
  8. data/lib/aker/authorities/support/find_sole_user.rb +24 -0
  9. data/lib/aker/authorities/support.rb +9 -0
  10. data/lib/aker/authorities.rb +46 -0
  11. data/lib/aker/cas/authority.rb +79 -0
  12. data/lib/aker/cas/configuration_helper.rb +85 -0
  13. data/lib/aker/cas/middleware/logout_responder.rb +49 -0
  14. data/lib/aker/cas/middleware/ticket_remover.rb +35 -0
  15. data/lib/aker/cas/middleware.rb +6 -0
  16. data/lib/aker/cas/proxy_mode.rb +108 -0
  17. data/lib/aker/cas/rack_proxy_callback.rb +188 -0
  18. data/lib/aker/cas/service_mode.rb +88 -0
  19. data/lib/aker/cas/service_url.rb +62 -0
  20. data/lib/aker/cas/user_ext.rb +64 -0
  21. data/lib/aker/cas.rb +31 -0
  22. data/lib/aker/central_parameters.rb +101 -0
  23. data/lib/aker/configuration.rb +534 -0
  24. data/lib/aker/deprecation.rb +105 -0
  25. data/lib/aker/form/custom_views_mode.rb +80 -0
  26. data/lib/aker/form/login_form_asset_provider.rb +56 -0
  27. data/lib/aker/form/middleware/custom_view_login_responder.rb +19 -0
  28. data/lib/aker/form/middleware/login_renderer.rb +72 -0
  29. data/lib/aker/form/middleware/login_responder.rb +71 -0
  30. data/lib/aker/form/middleware/logout_responder.rb +26 -0
  31. data/lib/aker/form/middleware.rb +10 -0
  32. data/lib/aker/form/mode.rb +118 -0
  33. data/lib/aker/form.rb +26 -0
  34. data/lib/aker/group.rb +67 -0
  35. data/lib/aker/group_membership.rb +162 -0
  36. data/lib/aker/ldap/authority.rb +392 -0
  37. data/lib/aker/ldap/user_ext.rb +19 -0
  38. data/lib/aker/ldap.rb +22 -0
  39. data/lib/aker/modes/base.rb +85 -0
  40. data/lib/aker/modes/http_basic.rb +100 -0
  41. data/lib/aker/modes/support/attempted_path.rb +22 -0
  42. data/lib/aker/modes/support/rfc_2617.rb +32 -0
  43. data/lib/aker/modes/support.rb +12 -0
  44. data/lib/aker/modes.rb +48 -0
  45. data/lib/aker/rack/authenticate.rb +37 -0
  46. data/lib/aker/rack/configuration_helper.rb +18 -0
  47. data/lib/aker/rack/default_logout_responder.rb +36 -0
  48. data/lib/aker/rack/environment_helper.rb +34 -0
  49. data/lib/aker/rack/facade.rb +102 -0
  50. data/lib/aker/rack/failure.rb +69 -0
  51. data/lib/aker/rack/logout.rb +63 -0
  52. data/lib/aker/rack/request_ext.rb +19 -0
  53. data/lib/aker/rack/session_timer.rb +95 -0
  54. data/lib/aker/rack/setup.rb +77 -0
  55. data/lib/aker/rack.rb +107 -0
  56. data/lib/aker/test/helpers.rb +22 -0
  57. data/lib/aker/test.rb +8 -0
  58. data/lib/aker/user.rb +231 -0
  59. data/lib/aker/version.rb +3 -0
  60. data/lib/aker.rb +51 -0
  61. data/spec/aker/aker-sample.yml +11 -0
  62. data/spec/aker/authorities/automatic_access_spec.rb +52 -0
  63. data/spec/aker/authorities/composite_spec.rb +488 -0
  64. data/spec/aker/authorities/nu-schema.jar +0 -0
  65. data/spec/aker/authorities/static_spec.rb +455 -0
  66. data/spec/aker/authorities/support/find_sole_user_spec.rb +33 -0
  67. data/spec/aker/authorities_spec.rb +16 -0
  68. data/spec/aker/cas/authority_spec.rb +106 -0
  69. data/spec/aker/cas/configuration_helper_spec.rb +92 -0
  70. data/spec/aker/cas/middleware/logout_responder_spec.rb +47 -0
  71. data/spec/aker/cas/middleware/ticket_remover_spec.rb +49 -0
  72. data/spec/aker/cas/proxy_mode_spec.rb +185 -0
  73. data/spec/aker/cas/rack_proxy_callback_spec.rb +190 -0
  74. data/spec/aker/cas/service_mode_spec.rb +122 -0
  75. data/spec/aker/cas/service_url_spec.rb +114 -0
  76. data/spec/aker/cas/user_ext_spec.rb +27 -0
  77. data/spec/aker/cas_spec.rb +19 -0
  78. data/spec/aker/central_parameters_spec.rb +44 -0
  79. data/spec/aker/configuration_spec.rb +465 -0
  80. data/spec/aker/deprecation_spec.rb +115 -0
  81. data/spec/aker/form/a_form_mode.rb +129 -0
  82. data/spec/aker/form/custom_views_mode_spec.rb +34 -0
  83. data/spec/aker/form/login_form_asset_provider_spec.rb +80 -0
  84. data/spec/aker/form/middleware/a_form_login_responder.rb +89 -0
  85. data/spec/aker/form/middleware/custom_view_login_responder_spec.rb +47 -0
  86. data/spec/aker/form/middleware/login_renderer_spec.rb +56 -0
  87. data/spec/aker/form/middleware/login_responder_spec.rb +34 -0
  88. data/spec/aker/form/middleware/logout_responder_spec.rb +55 -0
  89. data/spec/aker/form/mode_spec.rb +15 -0
  90. data/spec/aker/form_spec.rb +11 -0
  91. data/spec/aker/group_membership_spec.rb +208 -0
  92. data/spec/aker/group_spec.rb +66 -0
  93. data/spec/aker/ldap/authority_spec.rb +414 -0
  94. data/spec/aker/ldap/ldap-users.ldif +197 -0
  95. data/spec/aker/ldap_spec.rb +11 -0
  96. data/spec/aker/modes/a_aker_mode.rb +41 -0
  97. data/spec/aker/modes/http_basic_spec.rb +127 -0
  98. data/spec/aker/modes/support/attempted_path_spec.rb +32 -0
  99. data/spec/aker/modes_spec.rb +11 -0
  100. data/spec/aker/rack/authenticate_spec.rb +78 -0
  101. data/spec/aker/rack/default_logout_responder_spec.rb +67 -0
  102. data/spec/aker/rack/facade_spec.rb +154 -0
  103. data/spec/aker/rack/failure_spec.rb +151 -0
  104. data/spec/aker/rack/logout_spec.rb +63 -0
  105. data/spec/aker/rack/request_ext_spec.rb +29 -0
  106. data/spec/aker/rack/session_timer_spec.rb +134 -0
  107. data/spec/aker/rack/setup_spec.rb +87 -0
  108. data/spec/aker/rack_spec.rb +216 -0
  109. data/spec/aker/test/helpers_spec.rb +44 -0
  110. data/spec/aker/user_spec.rb +362 -0
  111. data/spec/aker_spec.rb +80 -0
  112. data/spec/deprecation_helper.rb +58 -0
  113. data/spec/java_helper.rb +5 -0
  114. data/spec/logger_helper.rb +17 -0
  115. data/spec/matchers.rb +31 -0
  116. data/spec/mock_builder.rb +25 -0
  117. data/spec/spec_helper.rb +52 -0
  118. metadata +265 -0
@@ -0,0 +1,58 @@
1
+ module Aker
2
+ module Spec
3
+ class DeprecationMode
4
+ def self.use_in(spec_config)
5
+ spec_config.include DeprecationHelper
6
+
7
+ spec_config.before(:each) do
8
+ @original_deprecation_mode, Aker::Deprecation.mode =
9
+ Aker::Deprecation.mode, Aker::Spec::DeprecationMode.new
10
+ end
11
+
12
+ spec_config.after(:each) do
13
+ begin
14
+ Aker::Deprecation.mode.fail_if_any_very_obsolete
15
+ ensure
16
+ Aker::Deprecation.mode = @original_deprecation_mode
17
+ end
18
+ end
19
+ end
20
+
21
+ def messages
22
+ @messages ||= []
23
+ end
24
+
25
+ def report(level, message, version)
26
+ messages << { :level => level, :message => message, :version => version }
27
+ end
28
+
29
+ def reset
30
+ @messages = nil
31
+ end
32
+
33
+ def fail_if_any_very_obsolete
34
+ obs = messages.select { |m| very_obsolete?(m[:version]) }
35
+ unless obs.empty?
36
+ fail "Very obsolete code still present. Remove it and its specs.\n" <<
37
+ "- #{obs.collect { |o| o[:message] }.join("\n- ")}"
38
+ end
39
+ end
40
+
41
+ def very_obsolete?(version)
42
+ # "very obsolete" if it was deprecated at least two minor
43
+ # versions ago
44
+ major_minor(Aker::VERSION) - Rational(2, 10) >= major_minor(version)
45
+ end
46
+
47
+ def major_minor(version)
48
+ Rational(version.split('.')[0, 2].inject(0) { |s, i| s = s * 10 + i.to_i }, 10)
49
+ end
50
+ end
51
+
52
+ module DeprecationHelper
53
+ def deprecation_message(n=0)
54
+ (Aker::Deprecation.mode.messages[n] || {})[:message]
55
+ end
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,5 @@
1
+ require 'java'
2
+
3
+ Dir[File.join(File.dirname(__FILE__), '../vendor/java/*.jar')].each do |jar|
4
+ $CLASSPATH << jar
5
+ end
@@ -0,0 +1,17 @@
1
+ module Aker
2
+ module Spec
3
+ module LoggerHelper
4
+ def actual_log
5
+ unless @log_io
6
+ raise "You don't seem to be using the spec logger. Is it in your aker configuration?"
7
+ end
8
+ @log_io.string
9
+ end
10
+
11
+ def spec_logger
12
+ @log_io = StringIO.new
13
+ @spec_logger ||= Logger.new(@log_io)
14
+ end
15
+ end
16
+ end
17
+ end
data/spec/matchers.rb ADDED
@@ -0,0 +1,31 @@
1
+ module Aker
2
+ module Spec
3
+ module Matchers
4
+ class AllMatch
5
+ def initialize(pattern)
6
+ @expected = pattern
7
+ end
8
+
9
+ def matches?(target)
10
+ target.each_with_index do |actual, i|
11
+ @at = i
12
+
13
+ break false unless actual =~ @expected
14
+ end
15
+ end
16
+
17
+ def failure_message_for_should
18
+ "expected element #{@at} to match #{@expected.inspect}"
19
+ end
20
+
21
+ def failure_message_for_should_not
22
+ "expected element #{@at} to not match #{@expected.inspect}"
23
+ end
24
+ end
25
+
26
+ def all_match(expected)
27
+ AllMatch.new(expected)
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,25 @@
1
+ module Aker
2
+ module Spec
3
+ ##
4
+ # A record-only version of Rack::Builder.
5
+ class MockBuilder
6
+ def reset!
7
+ self.uses.clear
8
+ end
9
+
10
+ def use(cls, *params, &block)
11
+ self.uses << [cls, params, block]
12
+ end
13
+
14
+ def uses
15
+ @uses ||= []
16
+ end
17
+
18
+ def using?(klass, *params)
19
+ self.uses.detect { |cls, prms, block| cls == klass && params == prms }
20
+ end
21
+
22
+ alias :find_use_of :using?
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,52 @@
1
+ require 'bundler'
2
+ Bundler.setup
3
+
4
+ require 'rspec'
5
+
6
+ $LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
7
+
8
+ require 'aker'
9
+
10
+ require File.expand_path('../deprecation_helper', __FILE__)
11
+ require File.expand_path('../logger_helper', __FILE__)
12
+ require File.expand_path("../../tool-patches/rcov-encoding-1.9.rb", __FILE__)
13
+ require File.expand_path('../mock_builder', __FILE__)
14
+
15
+ if RUBY_PLATFORM == 'java'
16
+ require File.expand_path('../java_helper', __FILE__)
17
+ end
18
+
19
+ RSpec.configure do |config|
20
+ Aker::Spec::DeprecationMode.use_in(config)
21
+ config.include Aker::Spec::LoggerHelper
22
+
23
+ config.treat_symbols_as_metadata_keys_with_true_values = true
24
+
25
+ config.after do
26
+ FileUtils.rm_rf @tmpdir if @tmpdir
27
+ end
28
+
29
+ def tmpdir
30
+ @tmpdir ||= File.expand_path('../../tmp/aker-unit-tests', __FILE__).
31
+ tap { |p| FileUtils.mkdir_p p }
32
+ end
33
+ end
34
+
35
+ def port_offset
36
+ base = case ENV["AKER_ENV"]
37
+ when /jruby/
38
+ 108
39
+ when /1.9/
40
+ 207
41
+ when /1.8/
42
+ 306
43
+ end
44
+ case ENV["ACTIVESUPPORT_VERSION"]
45
+ when /3.0/
46
+ base * 6
47
+ when /2.3/
48
+ base
49
+ else
50
+ base * 0
51
+ end
52
+ end
metadata ADDED
@@ -0,0 +1,265 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: aker
3
+ version: !ruby/object:Gem::Version
4
+ hash: 961916020
5
+ prerelease: true
6
+ segments:
7
+ - 3
8
+ - 0
9
+ - 0
10
+ - pre
11
+ version: 3.0.0.pre
12
+ platform: ruby
13
+ authors:
14
+ - Rhett Sutphin
15
+ - David Yip
16
+ autorequire:
17
+ bindir: bin
18
+ cert_chain: []
19
+
20
+ date: 2011-07-19 00:00:00 -05:00
21
+ default_executable:
22
+ dependencies:
23
+ - !ruby/object:Gem::Dependency
24
+ name: rubytree
25
+ prerelease: false
26
+ requirement: &id001 !ruby/object:Gem::Requirement
27
+ none: false
28
+ requirements:
29
+ - - ~>
30
+ - !ruby/object:Gem::Version
31
+ hash: 3
32
+ segments:
33
+ - 0
34
+ - 7
35
+ - 0
36
+ version: 0.7.0
37
+ type: :runtime
38
+ version_requirements: *id001
39
+ - !ruby/object:Gem::Dependency
40
+ name: activesupport
41
+ prerelease: false
42
+ requirement: &id002 !ruby/object:Gem::Requirement
43
+ none: false
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ hash: 3
48
+ segments:
49
+ - 2
50
+ - 3
51
+ - 0
52
+ version: 2.3.0
53
+ type: :runtime
54
+ version_requirements: *id002
55
+ - !ruby/object:Gem::Dependency
56
+ name: net-ldap
57
+ prerelease: false
58
+ requirement: &id003 !ruby/object:Gem::Requirement
59
+ none: false
60
+ requirements:
61
+ - - ~>
62
+ - !ruby/object:Gem::Version
63
+ hash: 25
64
+ segments:
65
+ - 0
66
+ - 1
67
+ - 1
68
+ version: 0.1.1
69
+ type: :runtime
70
+ version_requirements: *id003
71
+ - !ruby/object:Gem::Dependency
72
+ name: castanet
73
+ prerelease: false
74
+ requirement: &id004 !ruby/object:Gem::Requirement
75
+ none: false
76
+ requirements:
77
+ - - ~>
78
+ - !ruby/object:Gem::Version
79
+ hash: 23
80
+ segments:
81
+ - 1
82
+ - 0
83
+ - 0
84
+ version: 1.0.0
85
+ type: :runtime
86
+ version_requirements: *id004
87
+ - !ruby/object:Gem::Dependency
88
+ name: warden
89
+ prerelease: false
90
+ requirement: &id005 !ruby/object:Gem::Requirement
91
+ none: false
92
+ requirements:
93
+ - - ~>
94
+ - !ruby/object:Gem::Version
95
+ hash: 15
96
+ segments:
97
+ - 1
98
+ - 0
99
+ version: "1.0"
100
+ type: :runtime
101
+ version_requirements: *id005
102
+ description:
103
+ email: r-sutphin@northwestern.edu
104
+ executables: []
105
+
106
+ extensions: []
107
+
108
+ extra_rdoc_files: []
109
+
110
+ files:
111
+ - CHANGELOG.md
112
+ - README.md
113
+ - assets/aker/form/login.css
114
+ - assets/aker/form/login.html.erb
115
+ - lib/aker/authorities/automatic_access.rb
116
+ - lib/aker/authorities/composite.rb
117
+ - lib/aker/authorities/static.rb
118
+ - lib/aker/authorities/support/find_sole_user.rb
119
+ - lib/aker/authorities/support.rb
120
+ - lib/aker/authorities.rb
121
+ - lib/aker/cas/authority.rb
122
+ - lib/aker/cas/configuration_helper.rb
123
+ - lib/aker/cas/middleware/logout_responder.rb
124
+ - lib/aker/cas/middleware/ticket_remover.rb
125
+ - lib/aker/cas/middleware.rb
126
+ - lib/aker/cas/proxy_mode.rb
127
+ - lib/aker/cas/rack_proxy_callback.rb
128
+ - lib/aker/cas/service_mode.rb
129
+ - lib/aker/cas/service_url.rb
130
+ - lib/aker/cas/user_ext.rb
131
+ - lib/aker/cas.rb
132
+ - lib/aker/central_parameters.rb
133
+ - lib/aker/configuration.rb
134
+ - lib/aker/deprecation.rb
135
+ - lib/aker/form/custom_views_mode.rb
136
+ - lib/aker/form/login_form_asset_provider.rb
137
+ - lib/aker/form/middleware/custom_view_login_responder.rb
138
+ - lib/aker/form/middleware/login_renderer.rb
139
+ - lib/aker/form/middleware/login_responder.rb
140
+ - lib/aker/form/middleware/logout_responder.rb
141
+ - lib/aker/form/middleware.rb
142
+ - lib/aker/form/mode.rb
143
+ - lib/aker/form.rb
144
+ - lib/aker/group.rb
145
+ - lib/aker/group_membership.rb
146
+ - lib/aker/ldap/authority.rb
147
+ - lib/aker/ldap/user_ext.rb
148
+ - lib/aker/ldap.rb
149
+ - lib/aker/modes/base.rb
150
+ - lib/aker/modes/http_basic.rb
151
+ - lib/aker/modes/support/attempted_path.rb
152
+ - lib/aker/modes/support/rfc_2617.rb
153
+ - lib/aker/modes/support.rb
154
+ - lib/aker/modes.rb
155
+ - lib/aker/rack/authenticate.rb
156
+ - lib/aker/rack/configuration_helper.rb
157
+ - lib/aker/rack/default_logout_responder.rb
158
+ - lib/aker/rack/environment_helper.rb
159
+ - lib/aker/rack/facade.rb
160
+ - lib/aker/rack/failure.rb
161
+ - lib/aker/rack/logout.rb
162
+ - lib/aker/rack/request_ext.rb
163
+ - lib/aker/rack/session_timer.rb
164
+ - lib/aker/rack/setup.rb
165
+ - lib/aker/rack.rb
166
+ - lib/aker/test/helpers.rb
167
+ - lib/aker/test.rb
168
+ - lib/aker/user.rb
169
+ - lib/aker/version.rb
170
+ - lib/aker.rb
171
+ - spec/aker/aker-sample.yml
172
+ - spec/aker/authorities/automatic_access_spec.rb
173
+ - spec/aker/authorities/composite_spec.rb
174
+ - spec/aker/authorities/nu-schema.jar
175
+ - spec/aker/authorities/static_spec.rb
176
+ - spec/aker/authorities/support/find_sole_user_spec.rb
177
+ - spec/aker/authorities_spec.rb
178
+ - spec/aker/cas/authority_spec.rb
179
+ - spec/aker/cas/configuration_helper_spec.rb
180
+ - spec/aker/cas/middleware/logout_responder_spec.rb
181
+ - spec/aker/cas/middleware/ticket_remover_spec.rb
182
+ - spec/aker/cas/proxy_mode_spec.rb
183
+ - spec/aker/cas/rack_proxy_callback_spec.rb
184
+ - spec/aker/cas/service_mode_spec.rb
185
+ - spec/aker/cas/service_url_spec.rb
186
+ - spec/aker/cas/user_ext_spec.rb
187
+ - spec/aker/cas_spec.rb
188
+ - spec/aker/central_parameters_spec.rb
189
+ - spec/aker/configuration_spec.rb
190
+ - spec/aker/deprecation_spec.rb
191
+ - spec/aker/form/a_form_mode.rb
192
+ - spec/aker/form/custom_views_mode_spec.rb
193
+ - spec/aker/form/login_form_asset_provider_spec.rb
194
+ - spec/aker/form/middleware/a_form_login_responder.rb
195
+ - spec/aker/form/middleware/custom_view_login_responder_spec.rb
196
+ - spec/aker/form/middleware/login_renderer_spec.rb
197
+ - spec/aker/form/middleware/login_responder_spec.rb
198
+ - spec/aker/form/middleware/logout_responder_spec.rb
199
+ - spec/aker/form/mode_spec.rb
200
+ - spec/aker/form_spec.rb
201
+ - spec/aker/group_membership_spec.rb
202
+ - spec/aker/group_spec.rb
203
+ - spec/aker/ldap/authority_spec.rb
204
+ - spec/aker/ldap/ldap-users.ldif
205
+ - spec/aker/ldap_spec.rb
206
+ - spec/aker/modes/a_aker_mode.rb
207
+ - spec/aker/modes/http_basic_spec.rb
208
+ - spec/aker/modes/support/attempted_path_spec.rb
209
+ - spec/aker/modes_spec.rb
210
+ - spec/aker/rack/authenticate_spec.rb
211
+ - spec/aker/rack/default_logout_responder_spec.rb
212
+ - spec/aker/rack/facade_spec.rb
213
+ - spec/aker/rack/failure_spec.rb
214
+ - spec/aker/rack/logout_spec.rb
215
+ - spec/aker/rack/request_ext_spec.rb
216
+ - spec/aker/rack/session_timer_spec.rb
217
+ - spec/aker/rack/setup_spec.rb
218
+ - spec/aker/rack_spec.rb
219
+ - spec/aker/test/helpers_spec.rb
220
+ - spec/aker/user_spec.rb
221
+ - spec/aker_spec.rb
222
+ - spec/deprecation_helper.rb
223
+ - spec/java_helper.rb
224
+ - spec/logger_helper.rb
225
+ - spec/matchers.rb
226
+ - spec/mock_builder.rb
227
+ - spec/spec_helper.rb
228
+ has_rdoc: true
229
+ homepage: https://github.com/NUBIC/aker
230
+ licenses: []
231
+
232
+ post_install_message:
233
+ rdoc_options: []
234
+
235
+ require_paths:
236
+ - lib
237
+ required_ruby_version: !ruby/object:Gem::Requirement
238
+ none: false
239
+ requirements:
240
+ - - ">="
241
+ - !ruby/object:Gem::Version
242
+ hash: 3
243
+ segments:
244
+ - 0
245
+ version: "0"
246
+ required_rubygems_version: !ruby/object:Gem::Requirement
247
+ none: false
248
+ requirements:
249
+ - - ">"
250
+ - !ruby/object:Gem::Version
251
+ hash: 25
252
+ segments:
253
+ - 1
254
+ - 3
255
+ - 1
256
+ version: 1.3.1
257
+ requirements: []
258
+
259
+ rubyforge_project:
260
+ rubygems_version: 1.3.7
261
+ signing_key:
262
+ specification_version: 3
263
+ summary: A flexible authentication and authorization framework for Rack applications.
264
+ test_files: []
265
+