bmedia-casserver 1.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.
Files changed (81) hide show
  1. data/CHANGELOG +325 -0
  2. data/Gemfile +3 -0
  3. data/LICENSE +26 -0
  4. data/README.md +19 -0
  5. data/Rakefile +2 -0
  6. data/bin/rubycas-server +30 -0
  7. data/config/config.example.yml +592 -0
  8. data/config/unicorn.rb +88 -0
  9. data/config.ru +17 -0
  10. data/db/migrate/001_create_initial_structure.rb +47 -0
  11. data/lib/casserver/authenticators/active_directory_ldap.rb +19 -0
  12. data/lib/casserver/authenticators/active_resource.rb +127 -0
  13. data/lib/casserver/authenticators/authlogic_crypto_providers/aes256.rb +43 -0
  14. data/lib/casserver/authenticators/authlogic_crypto_providers/bcrypt.rb +92 -0
  15. data/lib/casserver/authenticators/authlogic_crypto_providers/md5.rb +34 -0
  16. data/lib/casserver/authenticators/authlogic_crypto_providers/sha1.rb +59 -0
  17. data/lib/casserver/authenticators/authlogic_crypto_providers/sha512.rb +50 -0
  18. data/lib/casserver/authenticators/base.rb +67 -0
  19. data/lib/casserver/authenticators/client_certificate.rb +47 -0
  20. data/lib/casserver/authenticators/google.rb +58 -0
  21. data/lib/casserver/authenticators/ldap.rb +147 -0
  22. data/lib/casserver/authenticators/ntlm.rb +88 -0
  23. data/lib/casserver/authenticators/open_id.rb +22 -0
  24. data/lib/casserver/authenticators/sql.rb +133 -0
  25. data/lib/casserver/authenticators/sql_authlogic.rb +93 -0
  26. data/lib/casserver/authenticators/sql_encrypted.rb +75 -0
  27. data/lib/casserver/authenticators/sql_md5.rb +19 -0
  28. data/lib/casserver/authenticators/sql_rest_auth.rb +82 -0
  29. data/lib/casserver/authenticators/test.rb +22 -0
  30. data/lib/casserver/cas.rb +323 -0
  31. data/lib/casserver/localization.rb +13 -0
  32. data/lib/casserver/model.rb +270 -0
  33. data/lib/casserver/server.rb +758 -0
  34. data/lib/casserver/utils.rb +32 -0
  35. data/lib/casserver/views/_login_form.erb +42 -0
  36. data/lib/casserver/views/layout.erb +18 -0
  37. data/lib/casserver/views/login.erb +30 -0
  38. data/lib/casserver/views/proxy.builder +12 -0
  39. data/lib/casserver/views/proxy_validate.builder +25 -0
  40. data/lib/casserver/views/service_validate.builder +18 -0
  41. data/lib/casserver/views/validate.erb +2 -0
  42. data/lib/casserver.rb +11 -0
  43. data/locales/de.yml +27 -0
  44. data/locales/en.yml +26 -0
  45. data/locales/es.yml +26 -0
  46. data/locales/es_ar.yml +26 -0
  47. data/locales/fr.yml +26 -0
  48. data/locales/jp.yml +26 -0
  49. data/locales/pl.yml +26 -0
  50. data/locales/pt.yml +26 -0
  51. data/locales/ru.yml +26 -0
  52. data/locales/zh.yml +26 -0
  53. data/locales/zh_tw.yml +26 -0
  54. data/public/themes/cas.css +126 -0
  55. data/public/themes/notice.png +0 -0
  56. data/public/themes/ok.png +0 -0
  57. data/public/themes/simple/bg.png +0 -0
  58. data/public/themes/simple/favicon.png +0 -0
  59. data/public/themes/simple/login_box_bg.png +0 -0
  60. data/public/themes/simple/logo.png +0 -0
  61. data/public/themes/simple/theme.css +28 -0
  62. data/public/themes/urbacon/bg.png +0 -0
  63. data/public/themes/urbacon/login_box_bg.png +0 -0
  64. data/public/themes/urbacon/logo.png +0 -0
  65. data/public/themes/urbacon/theme.css +33 -0
  66. data/public/themes/warning.png +0 -0
  67. data/resources/init.d.sh +58 -0
  68. data/setup.rb +1585 -0
  69. data/spec/alt_config.yml +50 -0
  70. data/spec/authenticators/active_resource_spec.rb +109 -0
  71. data/spec/authenticators/ldap_spec.rb +53 -0
  72. data/spec/casserver_spec.rb +156 -0
  73. data/spec/default_config.yml +50 -0
  74. data/spec/model_spec.rb +42 -0
  75. data/spec/spec.opts +4 -0
  76. data/spec/spec_helper.rb +89 -0
  77. data/spec/utils_spec.rb +53 -0
  78. data/tasks/bundler.rake +4 -0
  79. data/tasks/db/migrate.rake +12 -0
  80. data/tasks/spec.rake +10 -0
  81. metadata +308 -0
