mirror of
https://github.com/internetee/registry.git
synced 2025-07-31 15:06:23 +02:00
Change Base64 encoding to be url_safe, add crude implementation of a Controller
This commit is contained in:
parent
dc8230dcc2
commit
35c3f0a5bf
6 changed files with 50 additions and 7 deletions
|
@ -18,11 +18,11 @@ class AuthTokenDecryptor
|
|||
decipher.decrypt
|
||||
decipher.key = key
|
||||
|
||||
base64_decoded = Base64.decode64(token)
|
||||
base64_decoded = Base64.urlsafe_decode64(token)
|
||||
plain = decipher.update(base64_decoded) + decipher.final
|
||||
|
||||
@decrypted_data = JSON.parse(plain, symbolize_names: true)
|
||||
rescue OpenSSL::Cipher::CipherError
|
||||
rescue OpenSSL::Cipher::CipherError, ArgumentError
|
||||
false
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue