bmedia-casserver 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +325 -0
- data/Gemfile +3 -0
- data/LICENSE +26 -0
- data/README.md +19 -0
- data/Rakefile +2 -0
- data/bin/rubycas-server +30 -0
- data/config/config.example.yml +592 -0
- data/config/unicorn.rb +88 -0
- data/config.ru +17 -0
- data/db/migrate/001_create_initial_structure.rb +47 -0
- data/lib/casserver/authenticators/active_directory_ldap.rb +19 -0
- data/lib/casserver/authenticators/active_resource.rb +127 -0
- data/lib/casserver/authenticators/authlogic_crypto_providers/aes256.rb +43 -0
- data/lib/casserver/authenticators/authlogic_crypto_providers/bcrypt.rb +92 -0
- data/lib/casserver/authenticators/authlogic_crypto_providers/md5.rb +34 -0
- data/lib/casserver/authenticators/authlogic_crypto_providers/sha1.rb +59 -0
- data/lib/casserver/authenticators/authlogic_crypto_providers/sha512.rb +50 -0
- data/lib/casserver/authenticators/base.rb +67 -0
- data/lib/casserver/authenticators/client_certificate.rb +47 -0
- data/lib/casserver/authenticators/google.rb +58 -0
- data/lib/casserver/authenticators/ldap.rb +147 -0
- data/lib/casserver/authenticators/ntlm.rb +88 -0
- data/lib/casserver/authenticators/open_id.rb +22 -0
- data/lib/casserver/authenticators/sql.rb +133 -0
- data/lib/casserver/authenticators/sql_authlogic.rb +93 -0
- data/lib/casserver/authenticators/sql_encrypted.rb +75 -0
- data/lib/casserver/authenticators/sql_md5.rb +19 -0
- data/lib/casserver/authenticators/sql_rest_auth.rb +82 -0
- data/lib/casserver/authenticators/test.rb +22 -0
- data/lib/casserver/cas.rb +323 -0
- data/lib/casserver/localization.rb +13 -0
- data/lib/casserver/model.rb +270 -0
- data/lib/casserver/server.rb +758 -0
- data/lib/casserver/utils.rb +32 -0
- data/lib/casserver/views/_login_form.erb +42 -0
- data/lib/casserver/views/layout.erb +18 -0
- data/lib/casserver/views/login.erb +30 -0
- data/lib/casserver/views/proxy.builder +12 -0
- data/lib/casserver/views/proxy_validate.builder +25 -0
- data/lib/casserver/views/service_validate.builder +18 -0
- data/lib/casserver/views/validate.erb +2 -0
- data/lib/casserver.rb +11 -0
- data/locales/de.yml +27 -0
- data/locales/en.yml +26 -0
- data/locales/es.yml +26 -0
- data/locales/es_ar.yml +26 -0
- data/locales/fr.yml +26 -0
- data/locales/jp.yml +26 -0
- data/locales/pl.yml +26 -0
- data/locales/pt.yml +26 -0
- data/locales/ru.yml +26 -0
- data/locales/zh.yml +26 -0
- data/locales/zh_tw.yml +26 -0
- data/public/themes/cas.css +126 -0
- data/public/themes/notice.png +0 -0
- data/public/themes/ok.png +0 -0
- data/public/themes/simple/bg.png +0 -0
- data/public/themes/simple/favicon.png +0 -0
- data/public/themes/simple/login_box_bg.png +0 -0
- data/public/themes/simple/logo.png +0 -0
- data/public/themes/simple/theme.css +28 -0
- data/public/themes/urbacon/bg.png +0 -0
- data/public/themes/urbacon/login_box_bg.png +0 -0
- data/public/themes/urbacon/logo.png +0 -0
- data/public/themes/urbacon/theme.css +33 -0
- data/public/themes/warning.png +0 -0
- data/resources/init.d.sh +58 -0
- data/setup.rb +1585 -0
- data/spec/alt_config.yml +50 -0
- data/spec/authenticators/active_resource_spec.rb +109 -0
- data/spec/authenticators/ldap_spec.rb +53 -0
- data/spec/casserver_spec.rb +156 -0
- data/spec/default_config.yml +50 -0
- data/spec/model_spec.rb +42 -0
- data/spec/spec.opts +4 -0
- data/spec/spec_helper.rb +89 -0
- data/spec/utils_spec.rb +53 -0
- data/tasks/bundler.rake +4 -0
- data/tasks/db/migrate.rake +12 -0
- data/tasks/spec.rake +10 -0
- metadata +308 -0
@@ -0,0 +1,592 @@
|
|
1
|
+
# IMPORTANT NOTE ABOUT YAML CONFIGURATION FILES
|
2
|
+
# ---> Be sure to use spaces instead of tabs for indentation. YAML is
|
3
|
+
# white-space sensitive!
|
4
|
+
|
5
|
+
##### SERVER SETUP ################################################################
|
6
|
+
|
7
|
+
# There are several ways to run RubyCAS-Server:
|
8
|
+
#
|
9
|
+
# webrick -- stand-alone WEBrick server; should work out-of-the-box; this is
|
10
|
+
# the default method, but probably not suited for high-traffic usage
|
11
|
+
# mongrel -- stand-alone Mongrel server; fast, but you'll need to install
|
12
|
+
# and compile Mongrel and run it behind an https reverse proxy like
|
13
|
+
# Pound or Apache 2.2's mod_proxy (since Mongrel cannot serve out
|
14
|
+
# over SSL on its own).
|
15
|
+
# passenger -- served out by Apache via the mod_rails/mod_rack module
|
16
|
+
# (see http://www.modrails.com/)
|
17
|
+
#
|
18
|
+
# The following are example configurations for each of these three methods:
|
19
|
+
#
|
20
|
+
|
21
|
+
|
22
|
+
###
|
23
|
+
### WEBrick example
|
24
|
+
###
|
25
|
+
# WEBrick is a simple, all-Ruby web server. This is the easiest method for running
|
26
|
+
# RubyCAS-Server. All you need is an SSL certificate (enter its path under the
|
27
|
+
# ssl_cert option). WEBrick is fine for sites with low to medium traffic, but for
|
28
|
+
# high-performance scenarios you may want to look into deploying using Mongrel
|
29
|
+
# or Passenger.
|
30
|
+
|
31
|
+
server: webrick
|
32
|
+
port: 443
|
33
|
+
ssl_cert: /path/to/your/ssl.pem
|
34
|
+
|
35
|
+
# If your private key is in a separate file from the cert
|
36
|
+
|
37
|
+
#ssl_key: /path/to/your/private_key.pem
|
38
|
+
|
39
|
+
# If you do not already have an SSL certificate and would like to automatically
|
40
|
+
# generate one, run the "generate_ssl_certificate" rake task and use the following
|
41
|
+
# settings:
|
42
|
+
|
43
|
+
# ssl_cert: ssl/cert.pem
|
44
|
+
# ssl_key: ssl/key.pem
|
45
|
+
|
46
|
+
|
47
|
+
# By default the login page will be available at the root path
|
48
|
+
# (e.g. https://login.example.net/). The uri_path option lets you serve it from a
|
49
|
+
# different path (e.g. https://login.example.net/cas).
|
50
|
+
|
51
|
+
#uri_path: /cas
|
52
|
+
|
53
|
+
|
54
|
+
# This lets you bind the server to a specific address. Use 0.0.0.0 to listen on
|
55
|
+
# all available interfaces (this is the default).
|
56
|
+
|
57
|
+
#bind_address: 0.0.0.0
|
58
|
+
|
59
|
+
|
60
|
+
###
|
61
|
+
### Mongrel example
|
62
|
+
###
|
63
|
+
# Mongrel is much faster than WEBrick, but there are two caveats:
|
64
|
+
# 1. Since Mongrel can't serve out encrypted HTTP on its own (and CAS requires this),
|
65
|
+
# you will have to set up a reverse proxy like Pound or Apache's mod_proxy and
|
66
|
+
# route through it requests to the Mongrel server. So for example,
|
67
|
+
# your Pound server will receive all of the requests to RubyCAS-Server on port 443,
|
68
|
+
# and forward them to the Mongrel server listening on port 11011.
|
69
|
+
# 2. Some of Mongrel's components are compiled into native binaries, so if you are
|
70
|
+
# installing on Linux, make sure you have all of the standard build tools
|
71
|
+
# available. The binaries should be automatically compiled for you when you
|
72
|
+
# install the mogrel gem (if you're runnings Windows, pre-compiled
|
73
|
+
# binaries will be downloaded and installed, so don't worry about this).
|
74
|
+
|
75
|
+
#server: mongrel
|
76
|
+
#port: 11011
|
77
|
+
|
78
|
+
|
79
|
+
# Bind the server to a specific address. Use 0.0.0.0 to listen on all
|
80
|
+
# available interfaces (this is the default).
|
81
|
+
|
82
|
+
#bind_address: 0.0.0.0
|
83
|
+
|
84
|
+
### Reverse proxy configuration examples
|
85
|
+
# If you're using mod_proxy, your Apache vhost config should look something like this:
|
86
|
+
#
|
87
|
+
# Listen 443
|
88
|
+
# <VirtualHost *:443>
|
89
|
+
# ServerAdmin admin@example.net
|
90
|
+
# ServerName login.example.net
|
91
|
+
#
|
92
|
+
# SSLEngine On
|
93
|
+
# SSLCertificateFile /etc/apache2/ssl.crt/example.pem
|
94
|
+
#
|
95
|
+
# # Don't do forward proxying, we only want reverse proxying
|
96
|
+
# ProxyRequests Off
|
97
|
+
#
|
98
|
+
# <Proxy balancer://rubycas>
|
99
|
+
# Order allow,deny
|
100
|
+
# Allow from all
|
101
|
+
# BalancerMember http://127.0.0.1:11011
|
102
|
+
# </Proxy>
|
103
|
+
# </VirtualHost>
|
104
|
+
#
|
105
|
+
# For Pound, the config should be something like:
|
106
|
+
#
|
107
|
+
# ListenHTTPS
|
108
|
+
# Address 0.0.0.0
|
109
|
+
# Port 11011
|
110
|
+
# Cert "/etc/ssl/example.pem"
|
111
|
+
#
|
112
|
+
# Service
|
113
|
+
# BackEnd
|
114
|
+
# Address localhost
|
115
|
+
# Port 443
|
116
|
+
# End
|
117
|
+
# End
|
118
|
+
# End
|
119
|
+
|
120
|
+
|
121
|
+
###
|
122
|
+
### Phusion Passenger (running under Apache configured for SSL)
|
123
|
+
###
|
124
|
+
|
125
|
+
# No additional configuration is requried to run RubyCAS-Server under
|
126
|
+
# passsenger. Just follow the normal instructions for a Passenger app
|
127
|
+
# (see http://www.modrails.com/).
|
128
|
+
#
|
129
|
+
# Here's an example Apache vhost config for RubyCAS-Server and Passenger:
|
130
|
+
#
|
131
|
+
# Listen 443
|
132
|
+
# <VirtualHost *:443>
|
133
|
+
# ServerAdmin admin@example.net
|
134
|
+
# ServerName login.example.net
|
135
|
+
#
|
136
|
+
# SSLEngine On
|
137
|
+
# SSLCertificateFile /etc/apache2/ssl.crt/example.pem
|
138
|
+
#
|
139
|
+
# RailsAutoDetect off
|
140
|
+
#
|
141
|
+
# DocumentRoot /usr/lib/ruby/gems/1.8/gems/rubycas-server-0.8.0/public
|
142
|
+
#
|
143
|
+
# <Directory "/usr/lib/ruby/gems/1.8/gems/rubycas-server-0.8.0/public">
|
144
|
+
# AllowOverride all
|
145
|
+
# Allow from all
|
146
|
+
# </Directory>
|
147
|
+
# </VirtualHost>
|
148
|
+
#
|
149
|
+
|
150
|
+
|
151
|
+
##### DATABASE #################################################################
|
152
|
+
|
153
|
+
# Set up the database connection. Make sure that this database is secure!
|
154
|
+
#
|
155
|
+
# By default, we use MySQL, since it is widely used and does not require any
|
156
|
+
# additional ruby libraries besides ActiveRecord.
|
157
|
+
#
|
158
|
+
# With MySQL, your config would be something like the following:
|
159
|
+
# (be sure to create the casserver database in MySQL beforehand,
|
160
|
+
# i.e. `mysqladmin -u root create casserver`)
|
161
|
+
|
162
|
+
database:
|
163
|
+
adapter: mysql
|
164
|
+
database: casserver
|
165
|
+
username: root
|
166
|
+
password:
|
167
|
+
host: localhost
|
168
|
+
reconnect: true
|
169
|
+
|
170
|
+
# IMPORTANT! By default, the server can handle up to ~5 concurrent requests
|
171
|
+
# (without queuing). You can increase this by setting the database connection
|
172
|
+
# pool size to a higher number. For example, to handle up to ~10 concurrent
|
173
|
+
# requests:
|
174
|
+
#
|
175
|
+
#database:
|
176
|
+
# pool: 10
|
177
|
+
# adapter: mysql
|
178
|
+
# database: casserver
|
179
|
+
# username: root
|
180
|
+
# password:
|
181
|
+
# host: localhost
|
182
|
+
|
183
|
+
#
|
184
|
+
# Instead of MySQL you can use SQLite3, PostgreSQL, MSSQL, or anything else
|
185
|
+
# supported by ActiveRecord.
|
186
|
+
#
|
187
|
+
# With SQLite3 (which does not require a separate database server), your
|
188
|
+
# configuration would look something like the following (don't forget to install
|
189
|
+
# the sqlite3-ruby gem beforehand!):
|
190
|
+
|
191
|
+
#database:
|
192
|
+
# adapter: sqlite3
|
193
|
+
# database: /var/lib/casserver.db
|
194
|
+
|
195
|
+
|
196
|
+
# By default RubyCAS-Server will run migrations at every startup to ensure
|
197
|
+
# that its database schema is up-to-date. To disable this behaviour set
|
198
|
+
# the following option to true:
|
199
|
+
|
200
|
+
#disable_auto_migrations: true
|
201
|
+
|
202
|
+
##### AUTHENTICATION ###########################################################
|
203
|
+
|
204
|
+
# Configure how username/passwords are validated.
|
205
|
+
#
|
206
|
+
# !!! YOU MUST CONFIGURE AT LEAST ONE OF THESE AUTHENTICATION METHODS !!!
|
207
|
+
#
|
208
|
+
# There are several built-in methods for authentication:
|
209
|
+
# SQL, ActiveDirectory, LDAP, and GoogleAccounts. If none of these work for you,
|
210
|
+
# it is relatively easy to write your own custom Authenticator class (see below).
|
211
|
+
#
|
212
|
+
# === SQL Authentication =======================================================
|
213
|
+
#
|
214
|
+
# The simplest method is to validate against a SQL database. This assumes
|
215
|
+
# that all of your users are stored in a table that has a 'username' column
|
216
|
+
# and a 'password' column. When the user logs in, CAS connects to this database
|
217
|
+
# and looks for a matching username/password in the users table. If a matching
|
218
|
+
# username and password is found, authentication is successful.
|
219
|
+
#
|
220
|
+
# If you prefer to have your passwords stored in an encrypted form, have a
|
221
|
+
# look at the SQLEncrypted authenticator:
|
222
|
+
# http://code.google.com/p/rubycas-server/wiki/UsingTheSQLEncryptedAuthenticator
|
223
|
+
#
|
224
|
+
# If your users table stores passwords with MD5 hashing (for example as with
|
225
|
+
# Drupal) try using the SQLMd5 version of the SQL authenticator.
|
226
|
+
#
|
227
|
+
# Example:
|
228
|
+
#
|
229
|
+
#authenticator:
|
230
|
+
# class: CASServer::Authenticators::SQL
|
231
|
+
# database:
|
232
|
+
# adapter: mysql
|
233
|
+
# database: some_database_with_users_table
|
234
|
+
# username: root
|
235
|
+
# password:
|
236
|
+
# host: localhost
|
237
|
+
# user_table: users
|
238
|
+
# username_column: username
|
239
|
+
# password_column: password
|
240
|
+
#
|
241
|
+
# When replying to a CAS client's validation request, the server will normally
|
242
|
+
# provide the client with the authenticated user's username. However it is
|
243
|
+
# possible for the server to provide the client with additional attributes.
|
244
|
+
# You can configure the SQL authenticator to provide data from additional
|
245
|
+
# columns in the users table by listing the names of the columns under the
|
246
|
+
# 'extra_attributes' option. Note though that this functionality is experimental.
|
247
|
+
# It should work with RubyCAS-Client, but may or may not work with other CAS
|
248
|
+
# clients.
|
249
|
+
#
|
250
|
+
# For example, with this configuration, the 'full_name' and 'access_level'
|
251
|
+
# columns will be provided to your CAS clients along with the username:
|
252
|
+
#
|
253
|
+
#authenticator:
|
254
|
+
# class: CASServer::Authenticators::SQL
|
255
|
+
# database:
|
256
|
+
# adapter: mysql
|
257
|
+
# database: some_database_with_users_table
|
258
|
+
# user_table: users
|
259
|
+
# username_column: username
|
260
|
+
# password_column: password
|
261
|
+
# extra_attributes: full_name, access_level
|
262
|
+
#
|
263
|
+
#
|
264
|
+
#
|
265
|
+
# === Google Authentication ====================================================
|
266
|
+
#
|
267
|
+
# The Google authenticator allows users to log in to your CAS server using
|
268
|
+
# their Google account credentials (i.e. the same email and password they
|
269
|
+
# would use to log in to Google services like Gmail). This authenticator
|
270
|
+
# requires no special configuration -- just specify its class name:
|
271
|
+
#
|
272
|
+
#authenticator:
|
273
|
+
# class: CASServer::Authenticators::Google
|
274
|
+
#
|
275
|
+
# If you are behind an http proxy, you can try specifying proxy settings as follows:
|
276
|
+
#
|
277
|
+
#authenticator:
|
278
|
+
# class: CASServer::Authenticators::Google
|
279
|
+
# proxy:
|
280
|
+
# host: your-proxy-server
|
281
|
+
# port: 8080
|
282
|
+
# username: nil
|
283
|
+
# password: nil
|
284
|
+
#
|
285
|
+
# Note that as with all authenticators, it is possible to use the Google
|
286
|
+
# authenticator alongside other authenticators. For example, CAS can first
|
287
|
+
# attempt to validate the account with Google, and if that fails, fall back
|
288
|
+
# to some other local authentication mechanism.
|
289
|
+
#
|
290
|
+
# For example:
|
291
|
+
#
|
292
|
+
#authenticator:
|
293
|
+
# - class: CASServer::Authenticators::Google
|
294
|
+
# - class: CASServer::Authenticators::SQL
|
295
|
+
# database:
|
296
|
+
# adapter: mysql
|
297
|
+
# database: some_database_with_users_table
|
298
|
+
# username: root
|
299
|
+
# password:
|
300
|
+
# host: localhost
|
301
|
+
# user_table: user
|
302
|
+
# username_column: username
|
303
|
+
# password_column: password
|
304
|
+
#
|
305
|
+
#
|
306
|
+
# === ActiveDirectory Authentication ===========================================
|
307
|
+
#
|
308
|
+
# This method authenticates against Microsoft's Active Directory using LDAP.
|
309
|
+
# You must configure the ActiveDirectory server, and base DN. The port number
|
310
|
+
# and LDAP filter are optional. You must also enter a CN and password
|
311
|
+
# for a special "authenticator" user. This account is used to log in to
|
312
|
+
# the ActiveDirectory server and search LDAP. This does not have to be an
|
313
|
+
# administrative account -- it only has to be able to search for other
|
314
|
+
# users.
|
315
|
+
#
|
316
|
+
# Note that the auth_user parameter must be the user's CN (Common Name).
|
317
|
+
# In Active Directory, the CN is genarally the user's full name, which is usually
|
318
|
+
# NOT the same as their username (sAMAccountName).
|
319
|
+
#
|
320
|
+
# For example:
|
321
|
+
#
|
322
|
+
#authenticator:
|
323
|
+
# class: CASServer::Authenticators::ActiveDirectoryLDAP
|
324
|
+
# ldap:
|
325
|
+
# host: ad.example.net
|
326
|
+
# port: 389
|
327
|
+
# base: dc=example,dc=net
|
328
|
+
# filter: (objectClass=person)
|
329
|
+
# auth_user: authenticator
|
330
|
+
# auth_password: itsasecret
|
331
|
+
#
|
332
|
+
# A more complicated example, where the authenticator will use TLS encryption,
|
333
|
+
# will ignore users with disabled accounts, and will pass on the 'cn' and 'mail'
|
334
|
+
# attributes to CAS clients:
|
335
|
+
#
|
336
|
+
#authenticator:
|
337
|
+
# class: CASServer::Authenticators::ActiveDirectoryLDAP
|
338
|
+
# ldap:
|
339
|
+
# host: ad.example.net
|
340
|
+
# port: 636
|
341
|
+
# base: dc=example,dc=net
|
342
|
+
# filter: (objectClass=person) & !(msExchHideFromAddressLists=TRUE)
|
343
|
+
# auth_user: authenticator
|
344
|
+
# auth_password: itsasecret
|
345
|
+
# encryption: simple_tls
|
346
|
+
# extra_attributes: cn, mail
|
347
|
+
#
|
348
|
+
# It is possible to authenticate against Active Directory without the
|
349
|
+
# authenticator user, but this requires that users type in their CN as
|
350
|
+
# the username rather than typing in their sAMAccountName. In other words
|
351
|
+
# users will likely have to authenticate by typing their full name,
|
352
|
+
# rather than their username. If you prefer to do this, then just
|
353
|
+
# omit the auth_user and auth_password values in the above example.
|
354
|
+
#
|
355
|
+
#
|
356
|
+
# === LDAP Authentication ======================================================
|
357
|
+
#
|
358
|
+
# This is a more general version of the ActiveDirectory authenticator.
|
359
|
+
# The configuration is similar, except you don't need an authenticator
|
360
|
+
# username or password. The following example has been reported to work
|
361
|
+
# for a basic OpenLDAP setup.
|
362
|
+
#
|
363
|
+
#authenticator:
|
364
|
+
# class: CASServer::Authenticators::LDAP
|
365
|
+
# ldap:
|
366
|
+
# host: ldap.example.net
|
367
|
+
# port: 389
|
368
|
+
# base: dc=example,dc=net
|
369
|
+
# username_attribute: uid
|
370
|
+
# filter: (objectClass=person)
|
371
|
+
#
|
372
|
+
# If you need more secure connections via TSL, specify the 'encryption'
|
373
|
+
# option and change the port. This example also forces the authenticator
|
374
|
+
# to connect using a special "authenticator" user with the given
|
375
|
+
# username and password (see the ActiveDirectoryLDAP authenticator
|
376
|
+
# explanation above):
|
377
|
+
#
|
378
|
+
#authenticator:
|
379
|
+
# class: CASServer::Authenticators::LDAP
|
380
|
+
# ldap:
|
381
|
+
# host: ldap.example.net
|
382
|
+
# port: 636
|
383
|
+
# base: dc=example,dc=net
|
384
|
+
# filter: (objectClass=person)
|
385
|
+
# encryption: simple_tls
|
386
|
+
# auth_user: cn=admin,dc=example,dc=net
|
387
|
+
# auth_password: secret
|
388
|
+
#
|
389
|
+
# If you need additional data about the user passed to the client (for example,
|
390
|
+
# their 'cn' and 'mail' attributes, you can specify the list of attributes
|
391
|
+
# under the extra_attributes config option:
|
392
|
+
#
|
393
|
+
#authenticator:
|
394
|
+
# class: CASServer::Authenticators::LDAP
|
395
|
+
# ldap:
|
396
|
+
# host: ldap.example.net
|
397
|
+
# port: 389
|
398
|
+
# base: dc=example,dc=net
|
399
|
+
# filter: (objectClass=person)
|
400
|
+
# extra_attributes: cn, mail
|
401
|
+
#
|
402
|
+
# Note that the above functionality is somewhat limited by client compatibility.
|
403
|
+
# See the SQL authenticator notes above for more info.
|
404
|
+
#
|
405
|
+
#
|
406
|
+
# === Custom Authentication ====================================================
|
407
|
+
#
|
408
|
+
# It should be relatively easy to write your own Authenticator class. Have a look
|
409
|
+
# at the built-in authenticators in the casserver/authenticators directory. Your
|
410
|
+
# authenticator should extend the CASServer::Authenticators::Base class and must
|
411
|
+
# implement a validate() method that takes a single hash argument. When the user
|
412
|
+
# submits the login form, the username and password they entered is passed to
|
413
|
+
# validate() as a hash under :username and :password keys. In the future, this
|
414
|
+
# hash might also contain other data such as the domain that the user is logging
|
415
|
+
# in to.
|
416
|
+
#
|
417
|
+
# To use your custom authenticator, specify it's class name and path to the
|
418
|
+
# source file in the authenticator section of the config. Any other parameters
|
419
|
+
# you specify in the authenticator configuration will be passed on to the
|
420
|
+
# authenticator and made availabe in the validate() method as an @options hash.
|
421
|
+
#
|
422
|
+
# Example:
|
423
|
+
#
|
424
|
+
#authenticator:
|
425
|
+
# class: FooModule::MyCustomAuthenticator
|
426
|
+
# source: /path/to/source.rb
|
427
|
+
# option_a: foo
|
428
|
+
# another_option: yeeha
|
429
|
+
#
|
430
|
+
# === Multiple Authenticators ==================================================
|
431
|
+
#
|
432
|
+
# If you need to have more than one source for authentication, such as an LDAP
|
433
|
+
# directory and a database, you can use multiple authenticators by making
|
434
|
+
# :authenticator an array of authenticators.
|
435
|
+
#
|
436
|
+
#authenticator:
|
437
|
+
# -
|
438
|
+
# class: CASServer::Authenticators::ActiveDirectoryLDAP
|
439
|
+
# ldap:
|
440
|
+
# host: ad.example.net
|
441
|
+
# port: 389
|
442
|
+
# base: dc=example,dc=net
|
443
|
+
# filter: (objectClass=person)
|
444
|
+
# -
|
445
|
+
# class: CASServer::Authenticators::SQL
|
446
|
+
# database:
|
447
|
+
# adapter: mysql
|
448
|
+
# database: some_database_with_users_table
|
449
|
+
# username: root
|
450
|
+
# password:
|
451
|
+
# host: localhost
|
452
|
+
# user_table: user
|
453
|
+
# username_column: username
|
454
|
+
# password_column: password
|
455
|
+
#
|
456
|
+
# During authentication, the user credentials will be checked against the first
|
457
|
+
# authenticator and on failure fall through to the second authenticator.
|
458
|
+
#
|
459
|
+
|
460
|
+
|
461
|
+
##### LOOK & FEEL ##############################################################
|
462
|
+
|
463
|
+
# Set the path to the theme directory that determines how your CAS pages look.
|
464
|
+
#
|
465
|
+
# Custom themes are not well supported yet, but will be in the near future. In
|
466
|
+
# the meantime, if you want to create a custom theme, you can create a
|
467
|
+
# subdirectory under the CASServer's themes dir (for example,
|
468
|
+
# '/usr/lib/ruby/1.8/gems/casserver-xxx/public/themes', if you installed CASServer
|
469
|
+
# on Linux as a gem). A theme is basically just a theme.css file that overrides
|
470
|
+
# the themes/cas.css styles along with a collection of image files
|
471
|
+
# like logo.png and bg.png.
|
472
|
+
#
|
473
|
+
# By default, we use the 'simple' theme which you can find in themes/simple.
|
474
|
+
theme: simple
|
475
|
+
|
476
|
+
# The name of your company/organization. This will show up on the login page.
|
477
|
+
organization: CAS
|
478
|
+
|
479
|
+
# A short bit of text that shows up on the login page. You can make this blank
|
480
|
+
# if you prefer to have no extra text shown at the bottom of the login box.
|
481
|
+
infoline: Powered by <a href="http://code.google.com/p/rubycas-server/">RubyCAS-Server</a>
|
482
|
+
|
483
|
+
# Custom views directory. If set, this will be used instead of 'lib/casserver/views'.
|
484
|
+
#custom_views: /path/to/custom/views
|
485
|
+
|
486
|
+
# Custom public directory. If set, static content (css, etc.) will be served from here rather
|
487
|
+
# than from rubycas-server's internal 'public' directory (but be mindful of any overriding
|
488
|
+
# settings you may have in your web server's config).
|
489
|
+
#public_dir: /path/to/custom/public
|
490
|
+
|
491
|
+
##### LOCALIZATION (L10N) #######################################################
|
492
|
+
# The server will attempt to detect the user's locale and show text in the
|
493
|
+
# appropriate language based on:
|
494
|
+
#
|
495
|
+
# 1. The 'lang' URL parameter (if any)
|
496
|
+
# 2. The 'lang' cookie (if any)
|
497
|
+
# 3. The HTTP_ACCEPT_LANGUAGE header supplied by the user's browser.
|
498
|
+
# 4. The HTTP_USER_AGENT header supplied by the user's browser.
|
499
|
+
#
|
500
|
+
# If the locale cannot be established based on one of the above checks (in the
|
501
|
+
# shown order), then the below 'default_locale' option will be used.
|
502
|
+
#
|
503
|
+
# The format is the same as standard linux locales (langagecode_COUNTRYCODE):
|
504
|
+
#
|
505
|
+
# ru_RU - Russian, Russia
|
506
|
+
# eo_AQ - Esperanto, Antarctica
|
507
|
+
#
|
508
|
+
# It will also work if you leave out the region (i.e. just "ru" for Russian,
|
509
|
+
# "eo" for Esperanto).
|
510
|
+
#
|
511
|
+
# If you are interested in contributing new translations or have corrections
|
512
|
+
# to the existing translations, see
|
513
|
+
# http://code.google.com/p/rubycas-server/wiki/HowToContribueTranslations
|
514
|
+
#
|
515
|
+
default_locale: en
|
516
|
+
|
517
|
+
##### LOGGING ##################################################################
|
518
|
+
|
519
|
+
# Configure general logging. This log is where you'll want to look in case of
|
520
|
+
# problems.
|
521
|
+
#
|
522
|
+
# You may want to change the file to something like /var/log/casserver.log
|
523
|
+
# Set the level to DEBUG if you want more detailed logging.
|
524
|
+
|
525
|
+
log:
|
526
|
+
file: /var/log/casserver.log
|
527
|
+
level: INFO
|
528
|
+
|
529
|
+
|
530
|
+
# If you want full database logging, uncomment this next section.
|
531
|
+
# Every SQL query will be logged here. This is useful for debugging database
|
532
|
+
# problems.
|
533
|
+
|
534
|
+
#db_log:
|
535
|
+
# file: /var/log/casserver_db.log
|
536
|
+
|
537
|
+
|
538
|
+
# Setting the following option to true will disable CLI output to stdout.
|
539
|
+
# i.e. this will get rid of messages like ">>> Redirecting RubyCAS-Server log..."
|
540
|
+
# This is useful when, for example, you're running rspecs.
|
541
|
+
|
542
|
+
#quiet: true
|
543
|
+
|
544
|
+
|
545
|
+
##### SINGLE SIGN-OUT ##########################################################
|
546
|
+
|
547
|
+
# When a user logs in to a CAS-enabled client application, that application
|
548
|
+
# generally opens its own local user session. When the user then logs out
|
549
|
+
# through the CAS server, each of the CAS-enabled client applications need
|
550
|
+
# to be notified so that they can close their own local sessions for that user.
|
551
|
+
#
|
552
|
+
# Up until recently this was not possible within CAS. However, a method for
|
553
|
+
# performing this notification was recently added to the protocol (in CAS 3.1).
|
554
|
+
# This works exactly as described above -- when the user logs out, the CAS
|
555
|
+
# server individually contacts each client service and notifies it of the
|
556
|
+
# logout. Currently not all client applications support this, so this
|
557
|
+
# behaviour is disabled by default. To enable it, uncomment the following
|
558
|
+
# configuration line. Note that currently it is not possible to enable
|
559
|
+
# or disable single-sign-out on a per-service basis, but this functionality
|
560
|
+
# is planned for a future release.
|
561
|
+
|
562
|
+
#enable_single_sign_out: true
|
563
|
+
|
564
|
+
|
565
|
+
##### OTHER ####################################################################
|
566
|
+
|
567
|
+
# You can set various ticket expiry times (specify the value in seconds).
|
568
|
+
|
569
|
+
# Unused login and service tickets become unusable this many seconds after
|
570
|
+
# they are created. (Defaults to 5 minutes)
|
571
|
+
|
572
|
+
#maximum_unused_login_ticket_lifetime: 300
|
573
|
+
#maximum_unused_service_ticket_lifetime: 300
|
574
|
+
|
575
|
+
# The server must periodically delete old tickets (login tickets, service tickets
|
576
|
+
# proxy-granting tickets, and ticket-granting tickets) to prevent buildup of
|
577
|
+
# stale data. This effectively limits the maximum length of a CAS session to
|
578
|
+
# the lifetime given here (in seconds). (Defaults to 48 hours)
|
579
|
+
#
|
580
|
+
# Note that this limit is not enforced on the client side; it refers only to the
|
581
|
+
# the maximum lifetime of tickets on the CAS server.
|
582
|
+
|
583
|
+
#maximum_session_lifetime: 172800
|
584
|
+
|
585
|
+
|
586
|
+
# If you want the usernames entered on the login page to be automatically
|
587
|
+
# downcased (converted to lowercase), enable the following option. When this
|
588
|
+
# option is set to true, if the user enters "JSmith" as their username, the
|
589
|
+
# system will automatically
|
590
|
+
# convert this to "jsmith".
|
591
|
+
|
592
|
+
#downcase_username: true
|
data/config/unicorn.rb
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
# Sample configuration file for Unicorn (not Rack)
|
2
|
+
#
|
3
|
+
# See http://unicorn.bogomips.org/Unicorn/Configurator.html for complete
|
4
|
+
# documentation.
|
5
|
+
SINATRA_ROOT = `pwd`.strip
|
6
|
+
|
7
|
+
# Use at least one worker per core if you're on a dedicated server,
|
8
|
+
# more will usually help for _short_ waits on databases/caches.
|
9
|
+
worker_processes 3
|
10
|
+
|
11
|
+
# Help ensure your application will always spawn in the symlinked
|
12
|
+
# "current" directory that Capistrano sets up.
|
13
|
+
working_directory SINATRA_ROOT # available in 0.94.0+
|
14
|
+
|
15
|
+
# listen on both a Unix domain socket and a TCP port,
|
16
|
+
# we use a shorter backlog for quicker failover when busy
|
17
|
+
# listen "/tmp/.sock", :backlog => 64
|
18
|
+
listen 18889, :tcp_nopush => true
|
19
|
+
|
20
|
+
# nuke workers after 30 seconds instead of 60 seconds (the default)
|
21
|
+
timeout 30
|
22
|
+
|
23
|
+
# feel free to point this anywhere accessible on the filesystem
|
24
|
+
|
25
|
+
pid "#{SINATRA_ROOT}/tmp/pids/unicorn.pid"
|
26
|
+
|
27
|
+
# relative_path "/test_platform"
|
28
|
+
# some applications/frameworks log to stderr or stdout, so prevent
|
29
|
+
# them from going to /dev/null when daemonized here:
|
30
|
+
stderr_path "#{SINATRA_ROOT}/log/unicorn.stderr.log"
|
31
|
+
stdout_path "#{SINATRA_ROOT}/log/unicorn.stdout.log"
|
32
|
+
|
33
|
+
# combine REE with "preload_app true" for memory savings
|
34
|
+
# http://rubyenterpriseedition.com/faq.html#adapt_apps_for_cow
|
35
|
+
preload_app false
|
36
|
+
GC.respond_to?(:copy_on_write_friendly=) and
|
37
|
+
GC.copy_on_write_friendly = true
|
38
|
+
|
39
|
+
before_fork do |server, worker|
|
40
|
+
# the following is highly recomended for Rails + "preload_app true"
|
41
|
+
# as there's no need for the master process to hold a connection
|
42
|
+
# defined?(ActiveRecord::Base) and
|
43
|
+
# ActiveRecord::Base.connection.disconnect!
|
44
|
+
|
45
|
+
# The following is only recommended for memory/DB-constrained
|
46
|
+
# installations. It is not needed if your system can house
|
47
|
+
# twice as many worker_processes as you have configured.
|
48
|
+
#
|
49
|
+
# # This allows a new master process to incrementally
|
50
|
+
# # phase out the old master process with SIGTTOU to avoid a
|
51
|
+
# # thundering herd (especially in the "preload_app false" case)
|
52
|
+
# # when doing a transparent upgrade. The last worker spawned
|
53
|
+
# # will then kill off the old master process with a SIGQUIT.
|
54
|
+
old_pid = "#{server.config[:pid]}.oldbin"
|
55
|
+
|
56
|
+
puts 'pid:'
|
57
|
+
puts '-------------------'
|
58
|
+
puts server.pid
|
59
|
+
puts old_pid
|
60
|
+
puts '---------------------'
|
61
|
+
|
62
|
+
if old_pid != server.pid
|
63
|
+
begin
|
64
|
+
sig = (worker.nr + 1) >= server.worker_processes ? :QUIT : :TTOU
|
65
|
+
Process.kill(sig, File.read(old_pid).to_i)
|
66
|
+
rescue Errno::ENOENT, Errno::ESRCH
|
67
|
+
end
|
68
|
+
end
|
69
|
+
#
|
70
|
+
# # *optionally* throttle the master from forking too quickly by sleeping
|
71
|
+
sleep 1
|
72
|
+
end
|
73
|
+
|
74
|
+
after_fork do |server, worker|
|
75
|
+
# per-process listener ports for debugging/admin/migrations
|
76
|
+
# addr = "127.0.0.1:#{9293 + worker.nr}"
|
77
|
+
# server.listen(addr, :tries => -1, :delay => 5, :tcp_nopush => true)
|
78
|
+
|
79
|
+
# the following is *required* for Rails + "preload_app true",
|
80
|
+
# defined?(ActiveRecord::Base) and
|
81
|
+
# ActiveRecord::Base.establish_connection
|
82
|
+
|
83
|
+
# if preload_app is true, then you may also want to check and
|
84
|
+
# restart any other shared sockets/descriptors such as Memcached,
|
85
|
+
# and Redis. TokyoCabinet file handles are safe to reuse
|
86
|
+
# between any number of forked children (assuming your kernel
|
87
|
+
# correctly implements pread()/pwrite() system calls)
|
88
|
+
end
|
data/config.ru
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
|
3
|
+
# Assume all necessary gems are in place if bundler is not installed.
|
4
|
+
begin
|
5
|
+
require 'bundler/setup'
|
6
|
+
rescue LoadError => e
|
7
|
+
raise e unless e.message =~ /no such file to load -- bundler/
|
8
|
+
end
|
9
|
+
|
10
|
+
$:.unshift "#{File.dirname(__FILE__)}/lib"
|
11
|
+
require "casserver"
|
12
|
+
|
13
|
+
use Rack::ShowExceptions
|
14
|
+
use Rack::Runtime
|
15
|
+
use Rack::CommonLogger
|
16
|
+
|
17
|
+
run CASServer::Server.new
|