cassiopeia 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/README.rdoc +24 -21
  2. data/Rakefile +1 -1
  3. data/lib/cassiopeia/config.rb +2 -1
  4. metadata +1 -1
data/README.rdoc CHANGED
@@ -7,6 +7,7 @@
7
7
  - Yet another custom CAS client/server implementation
8
8
 
9
9
  = Changelog:
10
+ - 0.0.4: Fixed problem with default config
10
11
  - 0.0.3: Added required dependency simple_rest. Doc extended.
11
12
  - 0.0.2: Added some doc
12
13
 
@@ -14,23 +15,25 @@
14
15
  == SYNOPSIS:
15
16
  === Client configuration
16
17
  <b>Create a file named config/cassiopeia.yml:</b>
17
-
18
18
  server_url: "https://localhost/cassiopeia" # Url of cassiopeia server in your environment
19
19
  service_url: "https://localhost/myservice" # Url of your application (for cas to redirect back)
20
20
  service_id: "test" # Identification of your service (for informational and security purpose)
21
+ # additional options and their default values:
22
+ server_controller: "cas"
23
+ session_id_key: "cassiopeia_sesion_id"
24
+ ticket_id_key: "cas_ticket_id"
25
+ service_id_key: "cas_service_id"
26
+ service_url_key: "cas_service_url"
21
27
 
22
28
  ==== Usage:
23
29
  <b>Add this line to application_controller.rb:</b>
24
-
25
30
  use_cas_authorization
26
31
 
27
32
  This will force your application to request authorization from cassiopeia server.
28
33
  You can also check required roles to access some controllers. To do this, you should add the following line to your controller:
29
-
30
34
  cas_require_roles :doctor, :admin
31
35
 
32
36
  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:
33
-
34
37
  rescue_from 'Cassiopeia::AccessDeniedException', :with => :access_denied
35
38
  def access_denied
36
39
  flash[:notice] = 'Access denied. You dont have permissions to access this page'
@@ -38,14 +41,15 @@ This will raise the Cassiopeia::AccessDeniedException if user try to access this
38
41
  end
39
42
 
40
43
  === Server configuration
41
- - Create a file named config/cassiopeia.yml:
42
-
43
-
44
+ Create a file named config/cassiopeia.yml:
44
45
  ticket_max_lifetime: 5 # Ticket max lifetime (in minutes)
46
+ # additional options and their default values:
47
+ session_id_key: "cassiopeia_sesion_id"
48
+ ticket_id_key: "cas_ticket_id"
49
+ service_id_key: "cas_service_id"
50
+ service_url_key: "cas_service_url"
45
51
 
46
-
47
- - Generate new controller named Cas. Generate new model named CasTicket. Create migration for your CasTicket (all field are mandatory):
48
-
52
+ Generate new controller named Cas. Generate new model named CasTicket. Create migration for your CasTicket (all field are mandatory):
49
53
  def self.up
50
54
  create_table :cas_tickets do |t|
51
55
  t.references :user, :foreign_key => true
@@ -58,21 +62,15 @@ This will raise the Cassiopeia::AccessDeniedException if user try to access this
58
62
  def self.down
59
63
  drop_table :cas_tickets
60
64
  end
61
-
62
- - Add the following lines to your cas_controller:
63
-
65
+ Add the following lines to your cas_controller:
64
66
  acts_as_cas_controller do |c|
65
67
  c.ticketClass = CasTicket
66
68
  c.rolesMethod = :roles_array #add this line only if your user model doesn't have :roles method
67
69
  end
68
-
69
- - Add the following lines to your CasTicket:
70
-
70
+ Add the following lines to your CasTicket:
71
71
  acts_as_cas_ticket
72
72
  belongs_to :user
73
-
74
- - You should also provide the ability to extract user roles to array by calling rolesMethod for current user. Add this method to your user model. The example for authlogic:
75
-
73
+ You should also provide the ability to extract user roles to array by calling rolesMethod for current user. Add this method to your user model. The example for authlogic:
76
74
  def roles_array
77
75
  res = []
78
76
  role_objects.each do |role|
@@ -80,14 +78,19 @@ This will raise the Cassiopeia::AccessDeniedException if user try to access this
80
78
  end
81
79
  res
82
80
  end
81
+ One more thing that might be useful to make everything work properly. Add these lines to routes.rb:
82
+ map.resource :cas
83
+ map.root :controller => "cas", :action => :index
84
+ map.connect ':controller/:action.:format'
85
+
83
86
 
84
87
  == INSTALL:
85
88
 
86
- - Add this line to environment.rb:
89
+ === Add this line to environment.rb:
87
90
 
88
91
  config.gem 'cassiopeia'
89
92
 
90
- - Run this from console:
93
+ === Run this from console:
91
94
 
92
95
  rake gems:install
93
96
 
data/Rakefile CHANGED
@@ -10,7 +10,7 @@ PKG_FILES = FileList[ '[a-zA-Z]*', 'lib/**/*' ]
10
10
 
11
11
  spec = Gem::Specification.new do |s|
12
12
  s.name = "cassiopeia"
13
- s.version = "0.0.3"
13
+ s.version = "0.0.4"
14
14
  s.author = "smecsia"
15
15
  s.email = "smecsia@gmail.com"
16
16
  #s.homepage = ""
@@ -12,7 +12,8 @@ module Cassiopeia
12
12
  :server_url => "https://localhost/cassiopeia",
13
13
  :service_url => "https://localhost/test_rails",
14
14
  :service_id => "test",
15
- :current_user_key => "current_user"
15
+ :current_user_key => "current_user",
16
+ :format => "js"
16
17
  }
17
18
  CONFIG_PATH = "#{RAILS_ROOT}/config/cassiopeia.yml"
18
19
  @@conf = {}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cassiopeia
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - smecsia