diff --git a/app/controllers/sso_controller.rb b/app/controllers/sso_controller.rb index 7a1433873..23da4678f 100644 --- a/app/controllers/sso_controller.rb +++ b/app/controllers/sso_controller.rb @@ -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