rubycas-server 0.6.0 → 0.7.0

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.
Files changed (50) hide show
  1. data/CHANGELOG.txt +1 -186
  2. data/History.txt +247 -0
  3. data/Manifest.txt +27 -2
  4. data/PostInstall.txt +3 -0
  5. data/Rakefile +4 -60
  6. data/bin/rubycas-server +2 -2
  7. data/bin/rubycas-server-ctl +0 -0
  8. data/casserver.db +0 -0
  9. data/casserver.log +792 -0
  10. data/casserver_db.log +88 -0
  11. data/config/hoe.rb +76 -0
  12. data/config/requirements.rb +15 -0
  13. data/config.example.yml +130 -6
  14. data/lib/casserver/authenticators/base.rb +20 -0
  15. data/lib/casserver/authenticators/client_certificate.rb +46 -0
  16. data/lib/casserver/authenticators/google.rb +54 -0
  17. data/lib/casserver/authenticators/ldap.rb +70 -40
  18. data/lib/casserver/authenticators/ntlm.rb +88 -0
  19. data/lib/casserver/authenticators/open_id.rb +22 -0
  20. data/lib/casserver/authenticators/sql.rb +66 -1
  21. data/lib/casserver/authenticators/sql_md5.rb +19 -0
  22. data/lib/casserver/authenticators/test.rb +5 -1
  23. data/lib/casserver/cas.rb +97 -22
  24. data/lib/casserver/controllers.rb +95 -34
  25. data/lib/casserver/environment.rb +16 -9
  26. data/lib/casserver/models.rb +38 -10
  27. data/lib/casserver/version.rb +1 -1
  28. data/lib/casserver/views.rb +38 -22
  29. data/lib/casserver.rb +13 -9
  30. data/lib/rubycas-server/version.rb +1 -0
  31. data/lib/rubycas-server.rb +1 -1
  32. data/lib/themes/notice.png +0 -0
  33. data/lib/themes/simple/logo.png +0 -0
  34. data/misc/basic_cas_single_signon_mechanism_diagram.png +0 -0
  35. data/misc/basic_cas_single_signon_mechanism_diagram.svg +652 -0
  36. data/script/console +10 -0
  37. data/script/destroy +14 -0
  38. data/script/generate +14 -0
  39. data/script/txt2html +82 -0
  40. data/tasks/deployment.rake +34 -0
  41. data/tasks/environment.rake +7 -0
  42. data/tasks/website.rake +17 -0
  43. data/website/index.html +40 -0
  44. data/website/index.txt +3 -0
  45. data/website/javascripts/rounded_corners_lite.inc.js +285 -0
  46. data/website/stylesheets/screen.css +138 -0
  47. data/website/template.html.erb +40 -0
  48. metadata +45 -33
  49. data/test/test_cas.rb +0 -33
  50. data/test/test_casserver.rb +0 -125
