gunark-rubycas-server 0.6.99.336 → 0.7.999.20090212

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.
@@ -1,112 +1,77 @@
1
- # load configuration
2
1
 
3
- begin
4
- if $CONFIG_FILE
5
- conf_file = $CONFIG_FILE
6
- else
7
- conf_file = etc_conf = "/etc/rubycas-server/config.yml"
8
- unless File.exists? conf_file
9
- # can use local config.yml file in case we're running non-gem installation
10
- conf_file = File.dirname(File.expand_path(__FILE__))+"/../../config.yml"
11
- end
12
- end
2
+ conf_defaults = {
3
+ :expire_sessions => false,
4
+ :login_ticket_expiry => 5.minutes,
5
+ :service_ticket_expiry => 5.minutes, # CAS Protocol Spec, sec. 3.2.1 (recommended expiry time)
6
+ :proxy_granting_ticket_expiry => 48.hours,
7
+ :ticket_granting_ticket_expiry => 48.hours,
8
+ :log => {:file => 'casserver.log', :level => 'DEBUG'},
9
+ :uri_path => "/"
10
+ }
13
11
 
14
- unless File.exists? conf_file
15
- require 'fileutils'
16
-
17
- example_conf_file = File.expand_path(File.dirname(File.expand_path(__FILE__))+"/../../config.example.yml")
18
- puts "\nCAS SERVER NOT YET CONFIGURED!!!\n"
19
- puts "\nAttempting to copy sample configuration from '#{example_conf_file}' to '#{etc_conf}'...\n"
20
-
21
- begin
22
- FileUtils.mkdir("/etc/rubycas-server") unless File.exists? "/etc/rubycas-server"
23
- FileUtils.cp(example_conf_file, etc_conf)
24
- rescue Errno::EACCES
25
- puts "\nIt appears that you do not have permissions to create the '#{etc_conf}' file. Try running this command using sudo (as root).\n"
26
- exit 2
27
- rescue
28
- puts "\nFor some reason the '#{etc_conf}' file could not be created. You'll have to copy the file manually." +
29
- " Use '#{example_conf_file}' as a template.\n"
30
- exit 2
31
- end
32
-
33
- puts "\nA sample configuration has been created for you in '#{etc_conf}'. Please edit this file to" +
34
- " suit your needs and then run rubycas-server again.\n"
35
- exit 1
12
+ if $CONF
13
+ $CONF.merge_defaults(conf_defaults)
14
+ else
15
+ unless $APP_NAME && $APP_ROOT
16
+ raise "Can't load the RubyCAS-Server configuration because $APP_NAME and/or $APP_ROOT are not defined."
36
17
  end
37
-
38
- loaded_conf = HashWithIndifferentAccess.new(YAML.load_file(conf_file))
39
-
40
- if $CONF
41
- $CONF = loaded_conf.merge $CONF
18
+
19
+ require 'picnic/conf'
20
+ $CONF = Picnic::Conf.new(conf_defaults)
21
+ $CONF.load_from_file($APP_NAME, $APP_ROOT)
22
+ end
23
+
24
+ $AUTH = []
25
+ begin
26
+ # attempt to instantiate the authenticator
27
+ if $CONF[:authenticator].instance_of? Array
28
+ $CONF[:authenticator].each { |authenticator| $AUTH << authenticator[:class].constantize.new}
42
29
  else
43
- $CONF = loaded_conf
30
+ $AUTH << $CONF[:authenticator][:class].constantize.new
44
31
  end
45
-
32
+ rescue NameError
46
33
  if $CONF[:authenticator].instance_of? Array
47
- $CONF[:authenticator].each_index { |auth_index| $CONF[:authenticator][auth_index] = HashWithIndifferentAccess.new($CONF[:authenticator][auth_index])}
48
- end
49
-
50
- $AUTH = []
51
- begin
52
- # attempt to instantiate the authenticator
53
- if $CONF[:authenticator].instance_of? Array
54
- $CONF[:authenticator].each { |authenticator| $AUTH << authenticator[:class].constantize.new}
55
- else
56
- $AUTH << $CONF[:authenticator][:class].constantize.new
57
- end
58
- rescue NameError
59
- if $CONF[:authenticator].instance_of? Array
60
- $CONF[:authenticator].each do |authenticator|
61
- if !authenticator[:source].nil?
62
- # config.yml explicitly names source file
63
- require authenticator[:source]
64
- else
65
- # the authenticator class hasn't yet been loaded, so lets try to load it from the casserver/authenticators directory
66
- auth_rb = authenticator[:class].underscore.gsub('cas_server/', '')
67
- require 'casserver/'+auth_rb
68
- end
69
- $AUTH << authenticator[:class].constantize.new
70
- end
71
- else
72
- if !$CONF[:authenticator][:source].nil?
34
+ $CONF[:authenticator].each do |authenticator|
35
+ if !authenticator[:source].nil?
73
36
  # config.yml explicitly names source file
74
- require $CONF[:authenticator][:source]
37
+ require authenticator[:source]
75
38
  else
76
39
  # the authenticator class hasn't yet been loaded, so lets try to load it from the casserver/authenticators directory
77
- auth_rb = $CONF[:authenticator][:class].underscore.gsub('cas_server/', '')
40
+ auth_rb = authenticator[:class].underscore.gsub('cas_server/', '')
78
41
  require 'casserver/'+auth_rb
79
42
  end
80
-
81
- $AUTH << $CONF[:authenticator][:class].constantize.new
43
+ $AUTH << authenticator[:class].constantize.new
82
44
  end
45
+ else
46
+ if $CONF[:authenticator][:source]
47
+ # config.yml explicitly names source file
48
+ require $CONF[:authenticator][:source]
49
+ else
50
+ # the authenticator class hasn't yet been loaded, so lets try to load it from the casserver/authenticators directory
51
+ auth_rb = $CONF[:authenticator][:class].underscore.gsub('cas_server/', '')
52
+ require 'casserver/'+auth_rb
53
+ end
54
+
55
+ $AUTH << $CONF[:authenticator][:class].constantize.new
83
56
  end
84
- rescue
85
- raise "Your RubyCAS-Server configuration may be invalid."+
86
- " Please double-check check your config.yml file."+
87
- " Make sure that you are using spaces instead of tabs for your indentation!!" +
88
- "\n\nUNDERLYING EXCEPTION:\n#{$!}"
89
57
  end
90
58
 
91
- module CASServer
92
- module Conf
93
- DEFAULTS = {
94
- :expire_sessions => false,
95
- :login_ticket_expiry => 5.minutes,
96
- :service_ticket_expiry => 5.minutes, # CAS Protocol Spec, sec. 3.2.1 (recommended expiry time)
97
- :proxy_granting_ticket_expiry => 48.hours,
98
- :ticket_granting_ticket_expiry => 48.hours,
99
- :log => {:file => 'casserver.log', :level => 'DEBUG'},
100
- :uri_path => "/"
101
- }
102
-
103
- def [](key)
104
- $CONF[key] || DEFAULTS[key]
105
- end
106
- module_function "[]".intern
107
-
108
- def self.method_missing(method, *args)
109
- self[method]
110
- end
111
- end
59
+ unless $CONF[:authenticator]
60
+ $stderr.puts
61
+ $stderr.puts "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
62
+ $stderr.puts
63
+ $stderr.puts "You have not yet defined an authenticator for your CAS server!"
64
+ $stderr.puts "Please consult your config file for details (most likely in"
65
+ $stderr.puts "/etc/rubycas-server/config.yml)."
66
+ $stderr.puts
67
+ $stderr.puts "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
68
+ exit 1
112
69
  end
70
+
71
+
72
+ $CONF[:public_dir] = {
73
+ :path => "/themes",
74
+ :dir => File.expand_path(File.dirname(__FILE__))+"/themes"
75
+ }
76
+
77
+
@@ -1,12 +1,14 @@
1
1
  # The #.#.# comments (e.g. "2.1.3") refer to section numbers in the CAS protocol spec
2
2
  # under http://www.ja-sig.org/products/cas/overview/protocol/index.html
3
3
 
4
+ require 'casserver/cas'
5
+
4
6
  module CASServer::Controllers
5
7
 
6
8
  # 2.1
7
9
  class Login < R '/', '/login'
8
10
  include CASServer::CAS
9
-
11
+
10
12
  # 2.1.1
11
13
  def get
12
14
  CASServer::Utils::log_controller_action(self.class, @input)
@@ -27,12 +29,12 @@ module CASServer::Controllers
27
29
 
28
30
  if tgt and !tgt_error
29
31
  @message = {:type => 'notice',
30
- :message => %{You are currently logged in as "#{tgt.username}". If this is not you, please log in below.}}
32
+ :message => _("You are currently logged in as '%s'. If this is not you, please log in below.") % tgt.username }
31
33
  end
32
34
 
33
35
  if @input['redirection_loop_intercepted']
34
36
  @message = {:type => 'mistake',
35
- :message => %{The client and server are unable to negotiate authentication. Please try logging in again later.}}
37
+ :message => _("The client and server are unable to negotiate authentication. Please try logging in again later.")}
36
38
  end
37
39
 
38
40
  begin
@@ -49,12 +51,12 @@ module CASServer::Controllers
49
51
  elsif @gateway
50
52
  $LOG.error("This is a gateway request but no service parameter was given!")
51
53
  @message = {:type => 'mistake',
52
- :message => "The server cannot fulfill this gateway request because no service parameter was given."}
54
+ :message => _("The server cannot fulfill this gateway request because no service parameter was given.")}
53
55
  end
54
56
  rescue URI::InvalidURIError
55
57
  $LOG.error("The service '#{@service}' is not a valid URI!")
56
58
  @message = {:type => 'mistake',
57
- :message => "The target service your browser supplied appears to be invalid. Please contact your system administrator for help."}
59
+ :message => _("The target service your browser supplied appears to be invalid. Please contact your system administrator for help.")}
58
60
  end
59
61
 
60
62
  lt = generate_login_ticket
@@ -71,8 +73,8 @@ module CASServer::Controllers
71
73
  # The optional 'submitToURI' parameter can be given to explicitly set the
72
74
  # action for the form, otherwise the server will try to guess this for you.
73
75
  if @input.has_key? 'onlyLoginForm'
74
- if env['HTTP_HOST']
75
- guessed_login_uri = "http#{env['HTTPS'] && env['HTTPS'] == 'on' ? 's' : ''}://#{env['REQUEST_URI']}#{self / '/login'}"
76
+ if @env['HTTP_HOST']
77
+ guessed_login_uri = "http#{@env['HTTPS'] && @env['HTTPS'] == 'on' ? 's' : ''}://#{@env['REQUEST_URI']}#{self / '/login'}"
76
78
  else
77
79
  guessed_login_uri = nil
78
80
  end
@@ -83,7 +85,7 @@ module CASServer::Controllers
83
85
  render :login_form
84
86
  else
85
87
  @status = 500
86
- "Could not guess the CAS login URI. Please supply a submitToURI parameter with your request."
88
+ _("Could not guess the CAS login URI. Please supply a submitToURI parameter with your request.")
87
89
  end
88
90
  else
89
91
  render :login
@@ -122,9 +124,9 @@ module CASServer::Controllers
122
124
  @lt = generate_login_ticket.ticket
123
125
 
124
126
  if $CONF[:authenticator].instance_of? Array
125
- $AUTH.each_index {|auth_index| $AUTH[auth_index].configure(CASServer::Conf.authenticator[auth_index])}
127
+ $AUTH.each_index {|auth_index| $AUTH[auth_index].configure($CONF.authenticator[auth_index])}
126
128
  else
127
- $AUTH[0].configure(CASServer::Conf.authenticator)
129
+ $AUTH[0].configure($CONF.authenticator)
128
130
  end
129
131
 
130
132
  $LOG.debug("Logging in with username: #{@username}, lt: #{@lt}, service: #{@service}, auth: #{$AUTH}")
@@ -138,7 +140,7 @@ module CASServer::Controllers
138
140
  :username => @username,
139
141
  :password => @password,
140
142
  :service => @service,
141
- :request => env
143
+ :request => @env
142
144
  )
143
145
  if credentials_are_valid
144
146
  extra_attributes.merge!(auth.extra_attributes) unless auth.extra_attributes.blank?
@@ -159,17 +161,17 @@ module CASServer::Controllers
159
161
  # 3.6 (ticket-granting cookie)
160
162
  tgt = generate_ticket_granting_ticket(@username, extra_attributes)
161
163
 
162
- if CASServer::Conf.expire_sessions
163
- expires = CASServer::Conf.ticket_granting_ticket_expiry.to_i.from_now
164
+ if $CONF.expire_sessions
165
+ expires = $CONF.ticket_granting_ticket_expiry.to_i.from_now
164
166
  expiry_info = " It will expire on #{expires}."
165
167
  else
166
168
  expiry_info = " It will not expire."
167
169
  end
168
170
 
169
- if CASServer::Conf.expire_sessions
171
+ if $CONF.expire_sessions
170
172
  @cookies[:tgt] = {
171
173
  :value => tgt.to_s,
172
- :expires => Time.now + CASServer::Conf.ticket_granting_ticket_expiry
174
+ :expires => Time.now + $CONF.ticket_granting_ticket_expiry
173
175
  }
174
176
  else
175
177
  @cookies[:tgt] = tgt.to_s
@@ -179,7 +181,7 @@ module CASServer::Controllers
179
181
 
180
182
  if @service.blank?
181
183
  $LOG.info("Successfully authenticated user '#{@username}' at '#{tgt.client_hostname}'. No service param was given, so we will not redirect.")
182
- @message = {:type => 'confirmation', :message => "You have successfully logged in."}
184
+ @message = {:type => 'confirmation', :message => _("You have successfully logged in.")}
183
185
  else
184
186
  @st = generate_service_ticket(@service, @username, tgt)
185
187
  begin
@@ -189,12 +191,13 @@ module CASServer::Controllers
189
191
  return redirect(service_with_ticket, :status => 303) # response code 303 means "See Other" (see Appendix B in CAS Protocol spec)
190
192
  rescue URI::InvalidURIError
191
193
  $LOG.error("The service '#{@service}' is not a valid URI!")
192
- @message = {:type => 'mistake', :message => "The target service your browser supplied appears to be invalid. Please contact your system administrator for help."}
194
+ @message = {:type => 'mistake',
195
+ :message => _("The target service your browser supplied appears to be invalid. Please contact your system administrator for help.")}
193
196
  end
194
197
  end
195
198
  else
196
199
  $LOG.warn("Invalid credentials given for user '#{@username}'")
197
- @message = {:type => 'mistake', :message => "Incorrect username or password."}
200
+ @message = {:type => 'mistake', :message => _("Incorrect username or password.")}
198
201
  @status = 401
199
202
  end
200
203
 
@@ -233,18 +236,18 @@ module CASServer::Controllers
233
236
  pgt.destroy
234
237
  end
235
238
 
236
- if CASServer::Conf.enable_single_sign_out
239
+ if $CONF.enable_single_sign_out
237
240
  $LOG.debug("Deleting Service/Proxy Tickets for '#{tgt}' for user '#{tgt.username}'")
238
241
  tgt.service_tickets.each do |st|
239
242
  send_logout_notification_for_service_ticket(st)
240
243
  # TODO: Maybe we should do some special handling if send_logout_notification_for_service_ticket fails?
241
- # Note that the method returns false if the POST results in a non-200 HTTP response.
242
- $LOG.debug "Deleting #{st.class} #{st.ticket.inspect}."
244
+ # (the above method returns false if the POST results in a non-200 HTTP response).
245
+ $LOG.debug "Deleting #{st.class.name.demodulize} #{st.ticket.inspect}."
243
246
  st.destroy
244
247
  end
245
248
  end
246
249
 
247
- $LOG.debug("Deleting Ticket-Granting Ticket '#{tgt}' for user '#{tgt.username}'")
250
+ $LOG.debug("Deleting #{tgt.class.name.demodulize} '#{tgt}' for user '#{tgt.username}'")
248
251
  tgt.destroy
249
252
  end
250
253
 
@@ -253,10 +256,10 @@ module CASServer::Controllers
253
256
  $LOG.warn("User tried to log out without a valid ticket-granting ticket.")
254
257
  end
255
258
 
256
- @message = {:type => 'confirmation', :message => "You have successfully logged out."}
259
+ @message = {:type => 'confirmation', :message => _("You have successfully logged out.")}
257
260
 
258
261
  @message[:message] <<
259
- " Please click on the following link to continue:" if @continue_url
262
+ _(" Please click on the following link to continue:") if @continue_url
260
263
 
261
264
  @lt = generate_login_ticket
262
265
 
@@ -363,7 +366,7 @@ module CASServer::Controllers
363
366
 
364
367
  @extra_attributes = t.ticket_granting_ticket.extra_attributes || {}
365
368
  end
366
- $LOG.error @error
369
+
367
370
  @status = response_status_from_error(@error) if @error
368
371
 
369
372
  render :proxy_validate
@@ -406,7 +409,7 @@ module CASServer::Controllers
406
409
  CASServer::Utils::log_controller_action(self.class, @input)
407
410
  $LOG.error("Tried to use login ticket dispenser with get method!")
408
411
  @status = 422
409
- "To generate a login ticket, you must make a POST request."
412
+ _("To generate a login ticket, you must make a POST request.")
410
413
  end
411
414
 
412
415
  # Renders a page with a login ticket (and only the login ticket)
@@ -415,7 +418,7 @@ module CASServer::Controllers
415
418
  CASServer::Utils::log_controller_action(self.class, @input)
416
419
  lt = generate_login_ticket
417
420
 
418
- $LOG.debug("Dispensing login ticket #{lt} to host #{(env['HTTP_X_FORWARDED_FOR'] || env['REMOTE_HOST'] || env['REMOTE_ADDR']).inspect}")
421
+ $LOG.debug("Dispensing login ticket #{lt} to host #{(@env['HTTP_X_FORWARDED_FOR'] || @env['REMOTE_HOST'] || @env['REMOTE_ADDR']).inspect}")
419
422
 
420
423
  @lt = lt.ticket
421
424
 
@@ -426,13 +429,17 @@ module CASServer::Controllers
426
429
  class Themes < R '/themes/(.+)'
427
430
  MIME_TYPES = {'.css' => 'text/css', '.js' => 'text/javascript',
428
431
  '.jpg' => 'image/jpeg'}
429
- PATH = CASServer::Conf.themes_dir || File.expand_path(File.dirname(__FILE__))+'/../themes'
432
+ PATH = $CONF.themes_dir || File.expand_path(File.dirname(__FILE__))+'/../themes'
430
433
 
431
- def get(path)@headers['Content-Type'] = MIME_TYPES[path[/\.\w+$/, 0]] || "text/plain"
434
+ def get(path)
435
+ headers['Content-Type'] = MIME_TYPES[path[/\.\w+$/, 0]] || "text/plain"
432
436
  unless path.include? ".." # prevent directory traversal attacks
433
- @headers['X-Sendfile'] = "#{PATH}/#{path}"
437
+ headers['X-Sendfile'] = "#{PATH}/#{path}"
438
+ data = File.read(headers['X-Sendfile'])
439
+ headers['Content-Length'] = data.size.to_s # Rack Camping adapter chokes without this
440
+ return data
434
441
  else
435
- @status = "403"
442
+ status = "403"
436
443
  "403 - Invalid path"
437
444
  end
438
445
  end
@@ -1,26 +1,31 @@
1
1
  $: << File.dirname(File.expand_path(__FILE__))
2
2
 
3
3
  # Try to load local version of Picnic if possible (for development purposes)
4
- $: << File.dirname(File.expand_path(__FILE__))+"/../../../picnic/lib"
5
- $: << File.dirname(File.expand_path(__FILE__))+"/../../vendor/picnic/lib"
4
+ alt_picic_paths = []
5
+ alt_picic_paths << File.dirname(File.expand_path(__FILE__))+"/../../../picnic/lib"
6
+ alt_picic_paths << File.dirname(File.expand_path(__FILE__))+"/../../vendor/picnic/lib"
6
7
 
7
8
  begin
9
+ require 'active_record'
10
+ rescue LoadError
11
+ require 'rubygems'
12
+ require 'active_record'
13
+ end
14
+
15
+ if alt_picic_paths.any?{|path| File.exists? "#{path}/picnic.rb" }
16
+ alt_picic_paths.each{|path| $: << path}
8
17
  require 'picnic'
