在API管理器中,當客戶端使用授權代碼授予請求訪問令牌時,會默認生成刷新令牌。我們是否可以更改此設置,以便API Manager不會使用授權代碼授權生成刷新令牌。WSO2 APIM:我們可以使用authorizaton_code授權禁用刷新令牌生成
非常感謝您
在API管理器中,當客戶端使用授權代碼授予請求訪問令牌時,會默認生成刷新令牌。我們是否可以更改此設置,以便API Manager不會使用授權代碼授權生成刷新令牌。WSO2 APIM:我們可以使用authorizaton_code授權禁用刷新令牌生成
非常感謝您
感謝@Gayan鏈接至該文檔。看着提到的源代碼後,我發現,刷新令牌生成可以在全球範圍內通過註釋掉本條repository\conf\identity\identity.xml
<!--
<SupportedGrantType>
<GrantTypeName>refresh_token</GrantTypeName>
<GrantTypeHandlerImplClass>org.wso2.carbon.identity.oauth2.token.handlers.grant.RefreshGrantHandler</GrantTypeHandlerImplClass>
</SupportedGrantType>
-->
這是根據到OAuth2規範的授權碼交付式的默認行爲。如果你想避免獲得刷新令牌,你必須編寫自定義授權類型[1]。
[1] https://docs.wso2.com/display/IS510/Writing+a+Custom+OAuth+2.0+Grant+Type
禁用,如果你已經配置了身份服務器API管理,必須在兩個做這個配置產品wso2_home/repository/conf/identity/identity.xml
<!--
<SupportedGrantType>
<GrantTypeName>refresh_token</GrantTypeName>
<GrantTypeHandlerImplClass>org.wso2.carbon.identity.oauth2.token.handlers.grant.RefreshGrantHandler</GrantTypeHandlerImplClass>
</SupportedGrantType>
-->