by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Stuart Morris
    @StuartMorris0
    Hi all, I am trying to use AWS Cognito in an ASP.Net 4.5 application. All the documentation/videos I can find online all relate to .Net Core instead. I am able to get a user logged in, but I am not sure which of the Access/ID/Refresh tokens should be stored in FormsAuthentication. We are simply trying to use Cognito as the IDP behind a controller/path access within a Web App.
    Raymond Sanchez
    @agileraymond
    @StuartMorris0 You can use email or username to store in FormsAuthentication.
    Stuart Morris
    @StuartMorris0
    @agileraymond Right. I understand that but which token should be stored. Also when trying to store the access or Id token. The JWT is too large once encrypted to be stored in a cookie so adding it fails.
    Stuart Morris
    @StuartMorris0
    Is this gitter active?
    stackunderflows
    @stackunderflows
    I'm trying to login via Cognito in a Xamarin Forms app. When I call user.StartsWithSrpAuthAsync, I get an exception of unable to verify secret hash for client. Is there a way to attach the secret hash to the CognitoUser class? I don't see a property for it. Does this nuget not support apps that have a secret?
    stackunderflows
    @stackunderflows
    I figured it out. When you instantiate a new CognitoUser, you have to use a constructor that allows you to pass in the secret. This is the only way to set it because the backing property is private.
    abiehusney25
    @abiehusney25
    anyone have a step by step instructions on how to set it up with Unity?
    7ZHtBazoH6qMp
    @7ZHtBazoH6qMp
    Hey everyone. Does anyone know how I can get the proper JSON that is sent to MediaConvert from the CreateJobRequest model?
    When I serialize the CreateJobRequest model using JsonConvert it doesn't import into the UI.

    Instead of flat properties:
    "TimecodeSource": "Embedded"

    I'm seeing:
    "TimecodeSource": {
    "Value": "Embedded"
    }

    Francisco Ramón Sánchez Favela
    @safv12

    Hi guys!

    I’m trying to write a unit test in c# and I need to mock the response of the methodCreateBatchWrite<T> using Moq

    But I can’t instantiate an object of the BatchWrite<T>object.

    I’m doing this:

    this.dynamoDbMock
        .Setup(m => m.CreateBatchWrite<SomeType>(It.IsAny<DynamoDBOperationConfig>()))
        .Returns(Mock.Of<BatchWrite<SomeType>>());

    Any idea of how can I mock this object.

    Thank you!

    iShorty123
    @iShorty123
    Hello, can anyone here help me with building via Unity and IL2CPP? I have a link.xml file but I'm still receiving errors when I try to call a Lambda function
    iShorty123
    @iShorty123
    If you can help, please reply to the post I made here: https://forums.awsgametech.com/t/unity-realtime-gamelift-client-not-working-with-il2cpp-build/8483 thank you
    Raymond Sanchez
    @agileraymond
    @safv12 You need to return an actual object in the .Returns section. For example,
    var myObject = new Obj();
    this.dynamoDbMock
    .Setup(m => m.CreateBatchWrite<SomeType>(It.IsAny<DynamoDBOperationConfig>()))
    .Returns(myObject);
    alexgsingh
    @alexgsingh

    Hi all, I am trying to use Amazon.Extensions.CognitoAuthentication library. I can authenticate a user with the user in Cognito Userpool but then when trying to upload to s3 using an Identitypool, I get the following error. Please advise? FYI I am using .net c# in Xamarin

    at Amazon.S3.Util.BucketRegionDetector.GetUsEast1ClientFromCredentials (Amazon.Runtime.ImmutableCredentials credentials) [0x00000] in <f978334983bd4d62a4fa9583dc601968>:0
    at Amazon.S3.Util.BucketRegionDetector.GetHeadBucketPreSignedUrl (System.String bucketName, Amazon.Runtime.ImmutableCredentials credentials) [0x00000] in <f978334983bd4d62a4fa9583dc601968>:0
    at Amazon.S3.Util.BucketRegionDetector.GetBucketRegionNoPipelineAsync (System.String bucketName, Amazon.Runtime.ImmutableCredentials credentials) [0x0000a] in <f978334983bd4d62a4fa9583dc601968>:0
    at Amazon.S3.Util.BucketRegionDetector.DetectMismatchWithHeadBucketFallbackAsync (Amazon.S3.Util.AmazonS3Uri requestedBucketUri, Amazon.Runtime.AmazonServiceException serviceException, Amazon.Runtime.ImmutableCredentials credentials) [0x00092] in <f978334983bd4d62a4fa9583dc601968>:0
    at Amazon.S3.Internal.AmazonS3RetryPolicy.SharedRetryForExceptionAsync (Amazon.Runtime.IExecutionContext executionContext, System.Exception exception, System.Func3[T1,T2,TResult] retryForExceptionSync, System.Func3[T1,T2,TResult] baseRetryForException) [0x000e2] in <f978334983bd4d62a4fa9583dc601968>:0
    at Amazon.S3.Internal.AmazonS3RetryPolicy.RetryForExceptionAsync (Amazon.Runtime.IExecutionContext executionContext, System.Exception exception) [0x00091] in <f978334983bd4d62a4fa9583dc601968>:0
    at Amazon.Runtime.RetryPolicy.RetryAsync (Amazon.Runtime.IExecutionContext executionContext, System.Exception exception) [0x000ed] in <3be753f269f04a3baa3e67389f87b6c2>:0
    at Amazon.Runtime.Internal.RetryHandler.InvokeAsync[T] (Amazon.Runtime.IExecutionContext executionContext) [0x001fd] in <3be753f269f04a3baa3e67389f87b6c2>:0
    at Amazon.Runtime.Internal.CallbackHandler.InvokeAsync[T] (Amazon.Runtime.IExecutionContext executionContext) [0x00080] in <3be753f269f04a3baa3e67389f87b6c2>:0
    at Amazon.Runtime.Internal.CallbackHandler.InvokeAsync[T] (Amazon.Runtime.IExecutionContext executionContext) [0x00080] in <3be753f269f04a3baa3e67389f87b6c2>:0
    at Amazon.S3.Internal.AmazonS3ExceptionHandler.InvokeAsync[T] (Amazon.Runtime.IExecutionContext executionContext) [0x00099] in <f978334983bd4d62a4fa9583dc601968>:0
    at Amazon.Runtime.Internal.ErrorCallbackHandler.InvokeAsync[T] (Amazon.Runtime.IExecutionContext executionContext) [0x00099] in <3be753f269f04a3baa3e67389f87b6c2>:0
    at Amazon.Runtime.Internal.MetricsHandler.InvokeAsync[T] (Amazon.Runtime.IExecutionContext executionContext) [0x000ab] in <3be753f269f04a3baa3e67389f87b6c2>:0
    at Amazon.S3.Transfer.Internal.SimpleUploadCommand.ExecuteAsync (System.Threading.CancellationToken cancellationToken) [0x00120] in <f978334983bd4d62a4fa9583dc601968>:0
    at MobileAnalyser.Services.S3DataStore.AddItemAsync (System.String filePath, System.String key, System.Threading.CancellationToken token)

    Jonas Steinberg
    @jonassteinberg1
    is there a way to specify a proxy bypass? I have some domains that when requested should not be proxied to, e.g. s3.amazonaws.com (because of course this has a vpc endpoint)
    Fagro Vizcaino
    @fagro-vizcaino
    Hi Guys

    I'm getting this error after I spend a few minutes on the Amazon Cognito Login Page of my app and then try to login:

    System.Exception: An error was encountered while handling the remote login. ---> System.Exception: Correlation failed.
    --- End of inner exception stack trace ---
    at Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler`1.HandleRequestAsync()
    at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
    at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
    at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
    at Cbord.LandingPage.Web.Startup.<>c.<<Configure>b__6_0>d.MoveNext() in /src/LandingPage/LandingPage.Web/Startup.cs:line 306
    --- End of stack trace from previous location where exception was thrown ---
    at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

    Can you please point me in the right direction ?

    Fagro Vizcaino
    @fagro-vizcaino
    This is my Startup.cs:
     services.AddScoped<IViewRenderService, ViewRenderService>();
    
                services.AddMvc()
                    .AddViewLocalization()
                        .AddDataAnnotationsLocalization()
                    .AddJsonOptions(options =>
                    {
                        options.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
                        options.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
                    });
    
                services.AddDefaultAWSOptions(Configuration.GetAWSOptions());
                services.AddAuthorization(options =>
                {
                    //Temporary Authorization FIX - added roles policy (to test roles), while AwsCognito - policy not implemented
                    options.AddPolicy("RequireRoles",
                        policy => policy.RequireRole("SysAdmin", "OrgAdmin", "PhiUser", "User"));
                });
    
                services.AddScoped<ILandingPageUserService, LandingPageUserService>();
                services.AddAuthentication(options =>
                {
                    options.DefaultAuthenticateScheme = CookieAuthenticationDefaults.AuthenticationScheme;
                    options.DefaultSignInScheme = CookieAuthenticationDefaults.AuthenticationScheme;
                    options.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme;
                })
                    .AddCookie(options =>
                    {
                        //options.Cookie.SecurePolicy = mEnvironment.IsDevelopment()
                        //    ? CookieSecurePolicy.None
                        //    : CookieSecurePolicy.Always;
                        options.Cookie.SecurePolicy = CookieSecurePolicy.Always;
                        options.Cookie.SameSite = SameSiteMode.None;
                        options.Cookie.Expiration = TimeSpan.FromMinutes(4.5);
                    })
                    .AddOpenIdConnect(options =>
                    {
                        options.ResponseType = Configuration["Authentication:Cognito:ResponseType"];
                        options.MetadataAddress = Configuration["Authentication:Cognito:MetadataAddress"];
                        options.ClientId = Configuration["Authentication:Cognito:ClientId"];
                        //options.CallbackPath = new PathString(Configuration["Authentication:Cognito:CallbackUrl"]);
                        options.SaveTokens = bool.Parse(Configuration["Authentication:Cognito:SaveToken"]);
                        options.UseTokenLifetime = true;
                        options.Events = new OpenIdConnectEvents
                        {
                            OnTokenValidated = async context =>
                            {
                                var authService = context.HttpContext.RequestServices
                                    .GetRequiredService<IUserAuthenticationService>();
                                await authService.OnTokenValidated(context,
                                    Configuration["Authentication:Cognito:SignedOutRedirectUri"]);
                            },
                            OnRedirectToIdentityProvider = async context =>
                            {
                                var authService = context.HttpContext.RequestServices
                                    .GetRequiredService<IUserAuthenticationService>();
                                await authService.OnRedirectToIdentityProvider(context,
                                    Configuration["Authentication:Cognito:ClientId"]);
                            },
                            OnRedirectToIdentityProviderForSignOut = context =>
                            {
                                var logoutUri =
                                    HttpUtility.UrlEncode(Configuration["Authentication:Cognito:SignedOutRedirectUri"]);
                                var issuerAddress =
                                    $"{Configuration["Authentication:Cognito:LogoutEndpoint"]}/logout?logout_uri={logoutUri}";
                                var authService = context.HttpContext.RequestServices
                                    .GetRequiredService<IUserAuthenticationService>();
    Omar Himada
    @omarhimada
    which one is line 306
    Fagro Vizcaino
    @fagro-vizcaino
    @omarhimada :
      public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, ConfigSettings config)
            {
    
                var localizationOptions = new RequestLocalizationOptions
                {
                    SupportedCultures = new List<CultureInfo> { new CultureInfo("en-US") },
                    SupportedUICultures = new List<CultureInfo> { new CultureInfo("en-US") },
                    DefaultRequestCulture = new RequestCulture("en-US")
                };
    
                app.UseRequestLocalization(localizationOptions);
                if (env.IsDevelopment() && config.EnableDevelopmentExceptions)
                {
                    app.UseDeveloperExceptionPage();
                }
                else
                {
                    app.UseExceptionHandler("/Error");
                }
    
                app.Use(async (context, next) =>
                {
                    if (context.Request.Path.Value.Contains("invalid"))
                        throw new Exception("ERROR"); <---------------------------------------------------Line 306
    
                    context.Request.Scheme = "https";
                    //if (!env.IsDevelopment())
                    //{
                    //    context.Request.Scheme = "https";
                    //}
                    await next();
                });
                app.UseCookiePolicy();
                app.UseAuthentication();
                app.UseMvc(routes =>
                {
                    routes.MapRoute(
                        name: "federated",
                        template: "SignIn/{lookupName}",
                        defaults: new { controller = "Account", action = "Auth" });
                    routes.MapRoute("Default", "{controller=Home}/{action=Index}");
                });
    
                app.UseFileServer();
            }
    Omar Himada
    @omarhimada
    you have app.UseAuthentication()
    do you also need app.UseAuthorization()?
    Fagro Vizcaino
    @fagro-vizcaino
    Not so sure. Why ?
    Omar Himada
    @omarhimada
    try useauthorization before useauth
    see if exception persists shrug
    its just that your stacktrace talks about session and i dont normally see use authentication without authorization. just a hunch really
    Fagro Vizcaino
    @fagro-vizcaino
    umm you mean:
     app.UseCookiePolicy();
      app.UseAuthorization();  <-----
      app.UseAuthentication();
    Omar Himada
    @omarhimada
    ya give it a shot
    im not really sure what youre doing with that app.Use(async ... but if that doesnt work i think the problem is in there for sure
    Fagro Vizcaino
    @fagro-vizcaino
    Well, cannot use UseAuthorization because is just available for asp.net 3.0 upward
    i'm on asp.net core 2.1
    Omar Himada
    @omarhimada
    hm
    i mean its definitely being thrown from within that app.Use(async...
    i would debug and see what you can find inside there
    Fagro Vizcaino
    @fagro-vizcaino
    But what about the Correlation failed error ?
    Omar Himada
    @omarhimada
    what happens if instead of throwing a new exception there you do something else
    maybe it has something to do with throwing a new Exception() from within that context
    urothis
    @urothis
    Hey everyone, was looking for some assistance or some good example repos to take a look at, I'm implementing https://docs.aws.amazon.com/iot/latest/developerguide/provision-wo-cert.html I'm at step To initialize the device for use. I'm having a hard time determining which cert I'm supposed to be passing and if I need to generate a csr.
    Fagro Vizcaino
    @fagro-vizcaino
    @omarhimada I end up putting this :
    options.Events = new OpenIdConnectEvents
                            {
                                OnRemoteFailure = context =>
                                {
                                    if (context.Failure.Message.Contains("Correlation failed"))
                                        context.Response.Redirect("/");
                                    else
                                        throw new Exception("ERROR");
    
                                    context.HandleResponse();
    
                                    return Task.CompletedTask;
                                },
                           }
    Omar Himada
    @omarhimada
    did that work?
    Fagro Vizcaino
    @fagro-vizcaino
    yes
    Omar Himada
    @omarhimada
    cool man
    Fagro Vizcaino
    @fagro-vizcaino

    I'm facing another weird stuff, let me see if you guys point me to the right direction

    This is what I'm trying to accomplish:

    If the user login successfully and completed an operation and then instead of signing out just closes the browser tab. Now let's say that after a period of 10 minutes, the user decides to log in again I want to redirect the user to the login page. Instead of automatically login in and go directly to the homepage (that's the behavior that is currently happening).

    Omar Himada
    @omarhimada
    you want to configure session length
    Fagro Vizcaino
    @fagro-vizcaino
    @omarhimada I did, but it's not working. It clears all cookies after 20 min (with the browser close) but I don't any idea where that configuration is coming from.
    bakhtiyar-ospanov
    @bakhtiyar-ospanov
    Hi guys! Are there any updates on download progress callback for AWS Unity SDK (AmazonS3Client.GetObjectAsync)?
    Stiaan Jacobs
    @stiaanj

    Hello there, I hope someone can help me, I have been searching everywhere without finding a solution that works.

    I am using the AWS sdk in dotnet 3.1 worker service to process and upload files to MinIO. Smaller uploads work correctly using the low-level API, but as soon as uploads go over 25mb or so, the uploads get stuck at 100% on the CompleteMultipartUploadAsync. It eventually times out and then fails to complete the upload.

    Can someone push me in the right direction?

    Raymond Sanchez
    @agileraymond
    @stiaanj When you upload a 25mb or bigger, how many parts are you using to upload it?
    Stiaan Jacobs
    @stiaanj
    Its set to use 5mb chunks, 5 parts