All Projects → aws → Aws Aspnet Cognito Identity Provider

aws / Aws Aspnet Cognito Identity Provider

Licence: apache-2.0
ASP.NET Core Identity Provider for Amazon Cognito

Projects that are alternatives of or similar to Aws Aspnet Cognito Identity Provider

Cognitocurl
🦉🤖Easily sign curl calls to API Gateway with Cognito authorization token.
Stars: ✭ 76 (-31.53%)
Mutual labels:  cognito
Aws Cli Cheatsheet
☁️ AWS CLI + JQ = Make life easier
Stars: ✭ 94 (-15.32%)
Mutual labels:  cognito
Demo.aspnetcore.pushnotifications
Sample project for demonstrating Push Notifications based on Push API and Web Push Protocol in ASP.NET Core
Stars: ✭ 104 (-6.31%)
Mutual labels:  asp-net-core
Netcoreauth
Exploring the options for securing your ASP.NET Core 2.0 web app
Stars: ✭ 81 (-27.03%)
Mutual labels:  asp-net-core
Docker Series
Docker Series about containerizing ASP.NET Core app with MySQL..
Stars: ✭ 88 (-20.72%)
Mutual labels:  asp-net-core
Efcoreinaction Secondedition
Supporting repo to go with book "Entity Framework Core in Action", second edition
Stars: ✭ 96 (-13.51%)
Mutual labels:  asp-net-core
Lightquery
Lightweight solution for sorting and paging Asp.Net Core API results
Stars: ✭ 75 (-32.43%)
Mutual labels:  asp-net-core
Aspnetcore App Workshop
This workshop has been migrated to https://github.com/dotnet-presentations/aspnetcore-app-workshop
Stars: ✭ 105 (-5.41%)
Mutual labels:  asp-net-core
Aspnetcore Realworld Example App
ASP.NET Core backend implementation for RealWorld
Stars: ✭ 1,315 (+1084.68%)
Mutual labels:  asp-net-core
Cronscheduler.aspnetcore
Cron Scheduler for AspNetCore 2.x/3.x or DotNetCore 2.x/3.x Self-hosted
Stars: ✭ 100 (-9.91%)
Mutual labels:  asp-net-core
Aspnetcore
Learn ASP.net core MVC
Stars: ✭ 80 (-27.93%)
Mutual labels:  asp-net-core
Cierge
🗝️ Passwordless OIDC authentication done right
Stars: ✭ 1,245 (+1021.62%)
Mutual labels:  asp-net-core
Gitserver
ASP.NET Core Git HTTP Server
Stars: ✭ 98 (-11.71%)
Mutual labels:  asp-net-core
React Cognito Auth
A sample authentication app implemented with a server-less architecture, using cognito User Pools, API Gateway, react
Stars: ✭ 76 (-31.53%)
Mutual labels:  cognito
Squidex
Headless CMS and Content Managment Hub
Stars: ✭ 1,583 (+1326.13%)
Mutual labels:  asp-net-core
Ixortalk.aws.cognito.jwt.security.filter
Spring Boot security filter for decoding Cognito JWT IdTokens
Stars: ✭ 75 (-32.43%)
Mutual labels:  cognito
Aspnetcore For Beginners
Half day workshop for developers who are completely new to .NET Core and ASP.NET ASP.NET
Stars: ✭ 96 (-13.51%)
Mutual labels:  asp-net-core
User.api
集成网关、身份认证、Token授权、微服务、.netcore等的基于CQRS的微服务开发框架示例
Stars: ✭ 109 (-1.8%)
Mutual labels:  asp-net-core
Netcoresaas
Asp.Net Core multi-tenant application Sample using #SaaSKit
Stars: ✭ 105 (-5.41%)
Mutual labels:  asp-net-core
Mytested.aspnetcore.mvc
Fluent testing library for ASP.NET Core MVC.
Stars: ✭ 1,358 (+1123.42%)
Mutual labels:  asp-net-core

.NET on AWS Banner

ASP.NET Core Identity Provider for Amazon Cognito

nuget

ASP.NET Core Identity Provider for Amazon Cognito simplifies using Amazon Cognito as a membership storage solution for building ASP.NET Core web applications using ASP.NET Core Identity.

This library is not compatible with older versions of Identity such as the ones for ASP.NET MVC5 and lower. It only supports ASP.NET Core Identity and targets the .NET Standard 2.0.

