Commit f5139fa6 by lanrion

security redid key with digest md5

parent a8ccbbd3
# encoding: utf-8 # encoding: utf-8
require "redis" require "redis"
require 'digest'
module WeixinAuthorize module WeixinAuthorize
class Client class Client
...@@ -21,7 +21,7 @@ module WeixinAuthorize ...@@ -21,7 +21,7 @@ module WeixinAuthorize
@app_id = app_id @app_id = app_id
@app_secret = app_secret @app_secret = app_secret
@expired_at = Time.now.to_i @expired_at = Time.now.to_i
@redis_key = (redis_key || "weixin_" + app_id) @redis_key = security_redis_key((redis_key || "weixin_" + app_id))
end end
# return token # return token
...@@ -112,5 +112,9 @@ module WeixinAuthorize ...@@ -112,5 +112,9 @@ module WeixinAuthorize
weixin_redis.nil? weixin_redis.nil?
end end
def security_redis_key(key)
Digest::MD5.hexdigest(key.to_s).upcase
end
end end
end end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment