Commit 053e577d6f4fb870681d820c2bdb45028449a1e9

Authored by Jeff Lai
1 parent f528b6ca
Exists in master

Add suite token

lib/dingtalk/client.rb
@@ -22,7 +22,7 @@ module Dingtalk @@ -22,7 +22,7 @@ module Dingtalk
22 end 22 end
23 23
24 def signature(return_str) 24 def signature(return_str)
25 - sort_params = [suite.suite_access_token, timestamp, nonce, encrypt(return_str)].sort.join 25 + sort_params = [Dingtalk.suite_token, timestamp, nonce, encrypt(return_str)].sort.join
26 Digest::SHA1.hexdigest(sort_params) 26 Digest::SHA1.hexdigest(sort_params)
27 end 27 end
28 28
lib/dingtalk/config.rb
@@ -22,9 +22,13 @@ module Dingtalk @@ -22,9 +22,13 @@ module Dingtalk
22 def suite_aes_key 22 def suite_aes_key
23 @suite_aes_key ||= config.suite_aes_key 23 @suite_aes_key ||= config.suite_aes_key
24 end 24 end
  25 +
  26 + def suite_token
  27 + @suite_token ||= config.suite_token
  28 + end
25 end 29 end
26 30
27 class Config 31 class Config
28 - attr_accessor :redis, :redis_options, :suite_key, :suite_secret, :suite_aes_key 32 + attr_accessor :redis, :redis_options, :suite_key, :suite_secret, :suite_aes_key, :suite_token
29 end 33 end
30 end 34 end