data/casserver_db.log ADDED
@@ -0,0 +1,88 @@
1
+ # Logfile created on Thu Mar 08 17:06:32 -0500 2007 by logger.rb/1.5.2.9
2
+ SQL (0.000991) SELECT name FROM sqlite_master WHERE type = 'table'
3
+ SQL (0.102929) CREATE TABLE casserver_schema_infos ("id" INTEGER PRIMARY KEY NOT NULL, "version" float DEFAULT NULL) 
4
+ CASServer::Models::SchemaInfo Load (0.000248) SELECT * FROM casserver_schema_infos LIMIT 1
5
+ SQL (0.000000) SQLite3::SQLException: no such table: casserver_login_tickets: DROP TABLE casserver_login_tickets
6
+ SQL (0.088360) CREATE TABLE casserver_login_tickets ("id" INTEGER PRIMARY KEY NOT NULL, "ticket" varchar(255) NOT NULL, "created_on" datetime NOT NULL, "consumed" datetime DEFAULT NULL, "client_hostname" varchar(255) NOT NULL) 
7
+ SQL (0.000000) SQLite3::SQLException: no such table: casserver_service_tickets: DROP TABLE casserver_service_tickets
8
+ SQL (0.073950) CREATE TABLE casserver_service_tickets ("id" INTEGER PRIMARY KEY NOT NULL, "ticket" varchar(255) NOT NULL, "service" varchar(255) NOT NULL, "created_on" datetime NOT NULL, "consumed" datetime DEFAULT NULL, "client_hostname" varchar(255) NOT NULL, "username" varchar(255) NOT NULL, "type" varchar(255) NOT NULL, "proxy_granting_ticket_id" integer DEFAULT NULL) 
9
+ SQL (0.000000) SQLite3::SQLException: no such table: casserver_ticket_granting_tickets: DROP TABLE casserver_ticket_granting_tickets
10
+ SQL (0.074600) CREATE TABLE casserver_ticket_granting_tickets ("id" INTEGER PRIMARY KEY NOT NULL, "ticket" varchar(255) NOT NULL, "created_on" datetime NOT NULL, "client_hostname" varchar(255) NOT NULL, "username" varchar(255) NOT NULL) 
11
+ SQL (0.000000) SQLite3::SQLException: no such table: casserver_proxy_granting_tickets: DROP TABLE casserver_proxy_granting_tickets
12
+ SQL (0.090874) CREATE TABLE casserver_proxy_granting_tickets ("id" INTEGER PRIMARY KEY NOT NULL, "ticket" varchar(255) NOT NULL, "created_on" datetime NOT NULL, "client_hostname" varchar(255) NOT NULL, "iou" varchar(255) NOT NULL, "service_ticket_id" integer NOT NULL) 
13
+ SQL (0.000414) INSERT INTO casserver_schema_infos ("version") VALUES(0.1)
14
+ CASServer::Models::ServiceTicket Load (0.000325) SELECT * FROM casserver_service_tickets WHERE (created_on < '2007-03-08 17:04:11') AND ( (casserver_service_tickets."type" = 'ServiceTicket' OR casserver_service_tickets."type" = 'ProxyTicket' ) ) 
15
+ CASServer::Models::LoginTicket Load (0.000234) SELECT * FROM casserver_login_tickets WHERE (created_on < '2007-03-08 17:04:11') 
16
+ CASServer::Models::ProxyGrantingTicket Load (0.000242) SELECT * FROM casserver_proxy_granting_tickets WHERE (created_on < '2007-03-06 17:09:11') 
17
+ CASServer::Models::TicketGrantingTicket Load (0.000228) SELECT * FROM casserver_ticket_granting_tickets WHERE (created_on < '2007-03-06 17:09:11') 
18
+ SQL (0.001784) SELECT name FROM sqlite_master WHERE type = 'table'
19
+ CASServer::Models::SchemaInfo Load (0.000302) SELECT * FROM casserver_schema_infos LIMIT 1
20
+ CASServer::Models::ServiceTicket Load (0.000226) SELECT * FROM casserver_service_tickets WHERE (created_on < '2007-03-08 17:06:34') AND ( (casserver_service_tickets."type" = 'ServiceTicket' OR casserver_service_tickets."type" = 'ProxyTicket' ) ) 
21
+ CASServer::Models::LoginTicket Load (0.000158) SELECT * FROM casserver_login_tickets WHERE (created_on < '2007-03-08 17:06:34') 
22
+ CASServer::Models::ProxyGrantingTicket Load (0.000164) SELECT * FROM casserver_proxy_granting_tickets WHERE (created_on < '2007-03-06 17:11:34') 
23
+ CASServer::Models::TicketGrantingTicket Load (0.000240) SELECT * FROM casserver_ticket_granting_tickets WHERE (created_on < '2007-03-06 17:11:34') 
24
+ SQL (0.001727) SELECT name FROM sqlite_master WHERE type = 'table'
25
+ CASServer::Models::SchemaInfo Load (0.000334) SELECT * FROM casserver_schema_infos LIMIT 1
26
+ CASServer::Models::ServiceTicket Load (0.000223) SELECT * FROM casserver_service_tickets WHERE (created_on < '2007-03-08 17:27:21') AND ( (casserver_service_tickets."type" = 'ServiceTicket' OR casserver_service_tickets."type" = 'ProxyTicket' ) ) 
27
+ CASServer::Models::LoginTicket Load (0.000162) SELECT * FROM casserver_login_tickets WHERE (created_on < '2007-03-08 17:27:21') 
28
+ CASServer::Models::ProxyGrantingTicket Load (0.000164) SELECT * FROM casserver_proxy_granting_tickets WHERE (created_on < '2007-03-06 17:32:21') 
29
+ CASServer::Models::TicketGrantingTicket Load (0.000175) SELECT * FROM casserver_ticket_granting_tickets WHERE (created_on < '2007-03-06 17:32:21') 
30
+ SQL (0.001986) SELECT name FROM sqlite_master WHERE type = 'table'
31
+ CASServer::Models::SchemaInfo Load (0.000366) SELECT * FROM casserver_schema_infos LIMIT 1
32
+ CASServer::Models::ServiceTicket Load (0.000251) SELECT * FROM casserver_service_tickets WHERE (created_on < '2007-03-08 17:28:07') AND ( (casserver_service_tickets."type" = 'ServiceTicket' OR casserver_service_tickets."type" = 'ProxyTicket' ) ) 
33
+ CASServer::Models::LoginTicket Load (0.000185) SELECT * FROM casserver_login_tickets WHERE (created_on < '2007-03-08 17:28:07') 
34
+ CASServer::Models::ProxyGrantingTicket Load (0.000210) SELECT * FROM casserver_proxy_granting_tickets WHERE (created_on < '2007-03-06 17:33:07') 
35
+ CASServer::Models::TicketGrantingTicket Load (0.000170) SELECT * FROM casserver_ticket_granting_tickets WHERE (created_on < '2007-03-06 17:33:07') 
36
+ SQL (0.001746) SELECT name FROM sqlite_master WHERE type = 'table'
37
+ CASServer::Models::SchemaInfo Load (0.000303) SELECT * FROM casserver_schema_infos LIMIT 1
38
+ CASServer::Models::ServiceTicket Load (0.000223) SELECT * FROM casserver_service_tickets WHERE (created_on < '2007-03-08 17:54:26') AND ( (casserver_service_tickets."type" = 'ServiceTicket' OR casserver_service_tickets."type" = 'ProxyTicket' ) ) 
39
+ CASServer::Models::LoginTicket Load (0.000178) SELECT * FROM casserver_login_tickets WHERE (created_on < '2007-03-08 17:54:26') 
40
+ CASServer::Models::ProxyGrantingTicket Load (0.000175) SELECT * FROM casserver_proxy_granting_tickets WHERE (created_on < '2007-03-06 17:59:26') 
41
+ CASServer::Models::TicketGrantingTicket Load (0.000169) SELECT * FROM casserver_ticket_granting_tickets WHERE (created_on < '2007-03-06 17:59:26') 
42
+ SQL (0.001771) SELECT name FROM sqlite_master WHERE type = 'table'
43
+ CASServer::Models::SchemaInfo Load (0.000445) SELECT * FROM casserver_schema_infos LIMIT 1
44
+ CASServer::Models::ServiceTicket Load (0.000221) SELECT * FROM casserver_service_tickets WHERE (created_on < '2007-03-08 17:54:32') AND ( (casserver_service_tickets."type" = 'ServiceTicket' OR casserver_service_tickets."type" = 'ProxyTicket' ) ) 
45
+ CASServer::Models::LoginTicket Load (0.000171) SELECT * FROM casserver_login_tickets WHERE (created_on < '2007-03-08 17:54:32') 
46
+ CASServer::Models::ProxyGrantingTicket Load (0.000163) SELECT * FROM casserver_proxy_granting_tickets WHERE (created_on < '2007-03-06 17:59:32') 
47
+ CASServer::Models::TicketGrantingTicket Load (0.000161) SELECT * FROM casserver_ticket_granting_tickets WHERE (created_on < '2007-03-06 17:59:32') 
48
+ SQL (0.002972) SELECT name FROM sqlite_master WHERE type = 'table'
49
+ CASServer::Models::SchemaInfo Load (0.000419) SELECT * FROM casserver_schema_infos LIMIT 1
50
+ CASServer::Models::ServiceTicket Load (0.000233) SELECT * FROM casserver_service_tickets WHERE (created_on < '2007-03-08 17:55:13') AND ( (casserver_service_tickets."type" = 'ServiceTicket' OR casserver_service_tickets."type" = 'ProxyTicket' ) ) 
51
+ CASServer::Models::LoginTicket Load (0.000185) SELECT * FROM casserver_login_tickets WHERE (created_on < '2007-03-08 17:55:13') 
52
+ CASServer::Models::ProxyGrantingTicket Load (0.000166) SELECT * FROM casserver_proxy_granting_tickets WHERE (created_on < '2007-03-06 18:00:13') 
53
+ CASServer::Models::TicketGrantingTicket Load (0.000161) SELECT * FROM casserver_ticket_granting_tickets WHERE (created_on < '2007-03-06 18:00:13') 
54
+ SQL (0.000631) INSERT INTO casserver_login_tickets ("created_on", "ticket", "client_hostname", "consumed") VALUES('2007-03-08 18:00:45', 'LT-1173394845r40D9611E5DEBE39C26FAFD7E295', 'mzukowski.urbacon.net', NULL)
55
+ CASServer::Models::LoginTicket Load (0.000656) SELECT * FROM casserver_login_tickets WHERE (casserver_login_tickets."ticket" = 'LT-1173394845r40D9611E5DEBE39C26FAFD7E295') LIMIT 1
56
+ CASServer::Models::LoginTicket Update (0.000583) UPDATE casserver_login_tickets SET "client_hostname" = 'mzukowski.urbacon.net', "ticket" = 'LT-1173394845r40D9611E5DEBE39C26FAFD7E295', "consumed" = '2007-03-08 18:00:52', "created_on" = '2007-03-08 18:00:45' WHERE id = 1
57
+ SQL (0.000385) INSERT INTO casserver_login_tickets ("created_on", "ticket", "client_hostname", "consumed") VALUES('2007-03-08 18:00:52', 'LT-1173394852r4A6A482E92868C23EAD492788D', 'mzukowski.urbacon.net', NULL)
58
+ SQL (0.000323) INSERT INTO casserver_ticket_granting_tickets ("created_on", "ticket", "username", "client_hostname") VALUES('2007-03-08 18:00:52', 'TGC-1173394852r1E2C91CD940D7A6E3129DE72680', 'mzukowski', 'mzukowski.urbacon.net')
59
+ SQL (0.003985) SELECT name FROM sqlite_master WHERE type = 'table'
60
+ CASServer::Models::SchemaInfo Load (0.000317) SELECT * FROM casserver_schema_infos LIMIT 1
61
+ CASServer::Models::ServiceTicket Load (0.000235) SELECT * FROM casserver_service_tickets WHERE (created_on < '2007-03-08 18:04:03') AND ( (casserver_service_tickets."type" = 'ServiceTicket' OR casserver_service_tickets."type" = 'ProxyTicket' ) ) 
62
+ CASServer::Models::LoginTicket Load (0.000520) SELECT * FROM casserver_login_tickets WHERE (created_on < '2007-03-08 18:04:03') 
63
+ CASServer::Models::LoginTicket Destroy (0.000475)  DELETE FROM casserver_login_tickets
64
+ WHERE id = 1
65
+ 
66
+ CASServer::Models::LoginTicket Destroy (0.000108)  DELETE FROM casserver_login_tickets
67
+ WHERE id = 2
68
+ 
69
+ CASServer::Models::ProxyGrantingTicket Load (0.000182) SELECT * FROM casserver_proxy_granting_tickets WHERE (created_on < '2007-03-06 18:09:03') 
70
+ CASServer::Models::TicketGrantingTicket Load (0.000173) SELECT * FROM casserver_ticket_granting_tickets WHERE (created_on < '2007-03-06 18:09:03') 
71
+ SQL (0.000521) INSERT INTO casserver_login_tickets ("created_on", "ticket", "client_hostname", "consumed") VALUES('2007-03-08 18:09:09', 'LT-1173395349r21CE5E4AE47C71F250F632563D8', 'mzukowski.urbacon.net', NULL)
72
+ CASServer::Models::LoginTicket Load (0.000479) SELECT * FROM casserver_login_tickets WHERE (casserver_login_tickets."ticket" = 'LT-1173395349r21CE5E4AE47C71F250F632563D8') LIMIT 1
73
+ CASServer::Models::LoginTicket Update (0.000399) UPDATE casserver_login_tickets SET "client_hostname" = 'mzukowski.urbacon.net', "ticket" = 'LT-1173395349r21CE5E4AE47C71F250F632563D8', "consumed" = '2007-03-08 18:09:16', "created_on" = '2007-03-08 18:09:09' WHERE id = 1
74
+ SQL (0.000385) INSERT INTO casserver_login_tickets ("created_on", "ticket", "client_hostname", "consumed") VALUES('2007-03-08 18:09:16', 'LT-1173395356r4E1EB273E2EBF9E418F47C9B3E2', 'mzukowski.urbacon.net', NULL)
75
+ SQL (0.000330) INSERT INTO casserver_ticket_granting_tickets ("created_on", "ticket", "username", "client_hostname") VALUES('2007-03-08 18:09:16', 'TGC-1173395356r53A8C4AD580D74F60C8A10CEFB', 'mzukowski', 'mzukowski.urbacon.net')
76
+ SQL (0.003537) SELECT name FROM sqlite_master WHERE type = 'table'
77
+ CASServer::Models::SchemaInfo Load (0.000343) SELECT * FROM casserver_schema_infos LIMIT 1
78
+ CASServer::Models::ServiceTicket Load (0.000233) SELECT * FROM casserver_service_tickets WHERE (created_on < '2007-03-08 18:04:49') AND ( (casserver_service_tickets."type" = 'ServiceTicket' OR casserver_service_tickets."type" = 'ProxyTicket' ) ) 
79
+ CASServer::Models::LoginTicket Load (0.000187) SELECT * FROM casserver_login_tickets WHERE (created_on < '2007-03-08 18:04:49') 
80
+ CASServer::Models::ProxyGrantingTicket Load (0.000164) SELECT * FROM casserver_proxy_granting_tickets WHERE (created_on < '2007-03-06 18:09:49') 
81
+ CASServer::Models::TicketGrantingTicket Load (0.000229) SELECT * FROM casserver_ticket_granting_tickets WHERE (created_on < '2007-03-06 18:09:49') 
82
+ CASServer::Models::LoginTicket Load (0.000505) SELECT * FROM casserver_login_tickets WHERE (casserver_login_tickets."ticket" = 'LT-1173395349r21CE5E4AE47C71F250F632563D8') LIMIT 1
83
+ CASServer::Models::LoginTicket Update (0.000681) UPDATE casserver_login_tickets SET "client_hostname" = 'mzukowski.urbacon.net', "ticket" = 'LT-1173395349r21CE5E4AE47C71F250F632563D8', "consumed" = '2007-03-08 18:09:55', "created_on" = '2007-03-08 18:09:09' WHERE id = 1
84
+ SQL (0.000567) INSERT INTO casserver_login_tickets ("created_on", "ticket", "client_hostname", "consumed") VALUES('2007-03-08 18:10:02', 'LT-1173395402r347DF2CB4392E0DC7511B4B0A6B', 'mzukowski.urbacon.net', NULL)
85
+ CASServer::Models::LoginTicket Load (0.000516) SELECT * FROM casserver_login_tickets WHERE (casserver_login_tickets."ticket" = 'LT-1173395402r347DF2CB4392E0DC7511B4B0A6B') LIMIT 1
86
+ CASServer::Models::LoginTicket Update (0.000494) UPDATE casserver_login_tickets SET "client_hostname" = 'mzukowski.urbacon.net', "ticket" = 'LT-1173395402r347DF2CB4392E0DC7511B4B0A6B', "consumed" = '2007-03-08 18:10:04', "created_on" = '2007-03-08 18:10:02' WHERE id = 3
87
+ SQL (0.000247) INSERT INTO casserver_login_tickets ("created_on", "ticket", "client_hostname", "consumed") VALUES('2007-03-08 18:10:04', 'LT-1173395404r19BD3B2C6C6B95CD4F16E04CB1B', 'mzukowski.urbacon.net', NULL)
88
+ SQL (0.000340) INSERT INTO casserver_ticket_granting_tickets ("created_on", "ticket", "username", "client_hostname") VALUES('2007-03-08 18:10:04', 'TGC-1173395404r20594EBFDC11A5D7E1437046197', 'mzukowski', 'mzukowski.urbacon.net')
data/config/hoe.rb ADDED
@@ -0,0 +1,76 @@
1
+ require 'rubycas-server/version'
2
+
3
+ AUTHOR = 'Matt Zukowski' # can also be an array of Authors
4
+ EMAIL = "matt@zukowski.ca"
5
+ DESCRIPTION = "Provides single sign-on authentication for web applications using the CAS protocol."
6
+ GEM_NAME = 'rubycas-server' # what ppl will type to install your gem
7
+ RUBYFORGE_PROJECT = 'rubycas-server' # The unix name for your project
8
+ HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
9
+ DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
10
+ EXTRA_DEPENDENCIES = [
11
+ 'activesupport',
12
+ 'activerecord',
13
+ ['picnic', '>= 0.7.0']
14
+ ] # An array of rubygem dependencies [name, version]
15
+
16
+ @config_file = "~/.rubyforge/user-config.yml"
17
+ @config = nil
18
+ RUBYFORGE_USERNAME = "unknown"
19
+ def rubyforge_username
20
+ unless @config
21
+ begin
22
+ @config = YAML.load(File.read(File.expand_path(@config_file)))
23
+ rescue
24
+ puts <<-EOS
25
+ ERROR: No rubyforge config file found: #{@config_file}
26
+ Run 'rubyforge setup' to prepare your env for access to Rubyforge
27
+ - See http://newgem.rubyforge.org/rubyforge.html for more details
28
+ EOS
29
+ exit
30
+ end
31
+ end
32
+ RUBYFORGE_USERNAME.replace @config["username"]
33
+ end
34
+
35
+ ENV['NODOT'] = '1'
36
+
37
+ REV = nil
38
+ # UNCOMMENT IF REQUIRED:
39
+ #REV = YAML.load(`svn info`)['Revision']
40
+ VERS = CASServer::VERSION::STRING + (REV ? ".#{REV}" : "")
41
+ RDOC_OPTS = ['--quiet', '--title', 'rubycas-server documentation',
42
+ "--opname", "index.html",
43
+ "--line-numbers",
44
+ "--main", "README",
45
+ "--inline-source"]
46
+
47
+ class Hoe
48
+ def extra_deps
49
+ @extra_deps.reject! { |x| Array(x).first == 'hoe' }
50
+ @extra_deps
51
+ end
52
+ end
53
+
54
+ # Generate all the Rake tasks
55
+ # Run 'rake -T' to see list of generated tasks (from gem root directory)
56
+ $hoe = Hoe.new(GEM_NAME, VERS) do |p|
57
+ p.developer(AUTHOR, EMAIL)
58
+ p.description = DESCRIPTION
59
+ p.summary = DESCRIPTION
60
+ p.url = HOMEPATH
61
+ p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
62
+ p.test_globs = ["test/**/test_*.rb"]
63
+ p.clean_globs |= ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store'] #An array of file patterns to delete on clean.
64
+
65
+ # == Optional
66
+ p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
67
+ #p.extra_deps = EXTRA_DEPENDENCIES
68
+
69
+ p.spec_extras = {:executables => ['rubycas-server', 'rubycas-server-ctl']} # A hash of extra values to set in the gemspec.
70
+ end
71
+
72
+ CHANGES = $hoe.paragraphs_of('History.txt', 0..1).join("\\n\\n")
73
+ PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}"
74
+ $hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
75
+ $hoe.rsync_args = '-av --delete --ignore-errors'
76
+ $hoe.spec.post_install_message = File.open(File.dirname(__FILE__) + "/../PostInstall.txt").read rescue ""
@@ -0,0 +1,15 @@
1
+ require 'fileutils'
2
+ include FileUtils
3
+
4
+ require 'rubygems'
5
+ %w[rake hoe newgem rubigen].each do |req_gem|
6
+ begin
7
+ require req_gem
8
+ rescue LoadError
9
+ puts "This Rakefile requires the '#{req_gem}' RubyGem."
10
+ puts "Installation: gem install #{req_gem} -y"
11
+ exit
12
+ end
13
+ end
14
+
15
+ $:.unshift(File.join(File.dirname(__FILE__), %w[.. lib]))
data/config.example.yml CHANGED
@@ -119,6 +119,9 @@ database:
119
119
  # If you prefer to have your passwords stored in an encrypted form, have a
120
120
  # look at the SQLEncrypted authenticator:
121
121
  # http://code.google.com/p/rubycas-server/wiki/UsingTheSQLEncryptedAuthenticator
122
+ #
123
+ # If your users table stores passwords with MD5 hashing (for example as with
124
+ # Drupal) try using the SQLMd5 version of the SQL authenticator.
122
125
  #
123
126
  # Example:
124
127
  #
@@ -134,6 +137,61 @@ database:
134
137
  # username_column: username
135
138
  # password_column: password
136
139
  #
140
+ # When replying to a CAS client's validation request, the server will normally
141
+ # provide the client with the authenticated user's username. However it is now
142
+ # possible for the server to provide the client with additional attributes.
143
+ # You can configure the SQL authenticator to provide data from additional
144
+ # columns in the users table by listing the names of the columns under the
145
+ # 'extra_attributes' option. Note though that this functionality is experimental.
146
+ # It should work with RubyCAS-Client, but may or may not work with other CAS
147
+ # clients.
148
+ #
149
+ # For example, with this configuration, the 'full_name' and 'access_level'
150
+ # columns will be provided to your CAS clients along with the username:
151
+ #
152
+ #authenticator:
153
+ # class: CASServer::Authenticators::SQL
154
+ # database:
155
+ # adapter: mysql
156
+ # database: some_database_with_users_table
157
+ # user_table: users
158
+ # username_column: username
159
+ # password_column: password
160
+ # extra_attributes: full_name, access_level
161
+ #
162
+ #
163
+ # === Google Authentication ====================================================
164
+ #
165
+ # The Google authenticator allows users to log in to your CAS server using
166
+ # their Google account credentials (i.e. the same email and password they
167
+ # would use to log in to Google services like Gmail). This authenticator
168
+ # requires no special configuration -- just specify its class name:
169
+ #
170
+ #authenticator:
171
+ # class: CASServer::Authenticators::Google
172
+ #
173
+ # Note that as with all authenticators, it is possible to use the Google
174
+ # authenticator alongside other authenticators. For example, CAS can first
175
+ # attempt to validate the account with Google, and if that fails, fall back
176
+ # to some other local authentication mechanism.
177
+ #
178
+ # For example:
179
+ #
180
+ #authenticator:
181
+ # -
182
+ # class: CASServer::Authenticators::Google
183
+ # -
184
+ # class: CASServer::Authenticators::SQL
185
+ # database:
186
+ # adapter: mysql
187
+ # database: some_database_with_users_table
188
+ # user: root
189
+ # password:
190
+ # server: localhost
191
+ # user_table: user
192
+ # username_column: username
193
+ # password_column: password
194
+ #
137
195
  #
138
196
  # === ActiveDirectory Authentication ===========================================
139
197
  #
@@ -145,9 +203,11 @@ database:
145
203
  # to be an administrative account -- it only has to be able to search for other
146
204
  # users.
147
205
  #
148
- # Note that the auth_user parameter must be the user's CN (Common Name)!
149
- # In Active Directory, the CN is genarally the user's full name, which is not
150
- # the same as their username (sAMAccountName).
206
+ # Note that the auth_user parameter must be the user's CN (Common Name).
207
+ # In Active Directory, the CN is genarally the user's full name, which is NOT
208
+ # generally the same as their username (sAMAccountName).
209
+ #
210
+ # For example:
151
211
  #
152
212
  #authenticator:
153
213
  # class: CASServer::Authenticators::ActiveDirectoryLDAP
@@ -159,6 +219,22 @@ database:
159
219
  # auth_user: authenticator
160
220
  # auth_password: itsasecret
161
221
  #
222
+ # A more complicated example, where the authenticator will use TLS encryption,
223
+ # will ignore users with disabled accounts, and will pass on the 'cn' and 'mail'
224
+ # attributes to CAS clients:
225
+ #
226
+ #authenticator:
227
+ # class: CASServer::Authenticators::ActiveDirectoryLDAP
228
+ # ldap:
229
+ # server: ad.example.net
230
+ # port: 636
231
+ # base: dc=example,dc=net
232
+ # filter: (objectClass=person) & !(msExchHideFromAddressLists=TRUE)
233
+ # auth_user: authenticator
234
+ # auth_password: itsasecret
235
+ # encryption: simple_tls
236
+ # extra_attributes: cn, mail
237
+ #
162
238
  # It is possible to authenticate against Active Directory without the
163
239
  # authenticator user, but this requires that users type in their CN as
164
240
  # the username rather than typing in their sAMAccountName. In other words
@@ -173,14 +249,42 @@ database:
173
249
  # The configuration is similar, except you don't need an authenticator
174
250
  # username or password. Note that this authenticator hasn't been widely
175
251
  # tested, so it is not guaranteed to work.
176
- #=====
252
+ #
177
253
  #authenticator:
178
- # class: CASServer::Authenticators::ActiveDirectoryLDAP
254
+ # class: CASServer::Authenticators::LDAP
179
255
  # ldap:
180
- # server: ad.example.net
256
+ # server: ldap.example.net
257
+ # port: 389
258
+ # base: dc=example,dc=net
259
+ # filter: (objectClass=person)
260
+ #
261
+ # If you need more secure connections via TSL, specify the 'encryption'
262
+ # option and change the port:
263
+ #
264
+ #authenticator:
265
+ # class: CASServer::Authenticators::LDAP
266
+ # ldap:
267
+ # server: ldap.example.net
268
+ # port: 636
269
+ # base: dc=example,dc=net
270
+ # filter: (objectClass=person)
271
+ # encryption: simple_tls
272
+ #
273
+ # If you need additional data about the user passed to the client (for example,
274
+ # their 'cn' and 'mail' attributes, you can specify the list of attributes
275
+ # under the extra_attributes config option:
276
+ #
277
+ #authenticator:
278
+ # class: CASServer::Authenticators::LDAP
279
+ # ldap:
280
+ # server: ldap.example.net
181
281
  # port: 389
