Module: CASServer::Utils

Defined in:
lib/casserver/utils.rb

Class Method Summary collapse

Class Method Details

.log_controller_action(controller, params) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/casserver/utils.rb', line 16

def log_controller_action(controller, params)
  $LOG << "\n"

  /`(.*)'/.match(caller[1])
  method = $~[1]

  if params.respond_to? :dup
    params2 = params.dup
    params2['password'] = '******' if params2['password']
  else
    params2 = params
  end
  $LOG.debug("Processing #{controller}::#{method} #{params2.inspect}")
end

.random_string(max_length = 29) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/casserver/utils.rb', line 6

def random_string(max_length = 29)
  rg =  Crypt::ISAAC.new
  max = 4294619050
  r = "#{Time.now.to_i}r%X%X%X%X%X%X%X%X" %
    [rg.rand(max), rg.rand(max), rg.rand(max), rg.rand(max),
     rg.rand(max), rg.rand(max), rg.rand(max), rg.rand(max)]
  r[0..max_length-1]
end