data/CHANGELOG ADDED
@@ -0,0 +1,325 @@
1
+ === 1.1.0 :: 2012-04-19
2
+
3
+ * NEW:
4
+ * Localization is now done using R18n instead of Gettext.
5
+ * Restored compatibility with Sinatra 1.2
6
+ * Now compatibile with Ruby 1.9.3
7
+ * Can now run without Bundler if all required dependencies are already installed.
8
+ * es_AR translations.
9
+
10
+ * CHANGED:
11
+ * It is no longer possible to select the locale by adding a 'lang=xx' attribute to the
12
+ request URL. The locale is selected using the 'Accept-Lanuage' header sent in the
13
+ request. However the old 'lang' functionality may be restored in a future version.
14
+ * Certain localized string keys have changed. If you are using your own custom views
15
+ you may need to modify them accordingly.
16
+
17
+ * FIXED:
18
+ * Removed unnecessary bcrypt requirement for encrypted sql authenticators.
19
+ * Single Sign Out requests should now work with SSL-enabled services.
20
+
21
+ === 1.0.1 :: 2011-11-22
22
+
23
+ * NEW:
24
+ * On startup the server now checks for a config.yml file in its own root directory,
25
+ then in /etc/rubycas-server.
26
+
27
+ * FIXED:
28
+ * Compatibilty with Sinatra 1.3 (:public changed to :public_folder).
29
+ * Database migration files should now be correctly bundled with the gem distribution.
30
+ * Should work with both ActiveRecord >= 2.3.12 and < 3.1. Previously the dependency
31
+ was erronously set to accept only the 2.3.12 series.
32
+ * Specs now pass under ActiveRecord 2.3.12 in both Ruby 1.8 and 1.9
33
+
34
+ === 1.0.0 :: 2011-08-03
35
+
36
+ * NEW:
37
+ * Rewrite to replace Camping/Picnic with Sinatra
38
+ * Support for Ruby 1.9.2
39
+ * Support for Active Record 3
40
+
41
+ * CHANGED:
42
+ * Google authenticator proxy configuration has been changed (see config.example.yml)
43
+
44
+ === 0.8.0
45
+
46
+ * NEW:
47
+ * Support for localization via Ruby-GetText.
48
+ See http://code.google.com/p/rubycas-server/wiki/Localization
49
+ for details. [antono]
50
+ * Switched to Picnic 0.8.x, so RubyCAS-Server is now based on Rack
51
+ and Camping 2.0 and is now compatible with Passenger Phusion
52
+ * Change to authenticator API: every authenticator now has a class 'setup'
53
+ method that gets called at server startup. This is where class-level
54
+ configuration should be done (e.g. establishing a database connection).
55
+ This is different from the 'configure' method which gets called on a per-
56
+ instance basis for each authenticator. [godfat]
57
+ * Database connections are now automatically released back to the connection
58
+ pool at the end of each request. This should allow the server to handle
59
+ many more concurrent requests, since database connections are no longer left
60
+ checked out of the pool.
61
+ * Added new SQL authenticator (sql_rest_auth) compatible with the
62
+ restful_authentication Rails plugin. [antono]
63
+ * Re-licensed under the MIT License.
64
+
65
+ * FIXED:
66
+ * Fixed weird problems with loading controllers when using older versions of
67
+ activesupport and/or rubygems.
68
+ * Failure to connect to a service during a single sign out request is now
69
+ handled gracefully.
70
+ * Required gem dependencies have been re-enabled in the gemspec.
71
+ * Authlogic authenticator files added to gemspec. [rajiv]
72
+ * Authenticators are now instantiated on a per-request basis (rather than
73
+ once at startup) to ensure thread safety.
74
+
75
+ === 0.7.1 :: 2008-11-10
76
+
77
+ * Fixed dependency loading problems introduced by upstream changes in RubyGems
78
+ 1.3.1.
79
+
80
+ === 0.7.0 :: 2008-11-04
81
+
82
+ * NEW:
83
+ * Implemented single-sign-out functionality as specified in CAS 3.3. See
84
+ http://www.ja-sig.org/wiki/display/CASUM/Single+Sign+Out.
85
+ * It is now possible to configure Authenticators to return extra attributes
86
+ to CAS clients alongside the username. For an example of how to do this see
87
+ the included SQL authenticator. Also have a look at:
88
+ http://groups.google.com/group/rubycas-server/browse_thread/thread/5eade3793cb590e9
89
+ Note that extra attributes of type other than String or Numeric are serialized
90
+ into YAML format before being sent along to the client.
91
+ * Added an MD5-password version of the SQL authenticator for Drupal and any other
92
+ database that stores its passwords in hashed form (thanks malcolmm).
93
+ * Added new Google authenticator for authenticating against Google/GMail
94
+ accounts.
95
+
96
+ * CHANGED:
97
+ * Service URIs are now automatically normalized. For example, if the service
98
+ URI given to the server has a 'ticket' parameter, the ticket will now be
99
+ automatically stripped. This is to avert any possible issues raised by
100
+ misbehaving CAS clients (the CAS ticket should never be part of the service
101
+ URI). Same goes for other CAS-related parameters like 'service', 'renew',
102
+ and 'gateway'. Additionally, the trailing '/' and '?' characters are
103
+ automatically stripped from URLs, since, for example, "http://google.com/"
104
+ is almost certainly equivalent to "http://google.com".
105
+ * The expire_sessions config variable is now respected -- ticket granting
106
+ ticket cookies are set with an expiry datetime, so that the SSO session
107
+ is effectively terminated once the ticket_granting_ticket_expiry period
108
+ is reached.
109
+ * If present, the HTTP_X_FORWARDED_FOR header is used for recording the
110
+ client's address. This is useful when the server is running behind a reverse
111
+ proxy, but it should not be considered authoritative since it can be
112
+ easily spoofed.
113
+ * The 'service' field in the 'casserver_st' table has been changed from
114
+ VARCHAR(255) to TEXT in order to accomodate service URIs longer than 255
115
+ characters (fixes issue #46).
116
+ * The CAS XML responses are no longer whitespace-formatted (i.e. Markaby's
117
+ auto-indentation has been turned off). Apparently the whitespace was
118
+ causing problems with mod_auth_cas. See:
119
+ http://groups.google.com/group/rubycas-server/browse_thread/thread/e482fe09999b73d3
120
+ * When used without pre-authentication, the LDAP authenticator now tries to
121
+ bind by searching for the given username in the LDAP directory based on the
122
+ configured username_attribute. Prior to this change the authenticator
123
+ attempted to bind with the LDAP server by assuming that the username credential
124
+ matches the user's CN. This is no longer the case.
125
+ * CAS responses to invalid requests (for example where required parameters
126
+ are missing or incorrect) will now have HTTP status code 422. Internal server
127
+ errors (where the server rather than the client is at fault) have error 500.
128
+ Previously most responses had error code 200, regardless of their contents.
129
+
130
+ * FIXED:
131
+ * Fixed logout action to work properly with ActiveRecord 2.1 (eager loading behaviour
132
+ was changed upstream forcing a change to the way we look for ProxyGrantingTickets
133
+ to delete on logout).
134
+ * When running under Mongrel, the USR2 signal should now restart the server as
135
+ expected -- however currently this only works when the server is running
136
+ in the foregaround. When daemonized, USR2 will shut down the server without
137
+ restarting (see issue #58).
138
+ * Fixed activerecord/activesupport gem load problems, hopefully once and for all
139
+ (however picnic-0.7.0 is now required).
140
+
141
+ === 0.6.0 :: 2008-03-28
142
+
143
+ * Much of the supporting functionality that makes RubyCAS-Server
144
+ act as a well-behaved Linux service has been abstracted out
145
+ into its own library. This new library is called Picnic and is
146
+ now a gem dependency for RubyCAS-Server. You can find out more about
147
+ it at http://code.google.com/p/camping-picnic/.
148
+ * The logout action will now accept a 'destination' parameter in lieu of
149
+ 'service'. This means that if a 'destination' parameter is given with
150
+ some URL, the logout action will show the login form, allowing the user
151
+ to immedietly log back in to the service specified by 'destination'.
152
+ * The logout action will now accept a 'url' parameter. If given, the logout
153
+ page will show a message indicating that the CAS session has been terminated
154
+ and instructing the user to click on a link to follow the given URL. If the
155
+ 'url' parameter is given, the login form will NOT be shown on the logout
156
+ page (see above).
157
+ * When an authentication failure occurs (because the user submitted
158
+ invalid credentials or the login ticket is missing), the server
159
+ now returns a 401 (Unauthorized) response instead of 200.
160
+ * An encryption-enabled version of the SQL authenticator is now
161
+ available. For more info have a look at:
162
+ http://code.google.com/p/rubycas-server/wiki/UsingTheSQLEncryptedAuthenticator
163
+ * Better compatibility with Oracle databases. The database migration
164
+ no longer tries to create tables with long names when long
165
+ table names are not supported by the underlying database connector
166
+ (issue #15).
167
+ * The server now automatically removes leading and trailing whitespace from
168
+ the username entered by users. Passwords however are left intact, with no
169
+ whitespace removed.
170
+ * The server can now be configured to automatically downcase the
171
+ username entered by users (dowcase_username option). So if a user
172
+ enters "JSmith", the system will convert it to "jsmith" if the
173
+ downcase_username option is set to true.
174
+ * The server can now be made to bind to a specific address. See the
175
+ :bind_address option in the config.example.yml file.
176
+ * Fixed bug with ActiveRecord 2.0.2 where service tickets were not
177
+ being given a type (issue #37).
178
+
179
+ === 0.5.1 :: 2007-12-20
180
+
181
+ * Tickets generated by the server should now be a lot more secure.
182
+ The random string generator used for generating tickets now uses
183
+ Crypt::ISAAC. Tickets have also been extended in length; STs, PTs
184
+ and LTs can now extend up to 32 characters, and PGTs and PGT-IOUs
185
+ up to 64.
186
+
187
+ === 0.5.0 :: 2007-09-20
188
+
189
+ * Gateway requests should now be handled correctly. When the request to the
190
+ login page is made with gateway=true as one of the parameters, the CAS
191
+ server will immediately redirect back to the target service along with
192
+ a service ticket if an SSO session exists for the user (or without a
193
+ service ticket if there is no pre-existing SSO session).
194
+ Note that if you are using RubyCAS-Client and want gatewaying, you will
195
+ need to upgrade it to 1.1.0 as gatewaying was broken in prior versions.
196
+ * If gateway=true is specified as part of the logout URI, the server will
197
+ log the user out and immediately redirect them back to the specified
198
+ service. In other words, you can now do "gatewayed logouts" as well
199
+ as logins.
200
+ * A login ticket can now be remotely requested from the server by placing
201
+ a POST request to '/loginTicket'.
202
+ * The login view can now be made to return only the login form. This is
203
+ done by adding the 'onlyLoginForm' parameter to the '/login' request.
204
+ Optionally, a 'submitToURI' parameter can be supplied to force the login
205
+ form to submit to the given URI (otherwise the server will try to figure
206
+ out the full URI to its own login controller). This functionality may be
207
+ useful when you want to embed the login form in some external page, as
208
+ an IFRAME otherwise.
209
+ * Custom views can now be used to override the default Markaby templates
210
+ by specifying a 'custom_views_file' option in the configuration. See
211
+ custom_views.example.rb. [jzylks]
212
+ * Table names have been shortened to work with Oracle. A migration has
213
+ been added that should do the shortening for you the first time you run
214
+ this new RubyCAS-Server version.
215
+ * Multiple authenticators can now be specified. During authentication,
216
+ credentials are presented to the first authenticator, then the second,
217
+ and so on, until the user is validated by any one authenticator or fails
218
+ validation for all of them. [jzylks]
219
+ * When using webrick, you can now run with SSL disabled by omitting the
220
+ ssl_cert and ssl_key parameters.
221
+ * Changed incorrect MySQL example database configuration -- option should
222
+ be 'host:' not 'server:' (issue #22).
223
+
224
+ === 0.4.2 :: 2007-07-26
225
+
226
+ * The LDAP/AD authenticator has been largely re-written. The code is a bit
227
+ cleaner now, and should work better with non-Active Directory LDAP servers
228
+ (although this has yet to be tested since I don't have access to a non-AD
229
+ LDAP server).
230
+ * The validate() method in your authenticators now receives a :service element
231
+ (in addition to :username, and :password). This is simply the service
232
+ url (if any) specified in the user's CAS request. If you call
233
+ read_standard_credentials(credentials) at the top of your validator, the value
234
+ will also be available as @service along with @username and @password.
235
+ * By request, a :username_prefix option has been added to the ldap
236
+ configuration. If entered, this string will be automatically prefixed to
237
+ the username entered by the user.
238
+ * A bug having to do with handling authenticator errors has been fixed.
239
+ Any authenticator error messages should now be correctly shown on the
240
+ login page.
241
+ * Minor improvements to error messages having to do with login tickets.
242
+ They're a bit more prescriptive now, explaining to the user what steps
243
+ they should take to correct the error.
244
+
245
+ === 0.4.1 :: 2007-06-07
246
+
247
+ * This release restores compatiblity with older versions of rubygems
248
+ (pre-0.9.0). To achieve this, we alias the 'gem' method to the old
249
+ 'require_gem' if 'gem' is not already defined.
250
+ * rubycas-server-ctl will now quiety delete an orphaned .pid file
251
+ instead complaining loudly and refusing to start up.
252
+ * Fixed minor bug in rubycas-server-ctl that sometimes incorrectly reported
253
+ startup problems when in fact the server had started just fine.
254
+
255
+
256
+ === 0.4.0 :: 2007-06-05
257
+
258
+ * Added rubycas-server-ctl script for controlling daemonized server.
259
+ * rubygems-0.9.0 or later is now required.
260
+ * Added system startup script to be used in /etc/init.d on Linux systems.
261
+ * Authenticator can now be loaded from an external file using the 'source'
262
+ configuration option.
263
+ * Better preemptive detection of startup problems with mongrel.
264
+ * User now sees an error message if the service URI is not a valid URI (i.e.
265
+ if it's not URI-encoded or otherwise malformed).
266
+
267
+
268
+ === 0.3.0 :: 2007-03-29
269
+
270
+ * Fixed glaring security problem with LDAP/AD Authenticator where under some
271
+ circumstances blank passwords were accepted as valid.
272
+ * Autocomplete has been turned off on the password field for better security.
273
+ In the future we may allow autocomplete to be re-enabled using a
274
+ configuration setting.
275
+ * When the user visits the login page and is already authenticated (i.e. they
276
+ have a valid ticket granting cookie), a message is shown at the top
277
+ indicating that they are already logged in.
278
+ * sqlite3-ruby is no longer required by the gem as a dependency. The user
279
+ must now install it manually prior to installing rubycas-server. The
280
+ building of sqlite3 native extensions appears to be somewhat flakey
281
+ and probably defeats the original purpose of using it (which was
282
+ to have a CAS server up and running with no additional DB configuration).
283
+ We will use MySQL as the default database adapter instead, since it does
284
+ not require additional libraries and many users will have a MySQL server
285
+ already available.
286
+ * Fixed bug that was causing all proxy-granting tickets to be deleted whenever
287
+ any user logged out. Only the PGTs for the user that is logging out are now
288
+ being deleted.
289
+ * Trailing slashes in service URLs are now ignored when validating service
290
+ and proxy tickets (e.g. "http://www.google.com" and "http://www.google.com/"
291
+ are now considered to be the same service URL).
292
+ * Authenticators now raise AuthenticatorError exceptions when encountering
293
+ a problem/error. This makes it easier to send feedback to the user.
294
+ However, other exceptions should still be raised when errors ought
295
+ not be recoverable (i.e. programming errors).
296
+ * Fixed serious vulnerability in LDAP authenticator where under some
297
+ cirumstances the user could just enter '*' as their username to match
298
+ any username. The LDAP authenticator will now refuse to process logins
299
+ with usernames that contain the characters * ( ) \ / and the NULL
300
+ character \0.
301
+ * Views are no longer xhtml-validated. Markaby's auto-validation was turned
302
+ off to allow for use of the autocomplete property on inputs, since this is
303
+ the only viable way of turning off password storage in IE and Firefox at
304
+ the page level.
305
+ * You can now limit the maximum length of a login session by setting the
306
+ expire_sessions config setting to true.
307
+ * Fixed some minor bugs in the login view.
308
+
309
+
310
+ === 0.2.0 :: 2007-03-20
311
+
312
+ * ruby-casserver now behaves more like a real command-line app, accepting
313
+ various command line arguments including -h (help), -v (version), -c (use
314
+ an alternate config.yml), and -d (daemonize, when using webrick or mongrel
315
+ mode).
316
+ * Special characters in CAS XML responses are now properly encoded into XML
317
+ entities
318
+ * CAS XML responses are no longer auto-indented... Markaby's indentation
319
+ seemed to be causing problems with the PHP CAS client.
320
+ * Misc minor bug fixes/cleanup.
321
+
322
+
323
+ === 0.1.0 :: 2007-03-01
324
+
325
+ * First public release.
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "http://rubygems.org"
2
+ gemspec
3
+
data/LICENSE ADDED
@@ -0,0 +1,26 @@
1
+ Portions of RubyCAS-Server contributed by Matt Zukowski are copyright (c) 2011 Urbacon Ltd.
2
+ Other portions are copyright of their respective authors.
3
+
4
+ The MIT License
5
+
6
+ Permission is hereby granted, free of charge, to any person
7
+ obtaining a copy of this software and associated documentation
8
+ files (the "Software"), to deal in the Software without
9
+ restriction, including without limitation the rights to use,
10
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the
12
+ Software is furnished to do so, subject to the following
13
+ conditions:
14
+
15
+ The above copyright notice and this permission notice shall be
16
+ included in all copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25
+ OTHER DEALINGS IN THE SOFTWARE.
26
+
data/README.md ADDED
@@ -0,0 +1,19 @@
1
+ # RubyCAS-Server ![http://stillmaintained.com/rubycas/rubycas-server](http://stillmaintained.com/rubycas/rubycas-server.png)
2
+
3
+ ## Copyright
4
+
5
+ Portions contributed by Matt Zukowski are copyright (c) 2011 Urbacon Ltd.
6
+ Other portions are copyright of their respective authors.
7
+
8
+ ## Authors
9
+
10
+ See http://github.com/gunark/rubycas-server/commits/
11
+
12
+ ## Installation
13
+
14
+ See http://code.google.com/p/rubycas-server
15
+
16
+ ## License
17
+
18
+ RubyCAS-Server is licensed for use under the terms of the MIT License.
19
+ See the LICENSE file bundled with the official RubyCAS-Server distribution for details.
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ Dir['tasks/**/*.rake'].each { |rake| load rake }
2
+ task :default => :spec
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # Enables UTF-8 compatibility in ruby 1.8.
4
+ $KCODE = 'u' if RUBY_VERSION < '1.9'
5
+
6
+ require 'rubygems'
7
+
8
+ $:.unshift File.dirname(__FILE__) + "/../lib"
9
+
10
+ if ARGV.join.match('--debugger')
11
+ require 'ruby-debug'
12
+ puts
13
+ puts "=> Debugger Enabled"
14
+ end
15
+
16
+ if ARGV.join.match('-c')
17
+ c = ARGV.join.match(/-c\s*([^\s]+)/)
18
+ if (c && c[1])
19
+ ENV['CONFIG_FILE'] = c[1]
20
+ puts
21
+ puts "=> Using custom config file #{ENV['CONFIG_FILE'].inspect}"
22
+ else
23
+ $stderr.puts("To specify a custom config file use `rubycas-server -c path/to/config_file_name.yml`.")
24
+ exit
25
+ end
26
+ end
27
+
28
+ require 'casserver'
29
+
30
+ CASServer::Server.run!