通过商店使用WSO2 AM时,可以设置有效时间,以便可以增加/减少访问令牌的到期时间。
生成新令牌时是否可以通过cURL设置有效时间?
例如,普通令牌生成命令:
curl -k -d "grant_type=client_credentials" -H "Authorization: Basic userToken, Content-Type: application/x-www-form-urlencoded" localhost:8243/token
{"scope":"am_application_scope default","token_type":"bearer","expires_in":1367,"access_token":"1234456677890"}
设置有效时间的可能令牌生成命令:
curl -k -d "grant_type=client_credentials" -d "validity_time=99999" -H "Authorization: Basic userToken, Content-Type: application/x-www-form-urlencoded" localhost:8243/token
{"scope":"am_application_scope default","token_type":"bearer","expires_in":99999,"access_token":"1234456677890"}
设置此命令使用的正确命令是什么?这样做的原因是因为我希望API Manager的用户能够通过我们提供的Java API客户端设置到期日期。
开箱即用不支持此功能。您可以通过编写自定义的OAuth授权类型来实现它。有关如何编写自定义OAuth授权类型的更多详细信息,请参考[1]。
[1] https://docs.wso2.com/display/IS500/Writing+a+Custom+OAuth+2.0+Grant+Type
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句