以 apigee 作为身份提供者的 apigee 访问令牌
apigee access tokens with apigee as identity provider
最近一直在用apigee的baas,也在看edge。我知道如果我使用用户名和密码调用我的 baas/token 端点,我显然可以为用户取回有效的访问令牌。但是,这没有刷新令牌,用户必须根据 TTL 重新登录。
现在我在 apigee edge set-up 和 oauth 策略中注意到您可以访问刷新令牌,但我不知道如何使用 apigee BAAS 作为我的身份提供者来设置它。我已经成功创建了一个新的 oauth 代理。首先,我从请求中提取用户名和密码。然后,我将这些分配给命中我的 BAAS 的新服务标注。这成功传回了正确的用户详细信息和有效的 BAAS 访问令牌。
此时我使用标准的 GenerateAccessToken 策略
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<OAuthV2 async="false" continueOnError="false" enabled="true" name="OAuth-v20-1">
<DisplayName>OAuth v2.0 1</DisplayName>
<FaultRules/>
<Properties/>
<Attributes/>
<Operation>GenerateAccessToken</Operation>
<ExpiresIn>8640000</ExpiresIn>
<SupportedGrantTypes>
<GrantType>password</GrantType>
</SupportedGrantTypes>
<GrantType>grant_type</GrantType>
<UserName>username</UserName>
<PassWord>password</PassWord>
<GenerateResponse enabled="true"/>
</OAuthV2>
这里的所有变量都设置正确。但是我还必须设置一个基本授权header。这个 header 基于 base64 编码的 client_id 和与我在边缘的应用相关联的客户端字符串。但是,如果我尝试调用 BAAS 端点(即使通过边缘代理),然后从此处返回的访问令牌不起作用,并且返回的 "user" 详细信息与与 client_id 提供,而不是提交用户名和密码的用户(我知道我可以 mash-up 来自我的服务调用的响应,但这更多是关于 access_tokens 而不是用户数据)。我明白为什么会这样,因为显然 access_tokens 是针对不同资源发布的,但我认为这个 set-up 几乎 "manage" 这在幕后。使用 apigee BAAS 作为身份提供者时,是否有人设法获得刷新令牌 set-up?还是我找错树了?
谢谢
查看示例代理 https://github.com/apigee/api-platform-samples/tree/master/sample-proxies/advanced-api-services and see if that helps... the sample stores the BaaS key/secret as attributes on the Apigee Edge Developer object (fine for a sample, but admittedly not a great production practice) but you can just as easily store these in Apigee's Secure Vault (http://apigee.com/docs/api-reference/api/vaults)
目前 BaaS 不支持刷新令牌。
最近一直在用apigee的baas,也在看edge。我知道如果我使用用户名和密码调用我的 baas/token 端点,我显然可以为用户取回有效的访问令牌。但是,这没有刷新令牌,用户必须根据 TTL 重新登录。 现在我在 apigee edge set-up 和 oauth 策略中注意到您可以访问刷新令牌,但我不知道如何使用 apigee BAAS 作为我的身份提供者来设置它。我已经成功创建了一个新的 oauth 代理。首先,我从请求中提取用户名和密码。然后,我将这些分配给命中我的 BAAS 的新服务标注。这成功传回了正确的用户详细信息和有效的 BAAS 访问令牌。
此时我使用标准的 GenerateAccessToken 策略
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<OAuthV2 async="false" continueOnError="false" enabled="true" name="OAuth-v20-1">
<DisplayName>OAuth v2.0 1</DisplayName>
<FaultRules/>
<Properties/>
<Attributes/>
<Operation>GenerateAccessToken</Operation>
<ExpiresIn>8640000</ExpiresIn>
<SupportedGrantTypes>
<GrantType>password</GrantType>
</SupportedGrantTypes>
<GrantType>grant_type</GrantType>
<UserName>username</UserName>
<PassWord>password</PassWord>
<GenerateResponse enabled="true"/>
</OAuthV2>
这里的所有变量都设置正确。但是我还必须设置一个基本授权header。这个 header 基于 base64 编码的 client_id 和与我在边缘的应用相关联的客户端字符串。但是,如果我尝试调用 BAAS 端点(即使通过边缘代理),然后从此处返回的访问令牌不起作用,并且返回的 "user" 详细信息与与 client_id 提供,而不是提交用户名和密码的用户(我知道我可以 mash-up 来自我的服务调用的响应,但这更多是关于 access_tokens 而不是用户数据)。我明白为什么会这样,因为显然 access_tokens 是针对不同资源发布的,但我认为这个 set-up 几乎 "manage" 这在幕后。使用 apigee BAAS 作为身份提供者时,是否有人设法获得刷新令牌 set-up?还是我找错树了?
谢谢
查看示例代理 https://github.com/apigee/api-platform-samples/tree/master/sample-proxies/advanced-api-services and see if that helps... the sample stores the BaaS key/secret as attributes on the Apigee Edge Developer object (fine for a sample, but admittedly not a great production practice) but you can just as easily store these in Apigee's Secure Vault (http://apigee.com/docs/api-reference/api/vaults)
目前 BaaS 不支持刷新令牌。