小编oka*_*son的帖子

无服务器中一个端点的多种授权者类型

我正在为我的API尝试无服务器和授权者。我有一个用例,其中有两个不同的应用程序,一个iOS和一个Angular。iOS应用程序使用具有联合身份的开发人员身份验证,因为它使用第三方api进行身份验证,而Angular应用程序使用Cognito用户池进行身份验证。

因此,我可以使用User Pool授权者指定一个函数,并且该函数运行良好,对于我的开发人员身份验证用户,我正在使用AWS_IAM授权器,并且该函数也运行良好。

但是现在,我希望我的开发人员通过身份验证,并且我的用户池用户能够访问相同的api网关端点。那么,如何为一个端点使用两种不同类型的授权者?

任何在这方面有经验的人都可以为我指明正确的方向?

aws-lambda aws-api-gateway serverless

7
推荐指数
1
解决办法
1766
查看次数

在Angular 2中实现AWS-Cognito

我目前正在尝试使用Angular和AWS构建Web应用程序.我的第一步是使用AWS-Cognito进行工作身份验证.但是我在使用AWS-Cognito SDK时遇到了一些问题.

我采取了以下步骤:

我开始使用这个Angular 2快速入门来设置我的应用程序:https://github.com/angular/quickstart然后运行npm install

我的下一步是安装角度CLI npm install -g @angular/cli

接下来我运行了angular-cognito-identity-sdk: npm install --save amazon-cognito-identity-js

安装SDK后,我需要将sdk放入我的组件中:

 console.log(AmazonCognitoIdentity);

         var authenticationData = {
            Username : 'username',
            Password : 'password',
        };
        var authenticationDetails = new AmazonCognitoIdentity.CognitoIdentityServiceProvider.AuthenticationDetails(authenticationData);
        var poolData = {
            UserPoolId : 'pool_id', // Your user pool id here
            ClientId : 'client_id' // Your client id here
        };
        var userPool = new AmazonCognitoIdentity.CognitoIdentityServiceProvider.CognitoUserPool(poolData);
        var userData = {
            Username : 'username',
            Pool : userPool
        };
Run Code Online (Sandbox Code Playgroud)

但是当我运行代码时,Iäm给出了以下错误:

TypeError:无法读取未定义的属性"AuthenticationDetails"

我在这里错过了一步吗?在我的Angular应用程序中实现Cognito …

amazon-cognito aws-cognito angular

4
推荐指数
2
解决办法
9009
查看次数

C#setter将值更改为0

我在使用C#编写棋盘游戏时遇到了setter的问题.

在这里,我有一个if语句,我得到一个新的随机数,并尝试更新我的播放器p的位置.

if(Console.ReadLine().Equals("Y"))
{
  int roll = dice.roll();
  Console.WriteLine(p.playerName + " rolled: " + roll);
  int newPosition = p.position + roll;
  p.position = newPosition;

  Console.WriteLine("The players position is: " + p.position);
}
Run Code Online (Sandbox Code Playgroud)

这是Player类中位置的setter.

public int position
    {
        get
        {
            return _position;
        }
        set
        {
            Console.WriteLine("Position is: " + position);
            _position = position;
        }
    }
    private int _position;
Run Code Online (Sandbox Code Playgroud)

我的问题是该值似乎在setter中变为零.

OUTPUT:

滚?(Y/N)Y

玩家1滚动:4

位置为:0 //在播放器位置设置器中打印

玩家位置为:0 //从玩家对象获取值时打印

当我发送一个值时,为什么setter中的位置0的值是4?

c#

0
推荐指数
1
解决办法
151
查看次数