我设法设置了一个使用 Cognito 保护的 API 网关。未经身份验证的用户角色具有应授予其访问网关的访问权限的访问策略。我还设法使用 boto3 从池中检索身份 ID 并获取关联的开放 ID 令牌,以及关联的秘密和访问密钥。
我现在如何使用这些凭据调用网关?有没有办法使用 boto3 来处理对 API 上特定方法的请求签名?
我需要使用aws cognito userpool授权我的API端点.我可以手动完成,但我需要使用无服务器框架自动化授权部分.
无服务器框架是否支持aws cognito?
如果是这样,我们如何设置无服务器的aws-userpool?
amazon-web-services amazon-cognito aws-lambda aws-api-gateway serverless-framework
我有一个JavaScript Web应用程序,支持Cognito未经身份验证的身份.我正在试图找出如何识别DISABLED未经身份验证的IdentityId的链接身份验证IdentityId.
第一个未经身份验证的用户通过身份获得IdentityId AWS.config.credentials.get.内部CognitoIdentityCredentials使用getId生成一个新的未经身份验证的IdentityId.
let unathenticatedIdentityId;
const AWS = require('aws-sdk');
AWS.config.region = region;
AWS.config.credentials = new AWS.CognitoIdentityCredentials({
IdentityPoolId
});
AWS.config.credentials.get(err => {
unathenticatedIdentityId = AWS.config.credentials.identityId;
});
Run Code Online (Sandbox Code Playgroud)
然后,我们的用户通过身份验证到Cognito用户池amazon-cognito-identity-js,未经身份验证的IdentityId将更改为与其Cognito登录相关联的经过身份验证的IdentityId.未经身份验证的IdentityId会自动标记,DISABLED并在内部链接到经过身份验证的IdentityId.
let authenticatedIdentityId;
const { CognitoUserPool, CognitoUser, AuthenticationDetails } = require('amazon-cognito-identity-js');
const Pool = new CognitoUserPool({
UserPoolId,
ClientId,
});
const authDetails = new AuthenticationDetails({
Username,
Password,
});
const user = new CognitoUser({
Pool,
Username,
});
user.authenticateUser(authDetails, {
onSuccess: (session) => {
AWS.config.credentials.params.Logins = …Run Code Online (Sandbox Code Playgroud) javascript authentication amazon-web-services amazon-cognito
我正在使用 AWS Congito 用户池通过 Cognito 身份池进行账户管理,该身份池将此用户池作为身份提供者。我使用它来控制通过 API 网关对 API 的访问,该网关将请求发送到 Lambda。我的 Lambda 是使用 Micronaut 用 Java 8 实现的。所有这些都运行良好。
在 Lambda 中,我从以下Principal中获取名称HttpRequest:
protected String resolveUser( HttpRequest request ){
String ret = null;
Optional<Principal> principal = request.getUserPrincipal();
if( principal.isPresent() ){
ret = principal.get().getName();
}
if( ret == null || ret.length() == 0 ){
ret = "unknown";
}
return ret;
}
Run Code Online (Sandbox Code Playgroud)
Cognito identityId 的字符串名称中返回的内容。像这样的东西:
us-east-1:xxxxe650-53f4-4cba-b553-5dff42bexxxx
我想记录实际的用户登录信息,或者至少有一些方法可以在需要时将 identityId 转换为登录信息。
该LookupDeveloperIdentity API调用似乎是去了解这个正确的方式,但我无法得到它的工作。
尝试使用 Java 和 AWS Java SDK 2 执行此操作: …
amazon-web-services amazon-cognito aws-java-sdk micronaut micronaut-aws
我有一个在 AWS Route 53 中注册的域,并且正在使用 AWS Cognito 处理用户注册。
我正在尝试将我的用户池配置为使用 SES 而不是 Cognito 发送验证电子邮件。我已在 Route 53 中验证了我的域,并添加了处于“已验证”状态的 MAIL FROM Domain。
在 Cognito 中,当我在用户池配置的左侧面板中选择“消息自定义”并选择“发件人电子邮件地址 ARN”下拉列表时,它仅显示“默认”。我已选择注册我的域名的 SES 区域。
我还需要做什么来填充此内容以便设置我的“发件人电子邮件地址”?
谢谢
我正在使用Amazon SNS和Amazon Cognito服务在iOS应用程序中实现推送通知.Cognito成功保存令牌,我的应用程序得到通知,一切正常,但有一件事.
现在,当仍处于开发阶段时,我需要手动将端点添加到SNS主题,因此所有订阅者都可以收到通知.当我将更新推送到App Store时,将会有数千个令牌添加.
我正在研究亚马逊AWS文档,但不知道是否可以在没有额外努力的情况下实现它.
我的问题:是否可以自动将端点订阅到仅包含Amazon服务的主题?
push-notification amazon-web-services amazon-sns ios amazon-cognito
我正在尝试在我的iOS(Swift)应用程序中实现新的AWS Cognito用户池,但我很难让登录过程工作.我基本上试图遵循这里提供的示例.
这是我到目前为止:
AppDelegate中:
class AppDelegate: UIResponder, UIApplicationDelegate, AWSCognitoIdentityInteractiveAuthenticationDelegate {
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
let serviceConfiguration = AWSServiceConfiguration(region: AWSRegionType.USEast1, credentialsProvider: nil)
AWSServiceManager.defaultServiceManager().defaultServiceConfiguration = serviceConfiguration
let configurationUserPool = AWSCognitoIdentityUserPoolConfiguration(
clientId: "###",
clientSecret: "#########",
poolId: "###")
AWSCognitoIdentityUserPool.registerCognitoIdentityUserPoolWithConfiguration(serviceConfiguration, userPoolConfiguration: configurationUserPool, forKey: "UserPool")
self.userPool = AWSCognitoIdentityUserPool(forKey: "UserPool")
self.userPool!.delegate = self
return true
}
func startPasswordAuthentication() -> AWSCognitoIdentityPasswordAuthentication {
let mainStoryboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let logInNavigationController = mainStoryboard.instantiateViewControllerWithIdentifier("LogInNavigationController") as! UINavigationController
dispatch_async(dispatch_get_main_queue(), {
self.window?.rootViewController = …Run Code Online (Sandbox Code Playgroud) 有没有办法在Amazon Cognito用户池中对用户强制实施密码过期策略?
只是阅读文档,它们看起来与我非常相似,所以我无法真正辨别为什么使用一个而不是另一个.虽然身份令牌看起来更好,因为它在用户池中具有自定义属性(例如:custom:blah和默认值,如name和email).
现在,我正在使用一个将访问令牌传递回浏览器的应用程序,以便它可以使用它来进行ajax REST调用(有一个auth过滤器需要此访问令牌并验证它).我可以用id令牌切换访问令牌吗?当前的验证逻辑是sub从访问令牌中获取字段(uuid),但是该sub字段也存在于身份令牌中(以及除了aud我不需要的其他所有其他属性).我只是想确保我理解这一点,因为令我困惑的是为什么两个令牌都存在并且看起来如此相似.
似乎无法调用通过CloudFront分配启用AWS_IAM保护的REST API.
以下是如何重现这个:
现在使用经过身份验证的用户(我使用Cognito UserPool用户和aws-amplify)来调用
我得到的错误是:
{"message":"我们计算的请求签名与您提供的签名不匹配.请检查您的AWS秘密访问密钥和签名方法.有关详细信息,请参阅服务文档."}
我无法相信AWS不支持自定义域后面的AWS_IAM受保护端点,因为这必须是一个非常常见的用例.
因此,请您提供一份如何实现这一目标的详细清单?
谢谢
amazon-cloudfront amazon-cognito aws-sdk aws-api-gateway aws-amplify
amazon-cognito ×10
ios ×2
amazon-ses ×1
amazon-sns ×1
aws-amplify ×1
aws-cognito ×1
aws-java-sdk ×1
aws-lambda ×1
aws-sdk ×1
boto3 ×1
javascript ×1
jwt ×1
micronaut ×1
python ×1
python-3.x ×1