9
- rescue LoadError => e
10
- # make sure that the LoadError was about picnic and not something else
11
- raise e unless e.to_s =~ /picnic/
12
-
18
+ else
13
19
  require 'rubygems'
14
20
 
15
21
  # make things backwards-compatible for rubygems < 0.9.0
16
- unless Object.method_defined? :gem
22
+ if respond_to?(:require_gem)
23
+ puts "WARNING: aliasing gem to require_gem in #{__FILE__} -- you should update your RubyGems system!"
17
24
  alias gem require_gem
18
25
  end
19
-
20
- gem 'picnic'
21
-
26
+
22
27
  require 'picnic'
23
28
  end
24
29
 
25
30
  # used for serializing user extra_attributes (see #service_validate in views.rb)
26
- require 'yaml'
31
+ require 'yaml'
@@ -0,0 +1,62 @@
1
+ require "gettext"
2
+ require "gettext/cgi"
3
+
4
+ module CASServer
5
+ include GetText
6
+ bindtextdomain("rubycas-server", :path => File.join(File.dirname(File.expand_path(__FILE__)), "../locale"))
7
+
8
+ def service(*a)
9
+ GetText.locale = determine_locale
10
+ #puts GetText.locale.inspect
11
+ super(*a)
12
+ end
13
+
14
+ def determine_locale
15
+ lang = ($CONF[:default_locale] || "en")
16
+ lang = @input['lang'] unless @input['lang'].blank?
17
+ lang ||= @cookies['lang'] unless @cookies['lang'].blank?
18
+ lang ||= @env.HTTP_ACCEPT_LANGUAGE unless @env.HTTP_ACCEPT_LANGUAGE.blank?
19
+ lang ||= @env.HTTP_USER_AGENT =~ /[^a-z]([a-z]{2}(-[a-z]{2})?)[^a-z]/i &&
20
+ lang = $~[1] unless @env.HTTP_USER_AGENT.blank?
21
+ @cookies['lang'] = lang
22
+
23
+ lang.gsub!('_','-')
24
+
25
+ # TODO: Need to confirm that this method of splitting the accepted
26
+ # language string is correct.
27
+ if lang =~ /[,;\|]/
28
+ langs = lang.split(/[,;\|]/)
29
+ else
30
+ langs = [lang]
31
+ end
32
+
33
+ # TODO: This method of selecting the desired language might not be
34
+ # standards-compliant. For example, http://www.w3.org/TR/ltli/
35
+ # suggests that de-de and de-*-DE might be acceptable identifiers
36
+ # for selecting various wildcards. The algorithm below does not
37
+ # currently support anything like this.
38
+
39
+ available = available_locales
40
+
41
+ # Try to pick a locale exactly matching the desired identifier, otherwise
42
+ # fall back to locale without region (i.e. given "en-US; de-DE", we would
43
+ # first look for "en-US", then "en", then "de-DE", then "de").
44
+
45
+ chosen_lang = nil
46
+ langs.each do |l|
47
+ a = available.find{|a| a == l || a =~ Regexp.new("#{l}-\w*")}
48
+ if a
49
+ chosen_lang = a
50
+ break
51
+ end
52
+ end
53
+
54
+ chosen_lang = "en" if chosen_lang.blank?
55
+
56
+ return chosen_lang
57
+ end
58
+
59
+ def available_locales
60
+ (Dir.glob(File.join(File.dirname(File.expand_path(__FILE__)), "../locale/[a-z]*")).map{|path| File.basename(path)} << "en").uniq.collect{|l| l.gsub('_','-')}
61
+ end
62
+ end
@@ -1,4 +1,4 @@
1
- require 'camping/db'
1
+ require 'camping/ar'
2
2
 
3
3
  module CASServer::Models
4
4
 
@@ -215,4 +215,4 @@ module CASServer::Models
215
215
  remove_column :casserver_tgt, :extra_attributes
216
216
  end
217
217
  end
218
- end
218
+ end
@@ -9,11 +9,11 @@ module CASServer
9
9
  # TODO: verify the certificate's validity
10
10
  # example of how to do this is here: http://pablotron.org/download/ruri-20050331.rb
11
11
 