182
282
  # base: dc=example,dc=net
183
283
  # filter: (objectClass=person)
284
+ # extra_attributes: cn, mail
285
+ #
286
+ # Note that the above functionality is somewhat limited by client compatibility.
287
+ # See the SQL authenticator notes above for more info.
184
288
  #
185
289
  #
186
290
  # === Custom Authentication ====================================================
@@ -285,6 +389,26 @@ log:
285
389
  # file: /var/log/casserver_db.log
286
390
 
287
391
 
392
+ ##### SINGLE SIGN-OUT ##########################################################
393
+
394
+ # When a user logs in to a CAS-enabled client application, that application
395
+ # generally opens its own local user session. When the user then logs out
396
+ # through the CAS server, each of the CAS-enabled client applications need
397
+ # to be notified so that they can close their own local sessions for that user.
398
+ #
399
+ # Up until recently this was not possible within CAS. However, a method for
400
+ # performing this notification was recently added to the protocol (in CAS 3.1).
401
+ # This works exactly as described above -- when the user logs out, the CAS
402
+ # server individually contacts each client service and notifies it of the
403
+ # logout. Currently not all client applications support this, so this
404
+ # behaviour is disabled by default. To enable it, uncomment the following
405
+ # configuration line. Note that currently it is not possible to enable
406
+ # or disable single-sign-out on a per-service basis, but this functionality
407
+ # is planned for a future release.
408
+
409
+ #enable_single_sign_out: true
410
+
411
+
288
412
  ##### OTHER ####################################################################
