Oauth令牌加密和哈希



在api中生成oauth令牌后,在响应中我们需要加密oauth令牌,然后用时间戳salt并对其进行散列

使用客户端凭据,客户端达到了顶点。但作为回应,如何加密oauth令牌,然后用时间戳salt并对其进行哈希?

 curl https://{org}-test.apigee.net/oauth/client_credential/
  accesstoken?grant_type=client_credentials -X POST -d 
  'client_id={consumer_key}&client_secret={consumer_secret}'

响应如下

   {  
  "issued_at" : "1382703699776",
   "application_name" : "8586c7b7-2936-4779-b7a6-97014e436d7d",
  "scope" : "READ",
  "status" : "approved",
  "api_product_list" : "[PremiumWeatherAPI]",
  "expires_in" : "3599",
  "developer.email" : "tesla@weathersample.com",
  "organization_id" : "0",
  "client_id" : "SJOaCEGohSu3vpNswMs5YdBlc2GOAh1J",
  "access_token" : "UAj2yiGAcMZGxfN2DhcUbl9v8WsR",
  "organization_name" : "myorg",
  "refresh_token_expires_in" : "0",
  "refresh_count" : "0"
   }

作为响应,我需要使用时间戳加密oauth访问令牌和salt,然后对其进行散列。如何做到

这里有一种可以使用的方法:

  • 在生成访问令牌策略之后,您就可以访问oauthv2accesstoken.{policy_name}.access_token变量。使用分配消息策略将此值分配给变量
  • 接下来,为了计算哈希,您需要在流的响应部分使用java、python或javascript策略。这个链接有一个sha256的JavaScript示例

最新更新