12
- cert_path = CASServer::Conf.ssl_cert
13
- key_path = CASServer::Conf.ssl_key || CASServer::Conf.ssl_cert
12
+ cert_path = $CONF.ssl_cert
13
+ key_path = $CONF.ssl_key || $CONF.ssl_cert
14
14
  # look for the key in the ssl_cert if no ssl_key is specified
15
15
 
16
- webrick_options = {:BindAddress => "0.0.0.0", :Port => CASServer::Conf.port}
16
+ webrick_options = {:BindAddress => "0.0.0.0", :Port => $CONF.port}
17
17
 
18
18
  unless cert_path.nil? && key_path.nil?
19
19
  raise "'#{cert_path}' is not a valid ssl certificate. Your 'ssl_cert' configuration" +
@@ -41,9 +41,9 @@ module CASServer
41
41
  end
42
42
 
43
43
  CASServer.create
44
- s.mount "#{CASServer::Conf.uri_path}", WEBrick::CampingHandler, CASServer
44
+ s.mount "#{$CONF.uri_path}", WEBrick::CampingHandler, CASServer
45
45
 
46
- puts "\n** CASServer is running at http#{webrick_options[:SSLEnable] ? 's' : ''}://#{Socket.gethostname}:#{CASServer::Conf.port}#{CASServer::Conf.uri_path} and logging to '#{CASServer::Conf.log[:file]}'\n\n"
46
+ puts "\n** CASServer is running at http#{webrick_options[:SSLEnable] ? 's' : ''}://#{Socket.gethostname}:#{$CONF.port}#{$CONF.uri_path} and logging to '#{$CONF.log[:file]}'\n\n"
47
47
 
48
48
  # This lets Ctrl+C shut down your server
49
49
  trap(:INT) do
@@ -79,19 +79,19 @@ module CASServer
79
79
 
80
80
  CASServer.create
81
81
 
82
- puts "\n** CASServer is starting. Look in '#{CASServer::Conf.log[:file]}' for further notices."
82
+ puts "\n** CASServer is starting. Look in '#{$CONF.log[:file]}' for further notices."
83
83
 
84
- settings = {:host => "0.0.0.0", :log_file => CASServer::Conf.log[:file], :cwd => $CASSERVER_HOME}
84
+ settings = {:host => "0.0.0.0", :log_file => $CONF.log[:file], :cwd => $CASSERVER_HOME}
85
85
 
86
86
  # need to close all IOs before daemonizing
87
87
  $LOG.close if $DAEMONIZE
88
88
 
89
89
  begin
90
90
  config = Mongrel::Configurator.new settings do
91
- daemonize :log_file => CASServer::Conf.log[:file], :cwd => $CASSERVER_HOME if $DAEMONIZE
91
+ daemonize :log_file => $CONF.log[:file], :cwd => $CASSERVER_HOME if $DAEMONIZE
92
92
 
93
- listener :port => CASServer::Conf.port do
94
- uri CASServer::Conf.uri_path, :handler => Mongrel::Camping::CampingHandler.new(CASServer)
93
+ listener :port => $CONF.port do
94
+ uri $CONF.uri_path, :handler => Mongrel::Camping::CampingHandler.new(CASServer)
95
95
  setup_signals
96
96
  end
97
97
  end
@@ -112,7 +112,7 @@ module CASServer
112
112
  end
113
113
  end
114
114
 
115
- puts "\n** CASServer is running at http://localhost:#{CASServer::Conf.port}#{CASServer::Conf.uri_path} and logging to '#{CASServer::Conf.log[:file]}'"
115
+ puts "\n** CASServer is running at http://localhost:#{$CONF.port}#{$CONF.uri_path} and logging to '#{$CONF.log[:file]}'"
116
116
  config.join
117
117
 
118
118
  clear_pid_file
@@ -137,7 +137,7 @@ module CASServer
137
137
 
138
138
  private
139
139
  def check_log_writable
140
- log_file = CASServer::Conf.log['file']
140
+ log_file = $CONF.log['file']
141
141
  begin
142
142
  f = open(log_file, 'w')
143
143
  rescue
@@ -1,8 +1,8 @@
1
1
  module CASServer
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
- MINOR = 6
5
- TINY = 99
4
+ MINOR = 7
5
+ TINY = 999
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end