Revision adfcf8f0
Added by Dominic Cleal over 11 years ago
- ID adfcf8f0fa17dd352588fbd9eb24286502ccc90f
lib/foreman/util.rb | ||
---|---|---|
require 'securerandom'
|
||
|
||
module Foreman
|
||
module Util
|
||
# searches for binaries in predefined directories and user PATH
|
||
... | ... | |
logger.warn e
|
||
return false
|
||
end
|
||
|
||
# Generates a URL-safe token for use with Rails for signing cookies
|
||
def secure_token
|
||
SecureRandom.base64(96).tr('+/=', '-_*')
|
||
end
|
||
end
|
||
end
|
Also available in: Unified diff
fixes #2109 - improve session token security
- adds security:generate token rake task to create static token
- generate and cache a token on startup if static token isn't present
Thanks to Sandor Szücs <sandor.szuecs@fu-berlin.de>