289
413
 
290
414
  # You can set various ticket expiry times (specify the value in seconds).
@@ -12,6 +12,11 @@ module CASServer
12
12
  def configure(options)
13
13
  raise ArgumentError, "options must be a HashWithIndifferentAccess" unless options.kind_of? HashWithIndifferentAccess
14
14
  @options = options.dup
15
+ @extra_attributes = {}
16
+ end
17
+
18
+ def extra_attributes
19
+ @extra_attributes
15
20
  end
16
21
 
17
22
  protected
@@ -19,6 +24,21 @@ module CASServer
19
24
  @username = credentials[:username]
20
25
  @password = credentials[:password]
21
26
  @service = credentials[:service]
27
+ @request = credentials[:request]
28
+ end
29
+
30
+ def extra_attributes_to_extract
31
+ if @options[:extra_attributes].kind_of? Array
32
+ attrs = @options[:extra_attributes]
33
+ elsif @options[:extra_attributes].kind_of? String
34
+ attrs = @options[:extra_attributes].split(',').collect{|col| col.strip}
35
+ else
36
+ $LOG.error("Can't figure out attribute list from #{@options[:extra_attributes].inspect}. This must be an Aarray of column names or a comma-separated list.")
37
+ attrs = []
38
+ end
39
+
40
+ $LOG.debug("#{self.class.name} will try to extract the following extra_attributes: #{attrs.inspect}")
41
+ return attrs
22
42
  end
