casablanca 0.1.0 → 0.1.1
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/README.txt +19 -16
- data/lib/casablanca.rb +1 -1
- metadata +2 -2
data/README.txt
CHANGED
@@ -10,8 +10,6 @@ Casablanca is a ruby single sign-on client for the CAS 2.0 protocol.
|
|
10
10
|
|
11
11
|
* Includes a commandline Client to test getting service tickets from a CAS server
|
12
12
|
* It can be run as a Rails plugin.
|
13
|
-
* Gatewaying (permitting the user to continue without authentication) is not implemented.
|
14
|
-
Just skip the filter for those actions.
|
15
13
|
|
16
14
|
== TODO:
|
17
15
|
|
@@ -21,7 +19,7 @@ Casablanca is a ruby single sign-on client for the CAS 2.0 protocol.
|
|
21
19
|
|
22
20
|
== SYNOPSIS:
|
23
21
|
|
24
|
-
Commandline:
|
22
|
+
=== Commandline:
|
25
23
|
|
26
24
|
% casablanca
|
27
25
|
|
@@ -36,7 +34,7 @@ In IRB:
|
|
36
34
|
C.authenticate_ticket(ticket)
|
37
35
|
|
38
36
|
|
39
|
-
|
37
|
+
=== Rails:
|
40
38
|
- environment.rb:
|
41
39
|
|
42
40
|
Casablanca::Rails::Config.config do |config|
|
@@ -45,25 +43,30 @@ In a Rails project:
|
|
45
43
|
config[:renew] = true
|
46
44
|
end
|
47
45
|
|
48
|
-
|
46
|
+
|
49
47
|
|
50
48
|
before_filter Casablanca::Rails::Filter
|
49
|
+
# If you want users without credentials to view the page as well use the Gateway filter
|
50
|
+
# before_filter Casablanca::Rails::GatewayFilter
|
51
|
+
|
52
|
+
|
53
|
+
- Add something like the following to application.rb to get the current user from the Cas session:
|
51
54
|
|
52
|
-
def
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
def login_from_cas
|
57
|
-
if session[:cas_user]
|
58
|
-
person = Person.find_by_name(session[:cas_user])
|
59
|
-
logout_killing_session! unless person
|
60
|
-
person
|
55
|
+
def current_user
|
56
|
+
if session[:cas_user] && @user.nil?
|
57
|
+
@user = User.find_by_name(session[:cas_user])
|
58
|
+
logout_killing_session! unless @user
|
61
59
|
end
|
60
|
+
@user
|
62
61
|
end
|
63
62
|
|
64
|
-
-
|
63
|
+
- Your logout action could look like:
|
65
64
|
|
66
|
-
|
65
|
+
def logout
|
66
|
+
Casablanca::Rails::Filter.logout(self)
|
67
|
+
redirect_to Casablanca::RailsFilter.logout_url(self)
|
68
|
+
end
|
69
|
+
|
67
70
|
|
68
71
|
== REQUIREMENTS:
|
69
72
|
|
data/lib/casablanca.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: casablanca
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Petrik de Heus
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-02-
|
12
|
+
date: 2009-02-19 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|