arpitjain11-rubycas-server 0.8.0.20090612
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.txt +1 -0
- data/History.txt +272 -0
- data/LICENSE.txt +504 -0
- data/Manifest.txt +85 -0
- data/PostInstall.txt +3 -0
- data/README.rdoc +26 -0
- data/Rakefile +4 -0
- data/bin/rubycas-server +13 -0
- data/bin/rubycas-server-ctl +9 -0
- data/config/hoe.rb +78 -0
- data/config/requirements.rb +15 -0
- data/config.example.yml +544 -0
- data/config.ru +38 -0
- data/custom_views.example.rb +11 -0
- data/lib/casserver/authenticators/active_directory_ldap.rb +11 -0
- data/lib/casserver/authenticators/base.rb +48 -0
- data/lib/casserver/authenticators/client_certificate.rb +46 -0
- data/lib/casserver/authenticators/google.rb +54 -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 +102 -0
- data/lib/casserver/authenticators/sql_encrypted.rb +76 -0
- data/lib/casserver/authenticators/sql_md5.rb +19 -0
- data/lib/casserver/authenticators/sql_rest_auth.rb +77 -0
- data/lib/casserver/authenticators/test.rb +19 -0
- data/lib/casserver/cas.rb +322 -0
- data/lib/casserver/conf.rb +75 -0
- data/lib/casserver/controllers.rb +457 -0
- data/lib/casserver/load_picnic.rb +19 -0
- data/lib/casserver/localization.rb +82 -0
- data/lib/casserver/models.rb +265 -0
- data/lib/casserver/postambles.rb +174 -0
- data/lib/casserver/utils.rb +30 -0
- data/lib/casserver/version.rb +9 -0
- data/lib/casserver/views.rb +245 -0
- data/lib/casserver.rb +58 -0
- data/lib/rubycas-server/version.rb +1 -0
- data/lib/rubycas-server.rb +1 -0
- data/po/de_DE/rubycas-server.po +119 -0
- data/po/es_ES/rubycas-server.po +115 -0
- data/po/fr_FR/rubycas-server.po +116 -0
- data/po/ja_JP/rubycas-server.po +118 -0
- data/po/pl_PL/rubycas-server.po +115 -0
- data/po/pt_BR/rubycas-server.po +115 -0
- data/po/ru_RU/rubycas-server.po +110 -0
- data/po/rubycas-server.pot +104 -0
- data/public/themes/cas.css +121 -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/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/script/console +10 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/script/txt2html +82 -0
- data/setup.rb +1585 -0
- data/tasks/deployment.rake +34 -0
- data/tasks/environment.rake +7 -0
- data/tasks/localization.rake +11 -0
- data/tasks/website.rake +17 -0
- data/vendor/isaac_0.9.1/LICENSE +26 -0
- data/vendor/isaac_0.9.1/README +78 -0
- data/vendor/isaac_0.9.1/TODO +3 -0
- data/vendor/isaac_0.9.1/VERSIONS +3 -0
- data/vendor/isaac_0.9.1/crypt/ISAAC.rb +171 -0
- data/vendor/isaac_0.9.1/isaac.gemspec +39 -0
- data/vendor/isaac_0.9.1/setup.rb +596 -0
- data/vendor/isaac_0.9.1/test/TC_ISAAC.rb +76 -0
- metadata +193 -0
data/config/hoe.rb
ADDED
@@ -0,0 +1,78 @@
|
|
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
|
+
'locale',
|
14
|
+
'gettext',
|
15
|
+
['picnic', '>= 0.8.1']
|
16
|
+
] # An array of rubygem dependencies [name, version]
|
17
|
+
|
18
|
+
@config_file = "~/.rubyforge/user-config.yml"
|
19
|
+
@config = nil
|
20
|
+
RUBYFORGE_USERNAME = "unknown"
|
21
|
+
def rubyforge_username
|
22
|
+
unless @config
|
23
|
+
begin
|
24
|
+
@config = YAML.load(File.read(File.expand_path(@config_file)))
|
25
|
+
rescue
|
26
|
+
puts <<-EOS
|
27
|
+
ERROR: No rubyforge config file found: #{@config_file}
|
28
|
+
Run 'rubyforge setup' to prepare your env for access to Rubyforge
|
29
|
+
- See http://newgem.rubyforge.org/rubyforge.html for more details
|
30
|
+
EOS
|
31
|
+
exit
|
32
|
+
end
|
33
|
+
end
|
34
|
+
RUBYFORGE_USERNAME.replace @config["username"]
|
35
|
+
end
|
36
|
+
|
37
|
+
ENV['NODOT'] = '1'
|
38
|
+
|
39
|
+
#REV = nil
|
40
|
+
# UNCOMMENT IF REQUIRED:
|
41
|
+
REV = Time.now.strftime('%Y%m%d%H%M')
|
42
|
+
VERS = CASServer::VERSION::STRING + (REV ? ".#{REV}" : "")
|
43
|
+
RDOC_OPTS = ['--quiet', '--title', 'rubycas-server documentation',
|
44
|
+
"--opname", "index.html",
|
45
|
+
"--line-numbers",
|
46
|
+
"--main", "README",
|
47
|
+
"--inline-source"]
|
48
|
+
|
49
|
+
class Hoe
|
50
|
+
def extra_deps
|
51
|
+
@extra_deps.reject! { |x| Array(x).first == 'hoe' }
|
52
|
+
@extra_deps
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
# Generate all the Rake tasks
|
57
|
+
# Run 'rake -T' to see list of generated tasks (from gem root directory)
|
58
|
+
$hoe = Hoe.new(GEM_NAME, VERS) do |p|
|
59
|
+
p.developer(AUTHOR, EMAIL)
|
60
|
+
p.description = DESCRIPTION
|
61
|
+
p.summary = DESCRIPTION
|
62
|
+
p.url = HOMEPATH
|
63
|
+
p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
|
64
|
+
p.test_globs = ["test/**/test_*.rb"]
|
65
|
+
p.clean_globs |= ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store'] #An array of file patterns to delete on clean.
|
66
|
+
|
67
|
+
# == Optional
|
68
|
+
p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
|
69
|
+
p.extra_deps = EXTRA_DEPENDENCIES
|
70
|
+
|
71
|
+
p.spec_extras = {:executables => ['rubycas-server', 'rubycas-server-ctl']} # A hash of extra values to set in the gemspec.
|
72
|
+
end
|
73
|
+
|
74
|
+
CHANGES = $hoe.paragraphs_of('History.txt', 0..1).join("\\n\\n")
|
75
|
+
PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}"
|
76
|
+
$hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
|
77
|
+
$hoe.rsync_args = '-av --delete --ignore-errors'
|
78
|
+
$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
ADDED
@@ -0,0 +1,544 @@
|
|
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 exampe 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 separate from cert
|
36
|
+
|
37
|
+
#ssl_key: /path/to/your/private_key.pem
|
38
|
+
|
39
|
+
|
40
|
+
# By default the login page will be available at the root path
|
41
|
+
# (e.g. https://login.example.net/). The uri_path option lets you serve it from a
|
42
|
+
# different path (e.g. https://login.example.net/cas).
|
43
|
+
|
44
|
+
#uri_path: /cas
|
45
|
+
|
46
|
+
|
47
|
+
# This lets you bind the server to a specific address. Use 0.0.0.0 to listen on
|
48
|
+
# all available interfaces (this is the default).
|
49
|
+
|
50
|
+
#bind_address: 0.0.0.0
|
51
|
+
|
52
|
+
|
53
|
+
###
|
54
|
+
### Mongrel example
|
55
|
+
###
|
56
|
+
# Mongrel is much faster than WEBrick, but there are two caveats:
|
57
|
+
# 1. Since Mongrel can't serve out encrypted HTTP on its own (and CAS requires this),
|
58
|
+
# you will have to set up a reverse proxy like Pound or Apache's mod_proxy and
|
59
|
+
# route through it requests to the Mongrel server. So for example,
|
60
|
+
# your Pound server will receive all of the requests to RubyCAS-Server on port 443,
|
61
|
+
# and forward them to the Mongrel server listening on port 11011.
|
62
|
+
# 2. Some of Mongrel's components are compiled into native binaries, so if you are
|
63
|
+
# installing on Linux, make sure you have all of the standard build tools
|
64
|
+
# available. The binaries should be automatically compiled for you when you
|
65
|
+
# install the mogrel gem (if you're runnings Windows, pre-compiled
|
66
|
+
# binaries will be downloaded and installed, so don't worry about this).
|
67
|
+
|
68
|
+
#server: mongrel
|
69
|
+
#port: 110011
|
70
|
+
|
71
|
+
|
72
|
+
# Bind the server to a specific address. Use 0.0.0.0 to listen on all
|
73
|
+
# available interfaces (this is the default).
|
74
|
+
|
75
|
+
#bind_address: 0.0.0.0
|
76
|
+
|
77
|
+
### Reverse proxy configuration examples
|
78
|
+
# If you're using mod_proxy, your Apache vhost config should look something like this:
|
79
|
+
#
|
80
|
+
# Listen 443
|
81
|
+
# <VirtualHost *:443>
|
82
|
+
# ServerAdmin admin@example.net
|
83
|
+
# ServerName login.example.net
|
84
|
+
#
|
85
|
+
# SSLEngine On
|
86
|
+
# SSLCertificateFile /etc/apache2/ssl.crt/example.pem
|
87
|
+
#
|
88
|
+
# # Don't do forward proxying, we only want reverse proxying
|
89
|
+
# ProxyRequests Off
|
90
|
+
#
|
91
|
+
# <Proxy balancer://rubycas>
|
92
|
+
# Order allow,deny
|
93
|
+
# Allow from all
|
94
|
+
# BalancerMember http://127.0.0.1:11011
|
95
|
+
# </Proxy>
|
96
|
+
# </VirtualHost>
|
97
|
+
#
|
98
|
+
# For Pound, the config should be something like:
|
99
|
+
#
|
100
|
+
# ListenHTTPS
|
101
|
+
# Address 0.0.0.0
|
102
|
+
# Port 11011
|
103
|
+
# Cert "/etc/ssl/example.pem"
|
104
|
+
#
|
105
|
+
# Service
|
106
|
+
# BackEnd
|
107
|
+
# Address localhost
|
108
|
+
# Port 443
|
109
|
+
# End
|
110
|
+
# End
|
111
|
+
# End
|
112
|
+
|
113
|
+
|
114
|
+
###
|
115
|
+
### Phusion Passenger (running under Apache configured for SSL)
|
116
|
+
###
|
117
|
+
|
118
|
+
# No additional configuration is requried to run RubyCAS-Server under
|
119
|
+
# passsenger. Just follow the normal instructions for a Passenger app
|
120
|
+
# (see http://www.modrails.com/).
|
121
|
+
#
|
122
|
+
# Here's an example Apache vhost config for RubyCAS-Server and Passenger:
|
123
|
+
#
|
124
|
+
# Listen 442
|
125
|
+
# <VirtualHost *:442>
|
126
|
+
# ServerAdmin admin@example.net
|
127
|
+
# ServerName login.example.net
|
128
|
+
#
|
129
|
+
# SSLEngine On
|
130
|
+
# SSLCertificateFile /etc/apache2/ssl.crt/example.pem
|
131
|
+
#
|
132
|
+
# RailsAutoDetect off
|
133
|
+
#
|
134
|
+
# DocumentRoot /usr/lib/ruby/gems/1.8/gems/rubycas-server-0.8.0/public
|
135
|
+
#
|
136
|
+
# <Directory "/usr/lib/ruby/gems/1.8/gems/rubycas-server-0.8.0/public">
|
137
|
+
# AllowOverride all
|
138
|
+
# Allow from all
|
139
|
+
# </Directory>
|
140
|
+
# </VirtualHost>
|
141
|
+
#
|
142
|
+
|
143
|
+
|
144
|
+
##### DATABASE #################################################################
|
145
|
+
|
146
|
+
# Set up the database connection. Make sure that this database is secure!
|
147
|
+
#
|
148
|
+
# By default, we use MySQL, since it is widely used and does not require any
|
149
|
+
# additional
|
150
|
+
# ruby libraries besides ActiveRecord.
|
151
|
+
#
|
152
|
+
# With MySQL, your config would be something like the following:
|
153
|
+
# (be sure to create the casserver database in MySQL beforehand,
|
154
|
+
# i.e. `mysqladmin -u root create casserver`)
|
155
|
+
|
156
|
+
database:
|
157
|
+
adapter: mysql
|
158
|
+
database: casserver
|
159
|
+
username: root
|
160
|
+
password:
|
161
|
+
host: localhost
|
162
|
+
|
163
|
+
|
164
|
+
#
|
165
|
+
# Instead of MySQL you can use SQLite3, PostgreSQL, MSSQL, or anything else
|
166
|
+
# supported by ActiveRecord.
|
167
|
+
#
|
168
|
+
# With SQLite3 (which does not require a separate database server), your
|
169
|
+
# configuration would look something like the following (don't forget to install
|
170
|
+
# the sqlite3-ruby gem beforehand!):
|
171
|
+
|
172
|
+
#database:
|
173
|
+
# adapter: sqlite3
|
174
|
+
# dbfile: /var/lib/casserver.db
|
175
|
+
|
176
|
+
|
177
|
+
##### AUTHENTICATION ###########################################################
|
178
|
+
|
179
|
+
# Configure how username/passwords are validated.
|
180
|
+
#
|
181
|
+
# !!! YOU MUST CONFIGURE AT LEAST ONE OF THESE AUTHENTICATION METHODS !!!
|
182
|
+
#
|
183
|
+
# There are several built-in methods for authentication:
|
184
|
+
# SQL, ActiveDirectory, LDAP, and GoogleAccounts. If none of these work for you,
|
185
|
+
# it is relatively easy to write your own custom Authenticator class (see below).
|
186
|
+
#
|
187
|
+
# === SQL Authentication =======================================================
|
188
|
+
#
|
189
|
+
# The simplest method is to validate against a SQL database. This assumes
|
190
|
+
# that all of your users are stored in a table that has a 'username' column
|
191
|
+
# and a 'password' column. When the user logs in, CAS connects to this database
|
192
|
+
# and looks for a matching username/password in the users table. If a matching
|
193
|
+
# username and password is found, authentication is successful.
|
194
|
+
#
|
195
|
+
# If you prefer to have your passwords stored in an encrypted form, have a
|
196
|
+
# look at the SQLEncrypted authenticator:
|
197
|
+
# http://code.google.com/p/rubycas-server/wiki/UsingTheSQLEncryptedAuthenticator
|
198
|
+
#
|
199
|
+
# If your users table stores passwords with MD5 hashing (for example as with
|
200
|
+
# Drupal) try using the SQLMd5 version of the SQL authenticator.
|
201
|
+
#
|
202
|
+
# Example:
|
203
|
+
#
|
204
|
+
#authenticator:
|
205
|
+
# class: CASServer::Authenticators::SQL
|
206
|
+
# database:
|
207
|
+
# adapter: mysql
|
208
|
+
# database: some_database_with_users_table
|
209
|
+
# username: root
|
210
|
+
# password:
|
211
|
+
# host: localhost
|
212
|
+
# user_table: users
|
213
|
+
# username_column: username
|
214
|
+
# password_column: password
|
215
|
+
#
|
216
|
+
# When replying to a CAS client's validation request, the server will normally
|
217
|
+
# provide the client with the authenticated user's username. However it is
|
218
|
+
# possible for the server to provide the client with additional attributes.
|
219
|
+
# You can configure the SQL authenticator to provide data from additional
|
220
|
+
# columns in the users table by listing the names of the columns under the
|
221
|
+
# 'extra_attributes' option. Note though that this functionality is experimental.
|
222
|
+
# It should work with RubyCAS-Client, but may or may not work with other CAS
|
223
|
+
# clients.
|
224
|
+
#
|
225
|
+
# For example, with this configuration, the 'full_name' and 'access_level'
|
226
|
+
# columns will be provided to your CAS clients along with the username:
|
227
|
+
#
|
228
|
+
#authenticator:
|
229
|
+
# class: CASServer::Authenticators::SQL
|
230
|
+
# database:
|
231
|
+
# adapter: mysql
|
232
|
+
# database: some_database_with_users_table
|
233
|
+
# user_table: users
|
234
|
+
# username_column: username
|
235
|
+
# password_column: password
|
236
|
+
# extra_attributes: full_name, access_level
|
237
|
+
#
|
238
|
+
#
|
239
|
+
# === Google Authentication ====================================================
|
240
|
+
#
|
241
|
+
# The Google authenticator allows users to log in to your CAS server using
|
242
|
+
# their Google account credentials (i.e. the same email and password they
|
243
|
+
# would use to log in to Google services like Gmail). This authenticator
|
244
|
+
# requires no special configuration -- just specify its class name:
|
245
|
+
#
|
246
|
+
#authenticator:
|
247
|
+
# class: CASServer::Authenticators::Google
|
248
|
+
#
|
249
|
+
# Note that as with all authenticators, it is possible to use the Google
|
250
|
+
# authenticator alongside other authenticators. For example, CAS can first
|
251
|
+
# attempt to validate the account with Google, and if that fails, fall back
|
252
|
+
# to some other local authentication mechanism.
|
253
|
+
#
|
254
|
+
# For example:
|
255
|
+
#
|
256
|
+
#authenticator:
|
257
|
+
# - class: CASServer::Authenticators::Google
|
258
|
+
# - class: CASServer::Authenticators::SQL
|
259
|
+
# database:
|
260
|
+
# adapter: mysql
|
261
|
+
# database: some_database_with_users_table
|
262
|
+
# user: root
|
263
|
+
# password:
|
264
|
+
# host: localhost
|
265
|
+
# user_table: user
|
266
|
+
# username_column: username
|
267
|
+
# password_column: password
|
268
|
+
#
|
269
|
+
#
|
270
|
+
# === ActiveDirectory Authentication ===========================================
|
271
|
+
#
|
272
|
+
# This method authenticates against Microsoft's Active Directory using LDAP.
|
273
|
+
# You must configure the ActiveDirectory server, and base DN. The port number
|
274
|
+
# and LDAP filter are optional. You must also enter a CN and password
|
275
|
+
# for a special "authenticator" user. This account is used to log in to
|
276
|
+
# the ActiveDirectory server and search LDAP. This does not have to be an
|
277
|
+
# administrative account -- it only has to be able to search for other
|
278
|
+
# users.
|
279
|
+
#
|
280
|
+
# Note that the auth_user parameter must be the user's CN (Common Name).
|
281
|
+
# In Active Directory, the CN is genarally the user's full name, which is usually
|
282
|
+
# NOT the same as their username (sAMAccountName).
|
283
|
+
#
|
284
|
+
# For example:
|
285
|
+
#
|
286
|
+
#authenticator:
|
287
|
+
# class: CASServer::Authenticators::ActiveDirectoryLDAP
|
288
|
+
# ldap:
|
289
|
+
# host: ad.example.net
|
290
|
+
# port: 389
|
291
|
+
# base: dc=example,dc=net
|
292
|
+
# filter: (objectClass=person)
|
293
|
+
# auth_user: authenticator
|
294
|
+
# auth_password: itsasecret
|
295
|
+
#
|
296
|
+
# A more complicated example, where the authenticator will use TLS encryption,
|
297
|
+
# will ignore users with disabled accounts, and will pass on the 'cn' and 'mail'
|
298
|
+
# attributes to CAS clients:
|
299
|
+
#
|
300
|
+
#authenticator:
|
301
|
+
# class: CASServer::Authenticators::ActiveDirectoryLDAP
|
302
|
+
# ldap:
|
303
|
+
# host: ad.example.net
|
304
|
+
# port: 636
|
305
|
+
# base: dc=example,dc=net
|
306
|
+
# filter: (objectClass=person) & !(msExchHideFromAddressLists=TRUE)
|
307
|
+
# auth_user: authenticator
|
308
|
+
# auth_password: itsasecret
|
309
|
+
# encryption: simple_tls
|
310
|
+
# extra_attributes: cn, mail
|
311
|
+
#
|
312
|
+
# It is possible to authenticate against Active Directory without the
|
313
|
+
# authenticator user, but this requires that users type in their CN as
|
314
|
+
# the username rather than typing in their sAMAccountName. In other words
|
315
|
+
# users will likely have to authenticate by typing their full name,
|
316
|
+
# rather than their username. If you prefer to do this, then just
|
317
|
+
# omit the auth_user and auth_password values in the above example.
|
318
|
+
#
|
319
|
+
#
|
320
|
+
# === LDAP Authentication ======================================================
|
321
|
+
#
|
322
|
+
# This is a more general version of the ActiveDirectory authenticator.
|
323
|
+
# The configuration is similar, except you don't need an authenticator
|
324
|
+
# username or password. The following example has been reported to work
|
325
|
+
# for a basic OpenLDAP setup.
|
326
|
+
#
|
327
|
+
#authenticator:
|
328
|
+
# class: CASServer::Authenticators::LDAP
|
329
|
+
# ldap:
|
330
|
+
# host: ldap.example.net
|
331
|
+
# port: 389
|
332
|
+
# base: dc=example,dc=net
|
333
|
+
# username_attribute: uid
|
334
|
+
# filter: (objectClass=person)
|
335
|
+
#
|
336
|
+
# If you need more secure connections via TSL, specify the 'encryption'
|
337
|
+
# option and change the port. This example also forces the authenticator
|
338
|
+
# to connect using a special "authenticator" user with the given
|
339
|
+
# username and password (see the ActiveDirectoryLDAP authenticator
|
340
|
+
# explanation above):
|
341
|
+
#
|
342
|
+
#authenticator:
|
343
|
+
# class: CASServer::Authenticators::LDAP
|
344
|
+
# ldap:
|
345
|
+
# host: ldap.example.net
|
346
|
+
# port: 636
|
347
|
+
# base: dc=example,dc=net
|
348
|
+
# filter: (objectClass=person)
|
349
|
+
# encryption: simple_tls
|
350
|
+
# auth_user: cn=admin,dc=example,dc=net
|
351
|
+
# auth_password: secret
|
352
|
+
#
|
353
|
+
# If you need additional data about the user passed to the client (for example,
|
354
|
+
# their 'cn' and 'mail' attributes, you can specify the list of attributes
|
355
|
+
# under the extra_attributes config option:
|
356
|
+
#
|
357
|
+
#authenticator:
|
358
|
+
# class: CASServer::Authenticators::LDAP
|
359
|
+
# ldap:
|
360
|
+
# host: ldap.example.net
|
361
|
+
# port: 389
|
362
|
+
# base: dc=example,dc=net
|
363
|
+
# filter: (objectClass=person)
|
364
|
+
# extra_attributes: cn, mail
|
365
|
+
#
|
366
|
+
# Note that the above functionality is somewhat limited by client compatibility.
|
367
|
+
# See the SQL authenticator notes above for more info.
|
368
|
+
#
|
369
|
+
#
|
370
|
+
# === Custom Authentication ====================================================
|
371
|
+
#
|
372
|
+
# It should be relatively easy to write your own Authenticator class. Have a look
|
373
|
+
# at the built-in authenticators in the casserver/authenticators directory. Your
|
374
|
+
# authenticator should extend the CASServer::Authenticators::Base class and must
|
375
|
+
# implement a validate() method that takes a single hash argument. When the user
|
376
|
+
# submits the login form, the username and password they entered is passed to
|
377
|
+
# validate() as a hash under :username and :password keys. In the future, this
|
378
|
+
# hash might also contain other data such as the domain that the user is logging
|
379
|
+
# in to.
|
380
|
+
#
|
381
|
+
# To use your custom authenticator, specify it's class name and path to the
|
382
|
+
# source file in the authenticator section of the config. Any other parameters
|
383
|
+
# you specify in the authenticator configuration will be passed on to the
|
384
|
+
# authenticator and made availabe in the validate() method as an @options hash.
|
385
|
+
#
|
386
|
+
# Example:
|
387
|
+
#
|
388
|
+
#authenticator:
|
389
|
+
# class: FooModule::MyCustomAuthenticator
|
390
|
+
# source: /path/to/source.rb
|
391
|
+
# option_a: foo
|
392
|
+
# another_option: yeeha
|
393
|
+
#
|
394
|
+
# === Multiple Authenticators ==================================================
|
395
|
+
#
|
396
|
+
# If you need to have more than one source for authentication, such as an LDAP
|
397
|
+
# directory and a database, you can use multiple authenticators by making
|
398
|
+
# :authenticator an array of authenticators.
|
399
|
+
#
|
400
|
+
#authenticator:
|
401
|
+
# -
|
402
|
+
# class: CASServer::Authenticators::ActiveDirectoryLDAP
|
403
|
+
# ldap:
|
404
|
+
# host: ad.example.net
|
405
|
+
# port: 389
|
406
|
+
# base: dc=example,dc=net
|
407
|
+
# filter: (objectClass=person)
|
408
|
+
# -
|
409
|
+
# class: CASServer::Authenticators::SQL
|
410
|
+
# database:
|
411
|
+
# adapter: mysql
|
412
|
+
# database: some_database_with_users_table
|
413
|
+
# user: root
|
414
|
+
# password:
|
415
|
+
# host: localhost
|
416
|
+
# user_table: user
|
417
|
+
# username_column: username
|
418
|
+
# password_column: password
|
419
|
+
#
|
420
|
+
# During authentication, the user credentials will be checked against the first
|
421
|
+
# authenticator and on failure fall through to the second authenticator.
|
422
|
+
#
|
423
|
+
|
424
|
+
|
425
|
+
##### LOOK & FEEL ##############################################################
|
426
|
+
|
427
|
+
# Set the path to the theme directory that determines how your CAS pages look.
|
428
|
+
#
|
429
|
+
# Custom themes are not well supported yet, but will be in the near future. In
|
430
|
+
# the meantime, if you want to create a custom theme, you can create a
|
431
|
+
# subdirectory under the CASServer's themes dir (for example,
|
432
|
+
# '/usr/lib/ruby/1.8/gems/casserver-xxx/public/themes', if you installed CASServer
|
433
|
+
# on Linux as a gem). A theme is basically just a theme.css file that overrides
|
434
|
+
# the themes/cas.css styles along with a collection of image files
|
435
|
+
# like logo.png and bg.png.
|
436
|
+
#
|
437
|
+
# By default, we use the 'simple' theme which you can find in themes/simple.
|
438
|
+
theme: simple
|
439
|
+
|
440
|
+
# The name of your company/organization. This will show up on the login page.
|
441
|
+
organization: CAS
|
442
|
+
|
443
|
+
# A short bit of text that shows up on the login page. You can make this blank
|
444
|
+
# if you prefer to have no extra text shown at the bottom of the login box.
|
445
|
+
infoline: Powered by <a href="http://code.google.com/p/rubycas-server/">RubyCAS-Server</a>
|
446
|
+
|
447
|
+
# Custom views file. Overrides methodes in lib/casserver/views.rb
|
448
|
+
#custom_views_file: /path/to/custom/views.rb
|
449
|
+
|
450
|
+
##### LOCALIZATION (L10N) #######################################################
|
451
|
+
# The server will attempt to detect the user's locale and show text in the
|
452
|
+
# appropriate language based on:
|
453
|
+
#
|
454
|
+
# 1. The 'lang' URL parameter (if any)
|
455
|
+
# 2. The 'lang' cookie (if any)
|
456
|
+
# 3. The HTTP_ACCEPT_LANGUAGE header supplied by the user's browser.
|
457
|
+
# 4. The HTTP_USER_AGENT header supplied by the user's browser.
|
458
|
+
#
|
459
|
+
# If the locale cannot be established based on one of the above checks (in the
|
460
|
+
# shown order), then the below 'default_locale' option will be used.
|
461
|
+
#
|
462
|
+
# The format is the same as standard linux locales (langagecode_COUNTRYCODE):
|
463
|
+
#
|
464
|
+
# ru_RU - Russian, Russia
|
465
|
+
# eo_AQ - Esperanto, Antarctica
|
466
|
+
#
|
467
|
+
# It will also work if you leave out the region (i.e. just "ru" for Russian,
|
468
|
+
# "eo" for Esperanto).
|
469
|
+
#
|
470
|
+
# If you are interested in contributing new translations or have corrections
|
471
|
+
# to the existing translations, see
|
472
|
+
# http://code.google.com/p/rubycas-server/wiki/HowToContribueTranslations
|
473
|
+
#
|
474
|
+
default_locale: en
|
475
|
+
|
476
|
+
##### LOGGING ##################################################################
|
477
|
+
|
478
|
+
# Configure general logging. This log is where you'll want to look in case of
|
479
|
+
# problems.
|
480
|
+
#
|
481
|
+
# You may want to change the file to something like /var/log/casserver.log
|
482
|
+
# Set the level to DEBUG if you want more detailed logging.
|
483
|
+
|
484
|
+
log:
|
485
|
+
file: /var/log/casserver.log
|
486
|
+
level: INFO
|
487
|
+
|
488
|
+
|
489
|
+
# If you want full database logging, uncomment this next section.
|
490
|
+
# Every SQL query will be logged here. This is useful for debugging database
|
491
|
+
# problems.
|
492
|
+
#
|
493
|
+
#db_log:
|
494
|
+
# file: /var/log/casserver_db.log
|
495
|
+
|
496
|
+
|
497
|
+
##### SINGLE SIGN-OUT ##########################################################
|
498
|
+
|
499
|
+
# When a user logs in to a CAS-enabled client application, that application
|
500
|
+
# generally opens its own local user session. When the user then logs out
|
501
|
+
# through the CAS server, each of the CAS-enabled client applications need
|
502
|
+
# to be notified so that they can close their own local sessions for that user.
|
503
|
+
#
|
504
|
+
# Up until recently this was not possible within CAS. However, a method for
|
505
|
+
# performing this notification was recently added to the protocol (in CAS 3.1).
|
506
|
+
# This works exactly as described above -- when the user logs out, the CAS
|
507
|
+
# server individually contacts each client service and notifies it of the
|
508
|
+
# logout. Currently not all client applications support this, so this
|
509
|
+
# behaviour is disabled by default. To enable it, uncomment the following
|
510
|
+
# configuration line. Note that currently it is not possible to enable
|
511
|
+
# or disable single-sign-out on a per-service basis, but this functionality
|
512
|
+
# is planned for a future release.
|
513
|
+
|
514
|
+
#enable_single_sign_out: true
|
515
|
+
|
516
|
+
|
517
|
+
##### OTHER ####################################################################
|
518
|
+
|
519
|
+
# You can set various ticket expiry times (specify the value in seconds).
|
520
|
+
|
521
|
+
# Unused login and service tickets become unusable this many seconds after
|
522
|
+
# they are created. (Defaults to 5 minutes)
|
523
|
+
|
524
|
+
#maximum_unused_login_ticket_lifetime: 300
|
525
|
+
#maximum_unused_service_ticket_lifetime: 300
|
526
|
+
|
527
|
+
# The server must periodically delete old tickets (login tickets, service tickets
|
528
|
+
# proxy-granting tickets, and ticket-granting tickets) to prevent buildup of
|
529
|
+
# stale data. This effectively limits the maximum length of a CAS session to
|
530
|
+
# the lifetime given here (in seconds). (Defaults to 48 hours)
|
531
|
+
#
|
532
|
+
# Note that this limit is not enforced on the client side; it refers only to the
|
533
|
+
# the maximum lifetime of tickets on the CAS server.
|
534
|
+
|
535
|
+
#maximum_session_lifetime: 172800
|
536
|
+
|
537
|
+
|
538
|
+
# If you want the usernames entered on the login page to be automatically
|
539
|
+
# downcased (converted to lowercase), enable the following option. When this
|
540
|
+
# option is set to true, if the user enters "JSmith" as their username, the
|
541
|
+
# system will automatically
|
542
|
+
# convert this to "jsmith".
|
543
|
+
|
544
|
+
#downcase_username: true
|
data/config.ru
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# This is the Rackup initialization script for running RubyCAS-Server under Passenger/Rack.
|
2
|
+
#
|
3
|
+
# This file doesn't really have anything to do with your server's "configuration",
|
4
|
+
# and you almost certainly don't need to modify it. Instead, a config file should
|
5
|
+
# have been created for you (probably under /etc/rubycas-server/config.yml) -- this
|
6
|
+
# is the file you'll want to modify. If for some reason the configuration file
|
7
|
+
# was not created for you, have a look at the config.example.yml template and
|
8
|
+
# go from there.
|
9
|
+
|
10
|
+
require 'rubygems'
|
11
|
+
require 'rack'
|
12
|
+
|
13
|
+
$APP_NAME = 'rubycas-server'
|
14
|
+
$APP_ROOT = File.dirname(File.expand_path(__FILE__))
|
15
|
+
|
16
|
+
if File.exists?("#{$APP_ROOT}/tmp/debug.txt")
|
17
|
+
require 'ruby-debug'
|
18
|
+
Debugger.wait_connection = true
|
19
|
+
Debugger.start_remote
|
20
|
+
end
|
21
|
+
|
22
|
+
$: << $APP_ROOT + "/lib"
|
23
|
+
|
24
|
+
require 'casserver/load_picnic'
|
25
|
+
require 'picnic'
|
26
|
+
require 'casserver'
|
27
|
+
|
28
|
+
CASServer.create
|
29
|
+
|
30
|
+
if $CONF.uri_path
|
31
|
+
map($CONF.uri_path) do
|
32
|
+
# FIXME: this probably isn't the smartest way of remapping the themes dir to uri_path/themes
|
33
|
+
use Rack::Static, $CONF[:static] if $CONF[:static]
|
34
|
+
run CASServer
|
35
|
+
end
|
36
|
+
else
|
37
|
+
run CASServer
|
38
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# Custom views file; add methods to the module definition below
|
2
|
+
|
3
|
+
module CASServer::Views
|
4
|
+
|
5
|
+
# Override views here, for example, a custom login form:
|
6
|
+
def login_form
|
7
|
+
# Add your custom login form here, using Markaby
|
8
|
+
# See the original views.rb file at lib/casserver/views.rb for method names and usage
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'casserver/authenticators/ldap'
|
2
|
+
|
3
|
+
# Slightly modified version of the LDAP authenticator for Microsoft's ActiveDirectory.
|
4
|
+
# The only difference is that the default_username_attribute for AD is 'sAMAccountName'
|
5
|
+
# rather than 'uid'.
|
6
|
+
class CASServer::Authenticators::ActiveDirectoryLDAP < CASServer::Authenticators::LDAP
|
7
|
+
protected
|
8
|
+
def default_username_attribute
|
9
|
+
"sAMAccountName"
|
10
|
+
end
|
11
|
+
end
|