ucb_rails_security 2.0.7
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.
- data/CHANGELOG +6 -0
- data/Manifest +56 -0
- data/README +195 -0
- data/Rakefile +21 -0
- data/TODO +3 -0
- data/generators/ucb_rails_security/templates/controllers/ucb_security/base_controller.rb +17 -0
- data/generators/ucb_rails_security/templates/controllers/ucb_security/ldap_search_controller.rb +10 -0
- data/generators/ucb_rails_security/templates/controllers/ucb_security/role_users_controller.rb +27 -0
- data/generators/ucb_rails_security/templates/controllers/ucb_security/roles_controller.rb +52 -0
- data/generators/ucb_rails_security/templates/controllers/ucb_security/user_roles_controller.rb +29 -0
- data/generators/ucb_rails_security/templates/controllers/ucb_security/users_controller.rb +59 -0
- data/generators/ucb_rails_security/templates/db/migrate/xxx_create_ucb_rails_security_tables.rb +31 -0
- data/generators/ucb_rails_security/templates/helpers/ucb_security/base_helper.rb +23 -0
- data/generators/ucb_rails_security/templates/helpers/ucb_security/builder.rb +25 -0
- data/generators/ucb_rails_security/templates/helpers/ucb_security/roles_helper.rb +2 -0
- data/generators/ucb_rails_security/templates/helpers/ucb_security/users_helper.rb +2 -0
- data/generators/ucb_rails_security/templates/initializers/ucb_security_config.rb +20 -0
- data/generators/ucb_rails_security/templates/javascripts/ucb_security.js +99 -0
- data/generators/ucb_rails_security/templates/models/ldap_search.rb +48 -0
- data/generators/ucb_rails_security/templates/models/role.rb +32 -0
- data/generators/ucb_rails_security/templates/models/user.rb +106 -0
- data/generators/ucb_rails_security/templates/models/user_roles.rb +3 -0
- data/generators/ucb_rails_security/templates/stylesheets/ucb_security.css +347 -0
- data/generators/ucb_rails_security/templates/views/layouts/ucb_security/_main_navigation.html.erb +10 -0
- data/generators/ucb_rails_security/templates/views/layouts/ucb_security/application.html.erb +24 -0
- data/generators/ucb_rails_security/templates/views/ucb_security/ldap_search/index.html.erb +62 -0
- data/generators/ucb_rails_security/templates/views/ucb_security/role_users/_new.html.erb +11 -0
- data/generators/ucb_rails_security/templates/views/ucb_security/role_users/edit.html.erb +37 -0
- data/generators/ucb_rails_security/templates/views/ucb_security/roles/_users.html.erb +14 -0
- data/generators/ucb_rails_security/templates/views/ucb_security/roles/edit.html.erb +19 -0
- data/generators/ucb_rails_security/templates/views/ucb_security/roles/index.html.erb +34 -0
- data/generators/ucb_rails_security/templates/views/ucb_security/roles/new.html.erb +19 -0
- data/generators/ucb_rails_security/templates/views/ucb_security/roles/show.html.erb +27 -0
- data/generators/ucb_rails_security/templates/views/ucb_security/user_roles/edit.html.erb +17 -0
- data/generators/ucb_rails_security/templates/views/ucb_security/users/edit.html.erb +23 -0
- data/generators/ucb_rails_security/templates/views/ucb_security/users/index.html.erb +43 -0
- data/generators/ucb_rails_security/templates/views/ucb_security/users/new.html.erb +29 -0
- data/generators/ucb_rails_security/templates/views/ucb_security/users/show.html.erb +43 -0
- data/generators/ucb_rails_security/ucb_rails_security_generator.rb +191 -0
- data/init.rb +9 -0
- data/lib/helpers/rspec_helpers.rb +119 -0
- data/lib/tasks/ucb_rails_security.rake +22 -0
- data/lib/ucb_rails_security.rb +60 -0
- data/lib/ucb_rails_security_casauthentication.rb +117 -0
- data/lib/ucb_rails_security_logger.rb +33 -0
- data/lib/ucb_rs_controller_methods.rb +496 -0
- data/rdoc_includes/application_controller_rb.txt +9 -0
- data/rspec/_all_specs.rb +5 -0
- data/rspec/_setup.rb +36 -0
- data/rspec/filter_ldap_spec.rb +87 -0
- data/rspec/filter_role_spec.rb +56 -0
- data/rspec/filter_spec.rb +37 -0
- data/rspec/filter_user_spec.rb +55 -0
- data/rspec/logged_in_status_spec.rb +226 -0
- data/rspec/ucb_rails_security_casauthentication_spec.rb +83 -0
- data/rspec/ucb_rails_security_spec.rb +34 -0
- data/test/test_rails-2.0.x/test/test_helper.rb +38 -0
- data/test/test_rails-2.1.x/test/test_helper.rb +38 -0
- data/ucb_rails_security.gemspec +41 -0
- metadata +147 -0
@@ -0,0 +1,37 @@
|
|
1
|
+
require "#{File.dirname(__FILE__)}/_setup.rb"
|
2
|
+
|
3
|
+
describe "Controller method_missing() code" do
|
4
|
+
before(:each) do
|
5
|
+
@controller = new_controller()
|
6
|
+
end
|
7
|
+
|
8
|
+
it "should raise error if called with non-filter method" do
|
9
|
+
lambda{@controller.bogus}.should raise_error(NoMethodError)
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should always call filter_logged_in before other filters" do
|
13
|
+
@controller.stub!(:filter_logged_in).and_return(false)
|
14
|
+
@controller.filter_ldap_anything.should be_false
|
15
|
+
end
|
16
|
+
|
17
|
+
def ldap_setup(return_value)
|
18
|
+
@ldap_user = mock("ldap_user")
|
19
|
+
@ldap_user.stub!(:anything)
|
20
|
+
@controller.stub!(:ldap_user).and_return(@ldap_user)
|
21
|
+
@controller.stub!(:filter_logged_in).and_return(true)
|
22
|
+
@controller.stub!(:ldap_boolean).and_return(return_value)
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should return true when filter returns true" do
|
26
|
+
ldap_setup(true)
|
27
|
+
@controller.filter_ldap_anything.should be_true
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should return false when filter returns false" do
|
31
|
+
ldap_setup(false)
|
32
|
+
@controller.stub!(:redirect_to)
|
33
|
+
@controller.stub!(:not_authorized_url)
|
34
|
+
@controller.filter_ldap_anything.should be_false
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require "#{File.dirname(__FILE__)}/_setup.rb"
|
2
|
+
|
3
|
+
context "The user filter" do
|
4
|
+
setup do
|
5
|
+
@controller = new_controller()
|
6
|
+
UCB::Rails::Security.using_user_table = true
|
7
|
+
end
|
8
|
+
|
9
|
+
specify "should call filter_logged_in when user not logged in" do
|
10
|
+
@controller.should_receive(:filter_logged_in).and_return(false)
|
11
|
+
@controller.filter_user_foo.should be_false
|
12
|
+
end
|
13
|
+
|
14
|
+
specify "should call filter_in_user_table() when user logged in" do
|
15
|
+
@controller.stub!(:filter_logged_in).and_return(true)
|
16
|
+
@controller.should_receive(:filter_in_user_table).and_return(false)
|
17
|
+
@controller.stub!(:redirect_to)
|
18
|
+
@controller.stub!(:not_authorized_url).and_return("nal")
|
19
|
+
@controller.filter_user_foo.should be_false
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
context "For a logged in user in the user table" do
|
24
|
+
setup do
|
25
|
+
@controller = new_controller()
|
26
|
+
@user = mock("user")
|
27
|
+
@controller.stub!(:filter_logged_in).and_return(true)
|
28
|
+
@controller.stub!(:filter_in_user_table).and_return(true)
|
29
|
+
@controller.stub!(:user_table_user).and_return(@user)
|
30
|
+
@controller.stub!(:redirect_to)
|
31
|
+
@controller.stub!(:not_authorized_url).and_return("nal")
|
32
|
+
end
|
33
|
+
|
34
|
+
specify "filter_user_method returns 'true' if user.method does" do
|
35
|
+
@user.stub!(:true_method).and_return(true)
|
36
|
+
@controller.filter_user_true_method.should be_true
|
37
|
+
end
|
38
|
+
|
39
|
+
specify "filter_user_method returns 'false' if user.method does" do
|
40
|
+
@user.stub!(:false_method).and_return(false)
|
41
|
+
@controller.filter_user_false_method.should be_false
|
42
|
+
end
|
43
|
+
|
44
|
+
specify "filter_user_column__eq__value returns 'true' if column == 'value'" do
|
45
|
+
@user.stub!(:column).and_return("a")
|
46
|
+
@controller.filter_user_column__eq__a.should be_true
|
47
|
+
@controller.filter_user_column__eq__b.should be_false
|
48
|
+
end
|
49
|
+
|
50
|
+
specify "filter_user_column__ne__value returns 'true' if column != 'value'" do
|
51
|
+
@user.stub!(:column).and_return("a")
|
52
|
+
@controller.filter_user_column__ne__a.should be_false
|
53
|
+
@controller.filter_user_column__ne__b.should be_true
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,226 @@
|
|
1
|
+
require "#{File.dirname(__FILE__)}/_setup.rb"
|
2
|
+
|
3
|
+
describe "ActiveRecord::User after application login" do
|
4
|
+
before(:all) do
|
5
|
+
RAILS_ENV = "re"
|
6
|
+
end
|
7
|
+
|
8
|
+
before(:each) do
|
9
|
+
UCB::LDAP::Person.should_receive(:find_by_uid).and_return("ldap_user")
|
10
|
+
@controller = new_controller()
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should not be accessed if not using user table" do
|
14
|
+
UCB::Rails::Security.using_user_table = false
|
15
|
+
User.should_not_receive(:find_by_ldap_uid)
|
16
|
+
@controller.application_login("1")
|
17
|
+
end
|
18
|
+
|
19
|
+
specify "should be accessed if using user table" do
|
20
|
+
UCB::Rails::Security.using_user_table = true
|
21
|
+
User.should_receive(:find_by_ldap_uid)
|
22
|
+
@controller.application_login("1")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
# -----------------------------------------------
|
27
|
+
# UserNotLoggedIn Shared Behavior
|
28
|
+
# -----------------------------------------------
|
29
|
+
|
30
|
+
def user_not_logged_in_setup
|
31
|
+
@ca = reset_cas_authentication_class()
|
32
|
+
@controller = new_controller()
|
33
|
+
end
|
34
|
+
|
35
|
+
context "UserNotLoggedIn", :shared => true do
|
36
|
+
specify "user should not be logged in" do
|
37
|
+
@controller.should_not be_logged_in
|
38
|
+
end
|
39
|
+
|
40
|
+
specify "ldap_uid should not be set" do
|
41
|
+
@controller.ldap_uid.should be_nil
|
42
|
+
end
|
43
|
+
|
44
|
+
specify "ldap user should not be set" do
|
45
|
+
@controller.ldap_user.should be_nil
|
46
|
+
end
|
47
|
+
|
48
|
+
specify "filter_logged_in should call CASAuthentication.filter" do
|
49
|
+
UCB::Rails::Security::CASAuthentication.should_receive(:filter).and_return(false)
|
50
|
+
@controller.filter_logged_in().should be_false
|
51
|
+
end
|
52
|
+
|
53
|
+
specify "filter_logged_in should call application_login if CAS auth returns true" do
|
54
|
+
UCB::Rails::Security::CASAuthentication.should_receive(:filter).and_return(true)
|
55
|
+
@controller.should_receive(:application_login)
|
56
|
+
@controller.filter_logged_in().should be_true
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
# -----------------------------------------------
|
61
|
+
# UserLoggedIn Shared Behavior
|
62
|
+
# -----------------------------------------------
|
63
|
+
|
64
|
+
def user_logged_in_setup()
|
65
|
+
@ldap_uid = '42'
|
66
|
+
@ldap_user = mock("ldap_user")
|
67
|
+
@ldap_user.stub!(:ldap_uid).and_return(@ldap_uid)
|
68
|
+
UCB::LDAP::Person.stub!(:find_by_uid).and_return(@ldap_user)
|
69
|
+
@controller = new_controller()
|
70
|
+
@controller.session[:cas_user] = @ldap_uid # CAS::Filter does this
|
71
|
+
@controller.stub!(:update_user_table)
|
72
|
+
@controller.application_login
|
73
|
+
end
|
74
|
+
|
75
|
+
context "UserLoggedIn", :shared => true do
|
76
|
+
specify "ldap_user() returns LDAP entry for user" do
|
77
|
+
@controller.ldap_user.should be_equal(@ldap_user)
|
78
|
+
end
|
79
|
+
|
80
|
+
specify "attempt to authenticate should not redirect to CAS" do
|
81
|
+
CAS::Filter.should_not_receive(:filter)
|
82
|
+
@controller.filter_logged_in.should be_true
|
83
|
+
end
|
84
|
+
|
85
|
+
specify "user should be logged in" do
|
86
|
+
@controller.should be_logged_in
|
87
|
+
end
|
88
|
+
|
89
|
+
specify "ldap_uid() returns the ldap_uid" do
|
90
|
+
@controller.ldap_uid.should == @ldap_uid
|
91
|
+
end
|
92
|
+
|
93
|
+
end
|
94
|
+
|
95
|
+
# -----------------------------------------------
|
96
|
+
# UserNotInTable Shared Behavior
|
97
|
+
# -----------------------------------------------
|
98
|
+
|
99
|
+
def user_not_in_table_setup
|
100
|
+
UCB::Rails::Security.using_user_table = true
|
101
|
+
User.stub!(:find_by_ldap_uid).and_return(nil)
|
102
|
+
end
|
103
|
+
|
104
|
+
context "UserNotInTable", :shared => true do
|
105
|
+
specify "should be using user table" do
|
106
|
+
@controller.should be_using_user_table
|
107
|
+
end
|
108
|
+
|
109
|
+
specify "should not be in user table" do
|
110
|
+
@controller.should_not be_in_user_table
|
111
|
+
end
|
112
|
+
|
113
|
+
specify "user id should not be set" do
|
114
|
+
@controller.user_table_id.should be_nil
|
115
|
+
end
|
116
|
+
|
117
|
+
specify "user table user should not be set" do
|
118
|
+
@controller.user_table_user.should be_nil
|
119
|
+
end
|
120
|
+
|
121
|
+
end
|
122
|
+
|
123
|
+
# -----------------------------------------------
|
124
|
+
# UserInTable Shared Behavior
|
125
|
+
# -----------------------------------------------
|
126
|
+
|
127
|
+
def user_in_table_setup
|
128
|
+
UCB::Rails::Security.using_user_table = true
|
129
|
+
@user_table_id = 42
|
130
|
+
@user = mock("user")
|
131
|
+
@user.stub!(:id).and_return(@user_table_id)
|
132
|
+
User.stub!(:find_by_ldap_uid).and_return(@user)
|
133
|
+
User.stub!(:find).and_return(@user)
|
134
|
+
end
|
135
|
+
|
136
|
+
context "UserInTable", :shared => true do
|
137
|
+
|
138
|
+
specify "should be using user table" do
|
139
|
+
@controller.should be_using_user_table
|
140
|
+
end
|
141
|
+
|
142
|
+
specify "user table user should be user set" do
|
143
|
+
@controller.user_table_user.should be_equal(@user)
|
144
|
+
end
|
145
|
+
|
146
|
+
specify "should be in user table" do
|
147
|
+
@controller.should be_in_user_table
|
148
|
+
end
|
149
|
+
|
150
|
+
specify "user id should be set" do
|
151
|
+
@controller.user_table_id.should == @user_table_id
|
152
|
+
end
|
153
|
+
|
154
|
+
end
|
155
|
+
|
156
|
+
# -----------------------------------------------
|
157
|
+
# Not logged in, not in user table
|
158
|
+
# -----------------------------------------------
|
159
|
+
|
160
|
+
context "Not logged in, not in user table" do
|
161
|
+
setup do
|
162
|
+
user_not_in_table_setup()
|
163
|
+
user_not_logged_in_setup()
|
164
|
+
end
|
165
|
+
|
166
|
+
it_should_behave_like "UserNotLoggedIn"
|
167
|
+
it_should_behave_like "UserNotInTable"
|
168
|
+
end
|
169
|
+
|
170
|
+
# -----------------------------------------------
|
171
|
+
# Not logged in, in user table
|
172
|
+
# -----------------------------------------------
|
173
|
+
|
174
|
+
context "Not logged in, in user table" do
|
175
|
+
setup do
|
176
|
+
user_in_table_setup()
|
177
|
+
user_not_logged_in_setup()
|
178
|
+
end
|
179
|
+
|
180
|
+
it_should_behave_like "UserNotLoggedIn"
|
181
|
+
it_should_behave_like "UserNotInTable"
|
182
|
+
end
|
183
|
+
|
184
|
+
# -----------------------------------------------
|
185
|
+
# Logged in, not in user table
|
186
|
+
# -----------------------------------------------
|
187
|
+
|
188
|
+
context "Logged in user, not in user table" do
|
189
|
+
setup do
|
190
|
+
user_not_in_table_setup()
|
191
|
+
user_logged_in_setup()
|
192
|
+
end
|
193
|
+
|
194
|
+
it_should_behave_like "UserLoggedIn"
|
195
|
+
it_should_behave_like "UserNotInTable"
|
196
|
+
end
|
197
|
+
|
198
|
+
# -----------------------------------------------
|
199
|
+
# Logged in, in user table
|
200
|
+
# -----------------------------------------------
|
201
|
+
|
202
|
+
context "Logged in user, in user table" do
|
203
|
+
setup do
|
204
|
+
user_in_table_setup()
|
205
|
+
user_logged_in_setup()
|
206
|
+
end
|
207
|
+
|
208
|
+
it_should_behave_like "UserLoggedIn"
|
209
|
+
it_should_behave_like "UserInTable"
|
210
|
+
end
|
211
|
+
|
212
|
+
# -----------------------------------------------
|
213
|
+
# After logout, looks like not logged in
|
214
|
+
# -----------------------------------------------
|
215
|
+
|
216
|
+
context "Logged in user, in user table, after logout" do
|
217
|
+
setup do
|
218
|
+
user_in_table_setup()
|
219
|
+
user_logged_in_setup()
|
220
|
+
@controller.application_logout()
|
221
|
+
end
|
222
|
+
|
223
|
+
it_should_behave_like "UserNotLoggedIn"
|
224
|
+
it_should_behave_like "UserNotInTable"
|
225
|
+
end
|
226
|
+
|
@@ -0,0 +1,83 @@
|
|
1
|
+
require "#{File.dirname(__FILE__)}/_setup.rb"
|
2
|
+
|
3
|
+
describe UCB::Rails::Security::CASAuthentication do
|
4
|
+
before(:all) do
|
5
|
+
RAILS_ENV = "re"
|
6
|
+
end
|
7
|
+
|
8
|
+
before(:each) do
|
9
|
+
@ca = reset_cas_authentication_class()
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should set test CAS base url constant" do
|
13
|
+
@ca::CAS_BASE_URL_TEST.should be_instance_of(String)
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should set production CAS base url constant" do
|
17
|
+
@ca::CAS_BASE_URL_PRODUCTION.should be_instance_of(String)
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should default environment to RAILS_ENV" do
|
21
|
+
@ca.environment.should == RAILS_ENV
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should use the CAS production url for production" do
|
25
|
+
@ca.stub!(:environment).and_return("production")
|
26
|
+
@ca.cas_base_url.should == @ca::CAS_BASE_URL_PRODUCTION
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should use the CAS test url for every thing else" do
|
30
|
+
%w{development test qa bogus}.each do |environment|
|
31
|
+
@ca.stub!(:environment).and_return(environment)
|
32
|
+
@ca.cas_base_url.should == @ca::CAS_BASE_URL_TEST
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should allow application to set CAS url" do
|
37
|
+
@ca.cas_base_url = "x"
|
38
|
+
@ca.cas_base_url.should == "x"
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should default not allowing test entries for production environment" do
|
42
|
+
@ca.stub!(:environment).and_return(@ca::ENV_PRODUCTION)
|
43
|
+
@ca.allow_test_entries?.should be_false
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should default to allowing test entries for any environment other than production" do
|
47
|
+
%w{development crap quality_assurance}.each do |env|
|
48
|
+
@ca.stub!(:environment).and_return(env)
|
49
|
+
@ca.allow_test_entries?.should be_true
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should allow allow_test_entries to be set" do
|
54
|
+
@ca.allow_test_entries = true
|
55
|
+
@ca.stub!(:environment).and_return(@ca::ENV_PRODUCTION)
|
56
|
+
@ca.allow_test_entries?.should be_true
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
describe "UCB::Rails::Security::CASAuthentication filter" do
|
61
|
+
before(:each) do
|
62
|
+
@ca = reset_cas_authentication_class()
|
63
|
+
end
|
64
|
+
|
65
|
+
it "should succeed when CAS returns true" do
|
66
|
+
CASClient::Frameworks::Rails::Filter.stub!(:filter).and_return(true)
|
67
|
+
@ca.filter(new_controller()).should be_true
|
68
|
+
end
|
69
|
+
|
70
|
+
it "should fail when CAS returns false" do
|
71
|
+
CASClient::Frameworks::Rails::Filter.stub!(:filter).and_return(false)
|
72
|
+
@ca.filter(new_controller()).should be_false
|
73
|
+
end
|
74
|
+
|
75
|
+
it "should return true and set ldap_uid on demand in test environment" do
|
76
|
+
@controller = new_controller()
|
77
|
+
CASClient::Frameworks::Rails::Filter.stub!(:filter).and_return(false)
|
78
|
+
@ca.stub!(:environment).and_return(@ca::ENV_TEST)
|
79
|
+
@ca.force_login_filter_true_for = '123'
|
80
|
+
@ca.filter(@controller).should == true
|
81
|
+
@controller.ldap_uid.should == '123'
|
82
|
+
end
|
83
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require "#{File.dirname(__FILE__)}/_setup.rb"
|
2
|
+
|
3
|
+
describe UCB::Rails::Security do
|
4
|
+
before(:each) do
|
5
|
+
@urs = UCB::Rails::Security
|
6
|
+
@urs.reset_instance_variables()
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should load the ruby-cas gem" do
|
10
|
+
lambda { CAS::Filter }.should_not raise_error
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should load the ucb-ldap gem" do
|
14
|
+
lambda { UCB::LDAP }.should_not raise_error
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should default to not using user table" do
|
18
|
+
@urs.should_not be_using_user_table
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should allow application to use user table" do
|
22
|
+
@urs.using_user_table = true
|
23
|
+
@urs.should be_using_user_table
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should default not_authorized_url() to '/not_authorized'" do
|
27
|
+
@urs.not_authorized_url.should == '/not_authorized'
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should allow application to set its own 'not_authorized_url'" do
|
31
|
+
@urs.not_authorized_url = 'my_nau'
|
32
|
+
@urs.not_authorized_url.should == 'my_nau'
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
ENV["RAILS_ENV"] = "test"
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
|
3
|
+
require 'test_help'
|
4
|
+
|
5
|
+
class Test::Unit::TestCase
|
6
|
+
# Transactional fixtures accelerate your tests by wrapping each test method
|
7
|
+
# in a transaction that's rolled back on completion. This ensures that the
|
8
|
+
# test database remains unchanged so your fixtures don't have to be reloaded
|
9
|
+
# between every test method. Fewer database queries means faster tests.
|
10
|
+
#
|
11
|
+
# Read Mike Clark's excellent walkthrough at
|
12
|
+
# http://clarkware.com/cgi/blosxom/2005/10/24#Rails10FastTesting
|
13
|
+
#
|
14
|
+
# Every Active Record database supports transactions except MyISAM tables
|
15
|
+
# in MySQL. Turn off transactional fixtures in this case; however, if you
|
16
|
+
# don't care one way or the other, switching from MyISAM to InnoDB tables
|
17
|
+
# is recommended.
|
18
|
+
#
|
19
|
+
# The only drawback to using transactional fixtures is when you actually
|
20
|
+
# need to test transactions. Since your test is bracketed by a transaction,
|
21
|
+
# any transactions started in your code will be automatically rolled back.
|
22
|
+
self.use_transactional_fixtures = true
|
23
|
+
|
24
|
+
# Instantiated fixtures are slow, but give you @david where otherwise you
|
25
|
+
# would need people(:david). If you don't want to migrate your existing
|
26
|
+
# test cases which use the @david style and don't mind the speed hit (each
|
27
|
+
# instantiated fixtures translates to a database query per test method),
|
28
|
+
# then set this back to true.
|
29
|
+
self.use_instantiated_fixtures = false
|
30
|
+
|
31
|
+
# Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
|
32
|
+
#
|
33
|
+
# Note: You'll currently still have to declare fixtures explicitly in integration tests
|
34
|
+
# -- they do not yet inherit this setting
|
35
|
+
fixtures :all
|
36
|
+
|
37
|
+
# Add more helper methods to be used by all tests here...
|
38
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
ENV["RAILS_ENV"] = "test"
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
|
3
|
+
require 'test_help'
|
4
|
+
|
5
|
+
class Test::Unit::TestCase
|
6
|
+
# Transactional fixtures accelerate your tests by wrapping each test method
|
7
|
+
# in a transaction that's rolled back on completion. This ensures that the
|
8
|
+
# test database remains unchanged so your fixtures don't have to be reloaded
|
9
|
+
# between every test method. Fewer database queries means faster tests.
|
10
|
+
#
|
11
|
+
# Read Mike Clark's excellent walkthrough at
|
12
|
+
# http://clarkware.com/cgi/blosxom/2005/10/24#Rails10FastTesting
|
13
|
+
#
|
14
|
+
# Every Active Record database supports transactions except MyISAM tables
|
15
|
+
# in MySQL. Turn off transactional fixtures in this case; however, if you
|
16
|
+
# don't care one way or the other, switching from MyISAM to InnoDB tables
|
17
|
+
# is recommended.
|
18
|
+
#
|
19
|
+
# The only drawback to using transactional fixtures is when you actually
|
20
|
+
# need to test transactions. Since your test is bracketed by a transaction,
|
21
|
+
# any transactions started in your code will be automatically rolled back.
|
22
|
+
self.use_transactional_fixtures = true
|
23
|
+
|
24
|
+
# Instantiated fixtures are slow, but give you @david where otherwise you
|
25
|
+
# would need people(:david). If you don't want to migrate your existing
|
26
|
+
# test cases which use the @david style and don't mind the speed hit (each
|
27
|
+
# instantiated fixtures translates to a database query per test method),
|
28
|
+
# then set this back to true.
|
29
|
+
self.use_instantiated_fixtures = false
|
30
|
+
|
31
|
+
# Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
|
32
|
+
#
|
33
|
+
# Note: You'll currently still have to declare fixtures explicitly in integration tests
|
34
|
+
# -- they do not yet inherit this setting
|
35
|
+
fixtures :all
|
36
|
+
|
37
|
+
# Add more helper methods to be used by all tests here...
|
38
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{ucb_rails_security}
|
5
|
+
s.version = "2.0.7"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Steven Hansen, Steven Downey"]
|
9
|
+
s.date = %q{2008-12-14}
|
10
|
+
s.description = %q{Simplifies CAS auth and ldap authz within your rails application}
|
11
|
+
s.email = %q{runner@berkeley.edu}
|
12
|
+
s.extra_rdoc_files = ["CHANGELOG", "README", "lib/helpers/rspec_helpers.rb", "lib/tasks/ucb_rails_security.rake", "lib/ucb_rails_security.rb", "lib/ucb_rails_security_casauthentication.rb", "lib/ucb_rails_security_logger.rb", "lib/ucb_rs_controller_methods.rb", "rdoc_includes/application_controller_rb.txt"]
|
13
|
+
s.files = ["CHANGELOG", "Manifest", "README", "Rakefile", "TODO", "generators/ucb_rails_security/templates/controllers/ucb_security/base_controller.rb", "generators/ucb_rails_security/templates/controllers/ucb_security/ldap_search_controller.rb", "generators/ucb_rails_security/templates/controllers/ucb_security/role_users_controller.rb", "generators/ucb_rails_security/templates/controllers/ucb_security/roles_controller.rb", "generators/ucb_rails_security/templates/controllers/ucb_security/user_roles_controller.rb", "generators/ucb_rails_security/templates/controllers/ucb_security/users_controller.rb", "generators/ucb_rails_security/templates/db/migrate/xxx_create_ucb_rails_security_tables.rb", "generators/ucb_rails_security/templates/helpers/ucb_security/base_helper.rb", "generators/ucb_rails_security/templates/helpers/ucb_security/builder.rb", "generators/ucb_rails_security/templates/helpers/ucb_security/roles_helper.rb", "generators/ucb_rails_security/templates/helpers/ucb_security/users_helper.rb", "generators/ucb_rails_security/templates/initializers/ucb_security_config.rb", "generators/ucb_rails_security/templates/javascripts/ucb_security.js", "generators/ucb_rails_security/templates/models/ldap_search.rb", "generators/ucb_rails_security/templates/models/role.rb", "generators/ucb_rails_security/templates/models/user.rb", "generators/ucb_rails_security/templates/models/user_roles.rb", "generators/ucb_rails_security/templates/stylesheets/ucb_security.css", "generators/ucb_rails_security/templates/views/layouts/ucb_security/_main_navigation.html.erb", "generators/ucb_rails_security/templates/views/layouts/ucb_security/application.html.erb", "generators/ucb_rails_security/templates/views/ucb_security/ldap_search/index.html.erb", "generators/ucb_rails_security/templates/views/ucb_security/role_users/_new.html.erb", "generators/ucb_rails_security/templates/views/ucb_security/role_users/edit.html.erb", "generators/ucb_rails_security/templates/views/ucb_security/roles/_users.html.erb", "generators/ucb_rails_security/templates/views/ucb_security/roles/edit.html.erb", "generators/ucb_rails_security/templates/views/ucb_security/roles/index.html.erb", "generators/ucb_rails_security/templates/views/ucb_security/roles/new.html.erb", "generators/ucb_rails_security/templates/views/ucb_security/roles/show.html.erb", "generators/ucb_rails_security/templates/views/ucb_security/user_roles/edit.html.erb", "generators/ucb_rails_security/templates/views/ucb_security/users/edit.html.erb", "generators/ucb_rails_security/templates/views/ucb_security/users/index.html.erb", "generators/ucb_rails_security/templates/views/ucb_security/users/new.html.erb", "generators/ucb_rails_security/templates/views/ucb_security/users/show.html.erb", "generators/ucb_rails_security/ucb_rails_security_generator.rb", "init.rb", "lib/helpers/rspec_helpers.rb", "lib/tasks/ucb_rails_security.rake", "lib/ucb_rails_security.rb", "lib/ucb_rails_security_casauthentication.rb", "lib/ucb_rails_security_logger.rb", "lib/ucb_rs_controller_methods.rb", "rdoc_includes/application_controller_rb.txt", "rspec/_all_specs.rb", "rspec/_setup.rb", "rspec/filter_ldap_spec.rb", "rspec/filter_role_spec.rb", "rspec/filter_spec.rb", "rspec/filter_user_spec.rb", "rspec/logged_in_status_spec.rb", "rspec/ucb_rails_security_casauthentication_spec.rb", "rspec/ucb_rails_security_spec.rb", "ucb_rails_security.gemspec", "test/test_rails-2.0.x/test/test_helper.rb", "test/test_rails-2.1.x/test/test_helper.rb"]
|
14
|
+
s.has_rdoc = true
|
15
|
+
s.homepage = %q{http://ucbrb.rubyforge.org/ucb_rails_security}
|
16
|
+
s.rdoc_options = ["-o doc --inline-source -T hanna lib/*.rb"]
|
17
|
+
s.require_paths = ["lib"]
|
18
|
+
s.rubyforge_project = %q{ucbrb}
|
19
|
+
s.rubygems_version = %q{1.3.0}
|
20
|
+
s.summary = %q{Simplifies CAS auth and ldap authz within your rails application}
|
21
|
+
s.test_files = ["test/test_rails-2.0.x/test/test_helper.rb", "test/test_rails-2.1.x/test/test_helper.rb"]
|
22
|
+
|
23
|
+
if s.respond_to? :specification_version then
|
24
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
25
|
+
s.specification_version = 2
|
26
|
+
|
27
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
28
|
+
s.add_runtime_dependency(%q<ucb_ldap>, [">= 0"])
|
29
|
+
s.add_runtime_dependency(%q<>=>, ["= 1.3.0"])
|
30
|
+
s.add_development_dependency(%q<echoe>, [">= 0"])
|
31
|
+
else
|
32
|
+
s.add_dependency(%q<ucb_ldap>, [">= 0"])
|
33
|
+
s.add_dependency(%q<>=>, ["= 1.3.0"])
|
34
|
+
s.add_dependency(%q<echoe>, [">= 0"])
|
35
|
+
end
|
36
|
+
else
|
37
|
+
s.add_dependency(%q<ucb_ldap>, [">= 0"])
|
38
|
+
s.add_dependency(%q<>=>, ["= 1.3.0"])
|
39
|
+
s.add_dependency(%q<echoe>, [">= 0"])
|
40
|
+
end
|
41
|
+
end
|