cassiopeia 0.0.1 → 0.0.2
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 +73 -1
- data/Rakefile +1 -1
- metadata +1 -1
data/README
CHANGED
@@ -1,8 +1,80 @@
|
|
1
|
-
Cassiopeia
|
1
|
+
Cassiopeia (0.0.2)
|
2
2
|
===================
|
3
3
|
|
4
4
|
Yet another custom CAS client/server implementation
|
5
5
|
|
6
|
+
Changelog:
|
7
|
+
0.0.2 - Added some doc
|
8
|
+
|
9
|
+
---------------------------------------------
|
10
|
+
== Installation ==
|
11
|
+
|
12
|
+
$ sudo gem install cassiopeia
|
13
|
+
|
14
|
+
Add this line to environment.rb:
|
15
|
+
config.gem 'cassiopeia'
|
16
|
+
|
17
|
+
---------------------------------------------
|
18
|
+
== Client configuration ==
|
19
|
+
|
20
|
+
Create a file named config/cassiopeia.yml:
|
21
|
+
server_url: "https://localhost/cassiopeia" # Url of cassiopeia server in your environment
|
22
|
+
service_url: "https://localhost/myservice" # Url of your application (for cas to redirect back)
|
23
|
+
service_id: "test" # Identification of your service (for informational and security purpose)
|
24
|
+
|
25
|
+
-- Usage:
|
26
|
+
Add this line to application_controller.rb:
|
27
|
+
|
28
|
+
use_cas_authorization
|
29
|
+
|
30
|
+
This will force your application to request authorization from cassiopeia server.
|
31
|
+
You can also check required roles to access some controllers. To do this, you should add the following line to your controller:
|
32
|
+
|
33
|
+
cas_require_roles :doctor, :admin
|
34
|
+
|
35
|
+
This will raise the Cassiopeia::AccessDeniedException if user try to access this controller. You can rescue from this exception by adding the following to application_controller.rb:
|
36
|
+
|
37
|
+
rescue_from 'Cassiopeia::AccessDeniedException', :with => :access_denied
|
38
|
+
|
39
|
+
def access_denied
|
40
|
+
flash[:notice] = 'Access denied. You dont have permissions to access this page'
|
41
|
+
redirect_to root_path
|
42
|
+
end
|
43
|
+
|
44
|
+
---------------------------------------------
|
45
|
+
== Server configuration ==
|
46
|
+
Create a file named config/cassiopeia.yml:
|
47
|
+
|
48
|
+
# Ticket max lifetime (in minutes)
|
49
|
+
ticket_max_lifetime: 5
|
50
|
+
|
51
|
+
Generate new controller named Cas. Generate new model named CasTicket. Create migration for your CasTicket:
|
52
|
+
|
53
|
+
def self.up
|
54
|
+
create_table :cas_tickets do |t|
|
55
|
+
t.references :user, :foreign_key => true
|
56
|
+
t.string :identity
|
57
|
+
t.datetime :expires_at
|
58
|
+
t.string :service, :limit=>2400
|
59
|
+
t.timestamps
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def self.down
|
64
|
+
drop_table :cas_tickets
|
65
|
+
end
|
66
|
+
|
67
|
+
Add the following lines to your cas_controller:
|
68
|
+
|
69
|
+
acts_as_cas_controller do |c|
|
70
|
+
c.ticketClass = CasTicket
|
71
|
+
end
|
72
|
+
|
73
|
+
Add the following lines to your CasTicket:
|
74
|
+
|
75
|
+
acts_as_cas_ticket
|
76
|
+
belongs_to :user
|
77
|
+
|
6
78
|
===================
|
7
79
|
|
8
80
|
Copyright (c) 2010 Waveaccess LLC
|
data/Rakefile
CHANGED