在大多数功能的所有AWS Cognito SDK中,您可以传递一个UserContextData
参数来提供Cognito的Advanced Security功能:
$result = $client->forgotPassword([
'AnalyticsMetadata' => [
'AnalyticsEndpointId' => '<string>',
],
'ClientId' => '<string>', // REQUIRED
'SecretHash' => '<string>',
'UserContextData' => [ // <=================== THIS
'EncodedData' => '<string>',
],
'Username' => '<string>', // REQUIRED
]);
此字段需要一些EncodedData
。
我应该在UserContextData
中输入什么内容,如何对其进行“编码”?
使用像Admin*
这样的AdminInitiateAuth
函数时,我可以通过ContextData
发送未编码的指纹数据:
$result = $client->adminInitiateAuth([
[...]
'ContextData' => [
'EncodedData' => '<string>',
'HttpHeaders' => [ // REQUIRED
[
'headerName' => '<string>',
'headerValue' => '<string>',
],
// ...
],
'IpAddress' => '<string>', // REQUIRED
'ServerName' => '<string>', // REQUIRED
'ServerPath' => '<string>', // REQUIRED
],
[...]
]);
documentation无济于事:
答案 0 :(得分:2)
AWS为用户上下文数据提供了https://cloud.google.com/blog/products/gcp/kubernetes-best-practices-mapping-external-services。
encodedData
将在设备而不是服务器上收集。
Cognito opaque implementation公开了一种实现此目的的方法。它在Javascript client SDK
中提供您可以将encodedData
从客户端转移到服务器,然后将其转发给Cognito。