cassiopeia 0.0.2 → 0.0.3

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 +118 -0
  2. data/Rakefile +3 -2
  3. metadata +14 -4
  4. data/README +0 -80
data/README.rdoc ADDED
@@ -0,0 +1,118 @@
1
+ = cassiopeia
2
+
3
+ * http://github.com/smecsia/cassiopeia
4
+
5
+ == DESCRIPTION:
6
+
7
+ - Yet another custom CAS client/server implementation
8
+
9
+ = Changelog:
10
+ - 0.0.3: Added required dependency simple_rest. Doc extended.
11
+ - 0.0.2: Added some doc
12
+
13
+
14
+ == SYNOPSIS:
15
+ === Client configuration
16
+ <b>Create a file named config/cassiopeia.yml:</b>
17
+
18
+ server_url: "https://localhost/cassiopeia" # Url of cassiopeia server in your environment
19
+ service_url: "https://localhost/myservice" # Url of your application (for cas to redirect back)
20
+ service_id: "test" # Identification of your service (for informational and security purpose)
21
+
22
+ ==== Usage:
23
+ <b>Add this line to application_controller.rb:</b>
24
+
25
+ use_cas_authorization
26
+
27
+ This will force your application to request authorization from cassiopeia server.
28
+ You can also check required roles to access some controllers. To do this, you should add the following line to your controller:
29
+
30
+ cas_require_roles :doctor, :admin
31
+
32
+ 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
+ rescue_from 'Cassiopeia::AccessDeniedException', :with => :access_denied
35
+ def access_denied
36
+ flash[:notice] = 'Access denied. You dont have permissions to access this page'
37
+ redirect_to root_path
38
+ end
39
+
40
+ === Server configuration
41
+ - Create a file named config/cassiopeia.yml:
42
+
43
+
44
+ ticket_max_lifetime: 5 # Ticket max lifetime (in minutes)
45
+
46
+
47
+ - Generate new controller named Cas. Generate new model named CasTicket. Create migration for your CasTicket (all field are mandatory):
48
+
49
+ def self.up
50
+ create_table :cas_tickets do |t|
51
+ t.references :user, :foreign_key => true
52
+ t.string :identity
53
+ t.datetime :expires_at
54
+ t.string :service, :limit=>2400
55
+ t.timestamps
56
+ end
57
+ end
58
+ def self.down
59
+ drop_table :cas_tickets
60
+ end
61
+
62
+ - Add the following lines to your cas_controller:
63
+
64
+ acts_as_cas_controller do |c|
65
+ c.ticketClass = CasTicket
66
+ c.rolesMethod = :roles_array #add this line only if your user model doesn't have :roles method
67
+ end
68
+
69
+ - Add the following lines to your CasTicket:
70
+
71
+ acts_as_cas_ticket
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
+
76
+ def roles_array
77
+ res = []
78
+ role_objects.each do |role|
79
+ res << role.name.to_sym
80
+ end
81
+ res
82
+ end
83
+
84
+ == INSTALL:
85
+
86
+ - Add this line to environment.rb:
87
+
88
+ config.gem 'cassiopeia'
89
+
90
+ - Run this from console:
91
+
92
+ rake gems:install
93
+
94
+ == LICENSE:
95
+
96
+ (The MIT License)
97
+
98
+ Copyright (c) 2010 smecsia
99
+
100
+ Permission is hereby granted, free of charge, to any person obtaining
101
+ a copy of this software and associated documentation files (the
102
+ 'Software'), to deal in the Software without restriction, including
103
+ without limitation the rights to use, copy, modify, merge, publish,
104
+ distribute, sublicense, and/or sell copies of the Software, and to
105
+ permit persons to whom the Software is furnished to do so, subject to
106
+ the following conditions:
107
+
108
+ The above copyright notice and this permission notice shall be
109
+ included in all copies or substantial portions of the Software.
110
+
111
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
112
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
113
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
114
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
115
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
116
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
117
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
118
+
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.2"
13
+ s.version = "0.0.3"
14
14
  s.author = "smecsia"
15
15
  s.email = "smecsia@gmail.com"
16
16
  #s.homepage = ""
@@ -18,10 +18,11 @@ spec = Gem::Specification.new do |s|
18
18
  s.summary = "Rails plugin for custom CAS(Cassiopeia) server/client implementation"
19
19
  s.add_dependency('uuidtools')
20
20
  s.add_dependency('rails', '>=2.3.5')
21
+ s.add_dependency('simple_rest')
21
22
  s.files = PKG_FILES.to_a
22
23
  s.require_path = "lib"
23
24
  s.has_rdoc = false
24
- s.extra_rdoc_files = ["README"]
25
+ s.extra_rdoc_files = ["README.rdoc"]
25
26
  end
26
27
 
27
28
  desc 'Turn this plugin into a gem.'
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.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - smecsia
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-03-03 00:00:00 +03:00
12
+ date: 2010-03-04 00:00:00 +03:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -32,6 +32,16 @@ dependencies:
32
32
  - !ruby/object:Gem::Version
33
33
  version: 2.3.5
34
34
  version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: simple_rest
37
+ type: :runtime
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: "0"
44
+ version:
35
45
  description:
36
46
  email: smecsia@gmail.com
37
47
  executables: []
@@ -39,9 +49,9 @@ executables: []
39
49
  extensions: []
40
50
 
41
51
  extra_rdoc_files:
42
- - README
52
+ - README.rdoc
43
53
  files:
44
- - README
54
+ - README.rdoc
45
55
  - Rakefile
46
56
  - lib/cassiopeia.rb
47
57
  - lib/cassiopeia/active_record_server_mixin.rb
data/README DELETED
@@ -1,80 +0,0 @@
1
- Cassiopeia (0.0.2)
2
- ===================
3
-
4
- Yet another custom CAS client/server implementation
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
-
78
- ===================
79
-
80
- Copyright (c) 2010 Waveaccess LLC