rack-cas 0.3.2 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +12 -13
- data/lib/rack-cas.rb +2 -0
- data/lib/rack-cas/railtie.rb +15 -0
- data/lib/rack-cas/version.rb +1 -1
- metadata +3 -2
data/README.markdown
CHANGED
@@ -27,10 +27,11 @@ Rails
|
|
27
27
|
|
28
28
|
Add `gem 'rack-cas'` to your [`Gemfile`](http://gembundler.com/gemfile.html) and run `bundle install`
|
29
29
|
|
30
|
-
|
30
|
+
Once the necessary gems have been installed, in your `config/application.rb` add:
|
31
31
|
|
32
|
-
|
33
|
-
|
32
|
+
config.rack_cas.server_url = 'https://cas.example.com/'
|
33
|
+
|
34
|
+
If the the server URL depends on your environment, you can define it in the according file: `config/environments/<env>.rb`
|
34
35
|
|
35
36
|
### Single Sign Out ###
|
36
37
|
|
@@ -38,13 +39,10 @@ If you wish to enable [single sign out](https://wiki.jasig.org/display/CASUM/Sin
|
|
38
39
|
|
39
40
|
#### Active Record ####
|
40
41
|
|
41
|
-
Set the `session_store` in `config/
|
42
|
+
Set the `session_store` in your `config/application.rb`:
|
42
43
|
|
43
|
-
require 'rack/cas'
|
44
44
|
require 'rack-cas/session_store/active_record'
|
45
|
-
|
46
|
-
server_url: 'https://login.example.com/cas',
|
47
|
-
session_store: RackCAS::ActiveRecordStore
|
45
|
+
config.rack_cas.session_store = RackCAS::ActiveRecordStore
|
48
46
|
|
49
47
|
Edit your `config/initializers/session_store.rb` file with the following:
|
50
48
|
|
@@ -58,13 +56,10 @@ Run:
|
|
58
56
|
|
59
57
|
#### Mongoid ####
|
60
58
|
|
61
|
-
Set the `session_store` in `config/
|
59
|
+
Set the `session_store` in your `config/application.rb`:
|
62
60
|
|
63
|
-
require 'rack/cas'
|
64
61
|
require 'rack-cas/session_store/mongoid'
|
65
|
-
|
66
|
-
server_url: 'https://login.example.com/cas',
|
67
|
-
session_store: RackCAS::MongoidStore
|
62
|
+
config.rack_cas.session_store = RackCAS::MongoidStore
|
68
63
|
|
69
64
|
Edit your `config/initializers/session_store.rb` file with the following:
|
70
65
|
|
@@ -114,6 +109,10 @@ Integration testing using something like [Capybara](http://jnicklas.github.com/c
|
|
114
109
|
require 'rack/fake_cas'
|
115
110
|
use Rack::FakeCAS
|
116
111
|
|
112
|
+
If you are using Rails, FakeCAS is automatically used in the test environment by default. If you would like to activate it in any other environment, add the following to the corresponding `config/environments/<env>.rb`:
|
113
|
+
|
114
|
+
config.rack_cas.fake = true
|
115
|
+
|
117
116
|
Then you can simply do the following in your integration tests in order to log in.
|
118
117
|
|
119
118
|
visit '/restricted_path'
|
data/lib/rack-cas.rb
CHANGED
@@ -0,0 +1,15 @@
|
|
1
|
+
module RackCAS
|
2
|
+
class Railtie < Rails::Railtie
|
3
|
+
config.rack_cas = ActiveSupport::OrderedOptions.new
|
4
|
+
|
5
|
+
initializer 'rack_cas.initialize' do |app|
|
6
|
+
if config.rack_cas.fake || (config.rack_cas.fake.nil? && Rails.env.test?)
|
7
|
+
require 'rack/fake_cas'
|
8
|
+
app.middleware.use Rack::FakeCAS
|
9
|
+
elsif !config.rack_cas.server_url.nil? # for backwards compatibility
|
10
|
+
require 'rack/cas'
|
11
|
+
app.middleware.use Rack::CAS, config.rack_cas
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/lib/rack-cas/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-cas
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-01-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rack
|
@@ -120,6 +120,7 @@ files:
|
|
120
120
|
- lib/rack-cas.rb
|
121
121
|
- lib/rack-cas/url.rb
|
122
122
|
- lib/rack-cas/version.rb
|
123
|
+
- lib/rack-cas/railtie.rb
|
123
124
|
- lib/rack-cas/session_store/rails/mongo.rb
|
124
125
|
- lib/rack-cas/session_store/rails/active_record.rb
|
125
126
|
- lib/rack-cas/session_store/rails/mongoid.rb
|