Sha256: 4793da9c23c91a19db6bacca45f73a78384384b4a6e66407b508c26de02c8158

Contents?: true

Size: 886 Bytes

Versions: 17

Compression:

Stored size: 886 Bytes

Contents

require 'crypt-isaac'

# Misc utility function used throughout by the RubyCAS-Server.
module CASServer
  module Utils
    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
    module_function :random_string

    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
    module_function :log_controller_action
  end
end

Version data entries

17 entries across 17 versions & 5 rubygems

Version Path
ror-rubycas-server-1.0.c lib/casserver/utils.rb
ror-rubycas-server-1.0.b lib/casserver/utils.rb
ror-rubycas-server-1.0.a lib/casserver/utils.rb
rubycas-server-1.1.2 lib/casserver/utils.rb
rubycas-server-1.1.1 lib/casserver/utils.rb
synapses-cas-0.1.1 lib/casserver/utils.rb
synapses-cas-0.1.0 lib/casserver/utils.rb
bmedia-casserver-1.1.3 lib/casserver/utils.rb
bmedia-casserver-1.1.2 lib/casserver/utils.rb
bmedia-casserver-1.1.1 lib/casserver/utils.rb
rubycas-server-1.1.0 lib/casserver/utils.rb
rubycas-server-1.0.1 lib/casserver/utils.rb
rubycas-server-1.0 lib/casserver/utils.rb
uchouhan-rubycas-server-1.3.a lib/casserver/utils.rb
uchouhan-rubycas-server-1.2.a lib/casserver/utils.rb
uchouhan-rubycas-server-1.1.a lib/casserver/utils.rb
uchouhan-rubycas-server-1.0.a lib/casserver/utils.rb