All Projects → MaximRouiller → Maximerouiller.azure.appservice.easyauth

MaximRouiller / Maximerouiller.azure.appservice.easyauth

Licence: mit
.NET Core integration of Azure AppService EasyAuth

Projects that are alternatives of or similar to Maximerouiller.azure.appservice.easyauth

Aspnetboilerplate Core Ng
Tutorial for ASP.NET Boilerplate Core + Angular
Stars: ✭ 61 (+60.53%)
Mutual labels:  azure, dotnet-core, dotnetcore
Developing Solutions Azure Exam
This repository contains resources for the Exam AZ-203: Developing Solutions for Microsoft Azure. You can find direct links to resources and and practice resources to test yourself ☁️🎓📚
Stars: ✭ 59 (+55.26%)
Mutual labels:  azure, dotnet-core, dotnetcore
Alexa Skills Dotnet
An Amazon Alexa Skills SDK for .NET
Stars: ✭ 412 (+984.21%)
Mutual labels:  dotnet-core, dotnetcore
Smartcode
SmartCode = IDataSource -> IBuildTask -> IOutput => Build Everything!!!
Stars: ✭ 464 (+1121.05%)
Mutual labels:  dotnet-core, dotnetcore
Azure.data.wrappers
Azure Storage Simplified
Stars: ✭ 34 (-10.53%)
Mutual labels:  azure, dotnetcore
Z00bfuscator
Z00bfuscator is the simple, open-source, cross-platform obfuscator for .NET Assemblies built on .NET Core
Stars: ✭ 35 (-7.89%)
Mutual labels:  dotnet-core, dotnetcore
Farmer
Repeatable Azure deployments with ARM templates - made easy!
Stars: ✭ 353 (+828.95%)
Mutual labels:  azure, dotnet-core
Kledex
.NET Standard framework to create simple and clean design. Advanced features for DDD, CQRS and Event Sourcing.
Stars: ✭ 502 (+1221.05%)
Mutual labels:  azure, dotnet-core
Simplcommerce
A simple, cross platform, modularized ecommerce system built on .NET Core
Stars: ✭ 3,474 (+9042.11%)
Mutual labels:  dotnet-core, dotnetcore
Mldotnet Real Time Data Streaming Workshop
A Machine Learning and Real-Time Data Analytics Workshop
Stars: ✭ 34 (-10.53%)
Mutual labels:  azure, dotnetcore
Imgbot
An Azure Function solution to crawl through all of your image files in GitHub and losslessly compress them. This will make the file size go down, but leave the dimensions and quality untouched. Once it's done, ImgBot will open a pull request for you to review and merge. [email protected]
Stars: ✭ 732 (+1826.32%)
Mutual labels:  azure, dotnet-core
Ocelot
.NET core API Gateway
Stars: ✭ 6,675 (+17465.79%)
Mutual labels:  dotnet-core, dotnetcore
Awesome Cms Core
Awesome CMS Core is an open source CMS built using ASP.Net Core & ReactJS with module seperation concern in mind and provide lastest trend of technology like .Net Core, React, Webpack, SASS, Background Job, Message Queue.
Stars: ✭ 352 (+826.32%)
Mutual labels:  dotnet-core, dotnetcore
Corefx
This repo is used for servicing PR's for .NET Core 2.1 and 3.1. Please visit us at https://github.com/dotnet/runtime
Stars: ✭ 17,924 (+47068.42%)
Mutual labels:  dotnet-core, dotnetcore
Storage
💿 Storage abstractions with implementations for .NET/.NET Standard
Stars: ✭ 380 (+900%)
Mutual labels:  azure, dotnet-core
Gb28181.solution
Linux/Win/Docker/kubernetes/Chart/Kustomize/GB28181/SIP/RTP/SDP/WebRTC/作为上下级域/平台级联互联
Stars: ✭ 323 (+750%)
Mutual labels:  dotnet-core, dotnetcore
Rockpaperscissorslizardspock
Rock, Paper, Scissors, Lizard, Spock - Sample Application
Stars: ✭ 477 (+1155.26%)
Mutual labels:  azure, dotnet-core
Sendgrid Csharp
The Official Twilio SendGrid Led, Community Driven C#, .NetStandard, .NetCore API Library
Stars: ✭ 835 (+2097.37%)
Mutual labels:  dotnet-core, dotnetcore
Wpdotnet Sdk
WordPress compiled to .NET Standard. SDK for ASP.NET Core.
Stars: ✭ 309 (+713.16%)
Mutual labels:  dotnet-core, dotnetcore
Cosmonaut
🌐 A supercharged Azure CosmosDB .NET SDK with ORM support
Stars: ✭ 309 (+713.16%)
Mutual labels:  azure, dotnetcore

MaximeRouiller.Azure.AppService.EasyAuth

Build Status Nuget (with prereleases)

This is a temporary project meant as a workaround for people wanting to use Azure AppService EasyAuth.

This provides support for filling up the ClaimsPrincipal from an application that is already logged in through EasyAuth.

This was tested using .NET Core 2.2.

The authentication provider provided by EasyAuth that were tested were:

  • Azure Active Directory
  • Microsoft Account
  • Google
  • Facebook
  • Twitter

How to setup

First, install the NuGet package MaximeRouiller.Azure.AppService.EasyAuth. This can be done either directly from Visual Studio or by running a CLI command like the following.

dotnet add package MaximeRouiller.Azure.AppService.EasyAuth -v 0.1.0-beta82

Once the package is installed, make sure that Controllers that require authentication are decorated with the [Authorize(AuthenticationSchemes = "EasyAuth")] attribute. This attribute can be set anywhere as long as it uses the right AuthenticationSchemes.

Controller

[HttpGet]
[Authorize(AuthenticationSchemes = "EasyAuth")]
public ActionResult<IEnumerable<string>> Get()
{
  ...
}

Startup.cs

Add the following line to your Startup.cs file.

using MaximeRouiller.Azure.AppService.EasyAuth
// ...
public void ConfigureServices(IServiceCollection services)
{
    //... rest of the file
    services.AddAuthentication().AddEasyAuthAuthentication((o) => { });
}

How does it work

This package provide a custom AuthenticationHandler that will interpret the X-MS-CLIENT-PRINCIPAL-IDP and X-MS-CLIENT-PRINCIPAL HTTP headers that are sent by EasyAuth once a user is logged in.

Every Controller action with the Authorize attribute mentioned previously will go through this custom AuthenticationHandler. The handler will base64 decode the X-MS-CLIENT-PRINCIPAL and create a new ClaimsPrincipal with the claims contained within the header.

There is no attempt to validate any tokens of any sort as this is the job of EasyAuth. This package assume that EasyAuth will never forward a malicious X-MS-CLIENT-PRINCIPAL and that EasyAuth will never send us an un-authenticated request.

This component will not enable any "challenge" of authentication and only parse the headers sent by EasyAuth. If you want to force the authentication, you can forward your user to /.auth/login/{provider}. If you want to automatically redirect your user to certain page, you can add ?post_login_redirect_url=/my-page.

Reading Advanced usage of authentication and authorization in Azure App Service will greatly help you understand how to use EasyAuth as well.

Fine prints

This package is not supported by Microsoft and by using this package, you agree that no support will be provided. Issues can be opened and I will do my best to resolve them. There is no guarantee provided with this package in any sort, kind, nor will there be in the future. While this coded was created while I'm employed at Microsoft, it hasn't gone through security review, code review, etc.

Use at your own risk.

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].