Sha256: 2e5616f1b7704ecbc38d30f58903879639d48b47c3df4ab0dc201c1741000ab0

Contents?: true

Size: 510 Bytes

Versions: 6

Compression:

Stored size: 510 Bytes

Contents

require 'securerandom'

module CASServer::CoreExt
  module SecureRandom
    # This is a copypaste job from 1.9.3, ActiveSupport
    # doesn't come with this method and it is an easier
    # way to get a random string that's good for tickets.
    # Less code to maintain means less things we can break.
    def self.urlsafe_base64(n=nil, padding=false)
      s = [::SecureRandom.random_bytes(n)].pack("m*")
      s.delete!("\n")
      s.tr!("+/","-_")
      s.delete!("=") if !padding
      s
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
synapse-rubycas-server-1.1.6 lib/casserver/core_ext/securerandom.rb
synapse-rubycas-server-1.1.5.pre lib/casserver/core_ext/securerandom.rb
synapse-rubycas-server-1.1.4.pre lib/casserver/core_ext/securerandom.rb
synapse-rubycas-server-1.1.4 lib/casserver/core_ext/securerandom.rb
synapse-rubycas-server-1.1.3alpha lib/casserver/core_ext/securerandom.rb
synapse-rubycas-server-1.1.3.pre lib/casserver/core_ext/securerandom.rb