The library introduces the following dependencies:

Getting Started

Follow the examples below to see how the library can be integrated into your web application.

This library extends the ASP.NET Core Identity membership system by using Amazon Cognito as a Custom Storage Provider for ASP.NET Identity.

Referencing the library

Simply add the following NuGet dependencies to your ASP.NET Core application:

Adding Amazon Cognito as an Identity Provider

To add Amazon Cognito as an Identity Provider, make the following change to your code:

Startup.cs:

public void ConfigureServices(IServiceCollection services)
{
    // Adds Amazon Cognito as Identity Provider
    services.AddCognitoIdentity();
    ...
}

public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
    // If not already enabled, you will need to enable ASP.NET Core authentication
    app.UseAuthentication();
    ...
}

In order to automatically inject Cognito service and user pool clients make the following changes to your appsettings.json:

"AWS": {
    "Region": "<your region id goes here>",
    "UserPoolClientId": "<your user pool client id goes here>",
    "UserPoolClientSecret": "<your user pool client secret goes here>",
    "UserPoolId": "<your user pool id goes here>"
}

Alternatively, instead of relying on a configuration file, you can inject your own instances of IAmazonCognitoIdentityProvider and CognitoUserPool in your Startup.cs file, or use the newly announced AWS Systems Manager to store your web application parameters.

public void ConfigureServices(IServiceCollection services)
{
    ...
    // Adds your own instance of Amazon Cognito clients 
    // cognitoIdentityProvider and cognitoUserPool are variables you would have instanciated yourself
    services.AddSingleton<IAmazonCognitoIdentityProvider>(cognitoIdentityProvider);
    services.AddSingleton<CognitoUserPool>(cognitoUserPool);

    // Adds Amazon Cognito as Identity Provider
    services.AddCognitoIdentity();
    ...
}

Using the CognitoUser class as your web application user class

Once Amazon Cognito is added as the default ASP.NET Core Identity Provider, you need to use the newly introduced CognitoUser class instead of the default ApplicationUser class.

These changes will be required in existing Razor views and controllers. Here is an example with a Razor view:

@using Microsoft.AspNetCore.Identity
@using Amazon.Extensions.CognitoAuthentication

@inject SignInManager<CognitoUser> SignInManager
@inject UserManager<CognitoUser> UserManager

In addition, this library introduces two child classes of SigninManager and UserManager designed for Amazon Cognito authentication and user management workflow: CognitoSigninManager and CognitoUserManager classes.

These two classes expose additional methods designed to support Amazon Cognito features, such as sending validation data to pre-signup AWS Lambda triggers when registering a new user:

/// <summary>
/// Creates the specified <paramref name="user"/> in Cognito with the given password and validation data,
/// as an asynchronous operation.
/// </summary>
/// <param name="user">The user to create.</param>
/// <param name="password">The password for the user</param>
/// <param name="validationData">The validation data to be sent to the pre sign-up lambda triggers.</param>
/// <returns>
/// The <see cref="Task"/> that represents the asynchronous operation, containing the <see cref="IdentityResult"/>
/// of the operation.
/// </returns>
public async Task<IdentityResult> CreateAsync(TUser user, string password, IDictionary<string, string> validationData)

Explore the documentation and sample application

Feel free to explore the documentation folder and the sample application. These two resources provide additionnal examples on how to use the library with your ASP.NET Core web application.

Getting Help

We use the GitHub issues for tracking bugs and feature requests and have limited bandwidth to address them.

If you think you may have found a bug, please open an issue

Contributing

We welcome community contributions and pull requests. See CONTRIBUTING for information on how to set up a development environment and submit code.

Additional Resources

AWS .NET GitHub Home Page
GitHub home for .NET development on AWS. You'll find libraries, tools, and resources to help you build .NET applications and services on AWS.

AWS Developer Center - Explore .NET on AWS
Find all the .NET code samples, step-by-step guides, videos, blog content, tools, and information about live events that you need in one place.

AWS Developer Blog - .NET
Come see what .NET developers at AWS are up to! Learn about new .NET software announcements, guides, and how-to's.

@dotnetonaws
Follow us on twitter!

License

Libraries in this repository are licensed under the Apache 2.0 License.

See LICENSE and NOTICE for more information.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].