23
43
  end
24
44
  end
@@ -0,0 +1,46 @@
1
+ require 'casserver/authenticators/base'
2
+
3
+ # NOT YET IMPLEMENTED
4
+ #
5
+ # This authenticator will authenticate the user based on a client SSL certificate.
6
+ #
7
+ # You will probably want to use this along with another authenticator, chaining
8
+ # it so that if the client does not provide a certificate, the server can
9
+ # fall back to some other authentication mechanism.
10
+ #
11
+ # Here's an example of how to use two chained authenticators in the config.yml
12
+ # file. The server will first use the ClientCertificate authenticator, and
13
+ # only fall back to the SQL authenticator of the first one fails:
14
+ #
15
+ # authenticator:
16
+ # -
17
+ # class: CASServer::Authenticators::ClientCertificate
18
+ # -
19
+ # class: CASServer::Authenticators::SQL
20
+ # database:
21
+ # adapter: mysql
22
+ # database: some_database_with_users_table
23
+ # user: root
24
+ # password:
25
+ # server: localhost
26
+ # user_table: user
27
+ # username_column: username
28
+ # password_column: password
29
+ #
30
+ class CASServer::Authenticators::ClientCertificate < CASServer::Authenticators::Base
31
+ def validate(credentials)
32
+ read_standard_credentials(credentials)
33
+
34
+ @client_cert = credentials[:request]['SSL_CLIENT_CERT']
35
+
36
+ # note that I haven't actually tested to see if SSL_CLIENT_CERT gets
37
+ # filled with data when a client cert is provided, but this should be
38
+ # the case at least in theory :)
39
+
40
+ return false if @client_cert.blank?
41
+
42
+ # IMPLEMENT SSL CERTIFICATE VALIDATION CODE HERE
43
+
44
+ return true # if SSL certificate is valid, false otherwise
45
+ end
46
+ end
@@ -0,0 +1,54 @@
1
+ require 'casserver/authenticators/base'
2
+ require 'uri'
3
+ require 'net/http'
4
+ require 'net/https'
5
+ require 'timeout'
6
+
7
+ # Validates Google accounts against Google's authentication service -- in other
8
+ # words, this authenticator allows users to log in to CAS using their
9
+ # Gmail/Google accounts.
10
+ class CASServer::Authenticators::Google < CASServer::Authenticators::Base
11
+ def validate(credentials)
12
+ read_standard_credentials(credentials)
13
+
14
+ return false if @username.blank? || @password.blank?
15
+
16
+ auth_data = {
17
+ 'Email' => @username,
18
+ 'Passwd' => @password,
19
+ 'service' => 'xapi',
20
+ 'source' => 'RubyCAS-Server',
21
+ 'accountType' => 'HOSTED_OR_GOOGLE'
22
+ }
23
+
24
+ url = URI.parse('https://www.google.com/accounts/ClientLogin')
25
+ http = Net::HTTP.new(url.host, url.port)
26
+ http.use_ssl = true
27
+
28
+ # TODO: make the timeout configurable
29
+ wait_seconds = 10
30
+ begin
31
+ timeout(wait_seconds) do
32
+ res = http.start do |conn|
33
+ req = Net::HTTP::Post.new(url.path)
34
+ req.set_form_data(auth_data,'&')
35
+ conn.request(req)
36
+ end
37
+
38
+ case res
39
+ when Net::HTTPSuccess
40
+ true
41
+ when Net::HTTPForbidden
42
+ false
43
+ else
44
+ $LOG.error("Unexpected response from Google while validating credentials: #{res.inspect} ==> #{res.body}.")
45
+ raise CASServer::AuthenticatorError, "Unexpected response received from Google while validating credentials."
46
+ end
47
+ end
48
+ rescue Timeout::Error
49
+ $LOG.error("Google did not respond to the credential validation request. We waited for #{wait_seconds.inspect} seconds before giving up.")
50
+ raise CASServer::AuthenticatorError, "Timeout while waiting for Google to validate credentials."
51
+ end
52
+
53
+ end
54
+ end