mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-22 18:50:08 +03:00
(cherry picked from commit 4ea39c0ee045b7b24492b0d2905dc7402fe1f1de)
This commit is contained in:
parent
193b789c13
commit
c96f43a782
@ -25,7 +25,6 @@ module OneGateCloudAuth
|
||||
#
|
||||
def initialize_auth
|
||||
@conf[:use_user_pool_cache] = false
|
||||
@cipher = OpenSSL::Cipher::Cipher.new(CIPHER)
|
||||
end
|
||||
|
||||
def do_auth(env, params={})
|
||||
@ -96,21 +95,25 @@ module OneGateCloudAuth
|
||||
private
|
||||
|
||||
def encrypt(data, token_password)
|
||||
@cipher.encrypt
|
||||
@cipher.key = token_password
|
||||
cipher = OpenSSL::Cipher.new(CIPHER)
|
||||
|
||||
rc = @cipher.update(data)
|
||||
rc << @cipher.final
|
||||
cipher.encrypt
|
||||
cipher.key = token_password
|
||||
|
||||
rc = cipher.update(data)
|
||||
rc << cipher.final
|
||||
|
||||
return rc
|
||||
end
|
||||
|
||||
def decrypt(token_password, data)
|
||||
@cipher.decrypt
|
||||
@cipher.key = token_password[0..31]
|
||||
cipher = OpenSSL::Cipher.new(CIPHER)
|
||||
|
||||
rc = @cipher.update(Base64::decode64(data))
|
||||
rc << @cipher.final
|
||||
cipher.decrypt
|
||||
cipher.key = token_password[0..31]
|
||||
|
||||
rc = cipher.update(Base64::decode64(data))
|
||||
rc << cipher.final
|
||||
|
||||
return rc
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user