safe base64
This commit is contained in:
parent
e9834f108a
commit
eaad006d17
|
@ -24,11 +24,16 @@ class SsoController < ApplicationController
|
|||
end
|
||||
|
||||
private
|
||||
def base64_safe(content)
|
||||
content = content.gsub('-', '+')
|
||||
content.gsub('_', '/')
|
||||
end
|
||||
|
||||
def parse(auth)
|
||||
crypted_str = Base64.decode64(auth)
|
||||
crypted_str = Base64.decode64(base64_safe(auth))
|
||||
pkey = OpenSSL::PKey::RSA.new(File.new(File.join(Rails.root,"config/private.key")))
|
||||
# content = pkey.private_decrypt(pwd,OpenSSL::PKey::RSA::NO_PADDING)
|
||||
content = pkey.private_decrypt(crypted_str)
|
||||
content = pkey.private_decrypt(crypted_str,OpenSSL::PKey::RSA::PKCS1_PADDING)
|
||||
# content = pkey.private_decrypt(crypted_str)
|
||||
JSON.parser(content)
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue