Coder Social home page Coder Social logo

vicperdana / aad-b2c-hrd Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 1.0 1.82 MB

This project uses b2c custom policy to redirect users to different identity providers depending on domain_hint value.

License: MIT License

C# 37.22% HTML 55.23% CSS 5.95% JavaScript 1.59%

aad-b2c-hrd's Introduction

Azure AD B2C: authenticate with the same email account against multiple identity providers

This project uses b2c custom policy to redirect users to different identity providers depending on the domain_hint value.

โ˜๏ธ Scenario

In a multitenant system, it's common to have multiple identity providers (IdP) to authenticate users. For example, you may have a system that allows users to log in using their social media accounts e.g., Facebook, Google, Twitter, etc. You may also have a system that allows users to log in using their corporate accounts e.g., Azure AD, Okta, etc. In this case, you may want to allow users to log in using the same email address but redirect them to different IdP depending on the domain name of the email address. For example, if the user's email address is [email protected], you may want to redirect them to the social media IdP. If the user's email address is [email protected], you may want to redirect them to the corporate IdP. This is possible in Azure AD B2C using domain hint.

Another possible scenario is to use the same email address to authenticate against multiple identity providers. You can pass on trial1 and trial2 as domain hints as part of query parameters.

See below illustration for more info. User flow using the same identity against multiple identity providers

User flow:

  1. On the sign-in page user provides the sign-in email address and clicks continue.
  2. B2C checks the domain_hint provided as query parameter.
  3. Based on the domain name, user continues with:
  • Sign-in as a local account (user name and password).
  • Redirect to a social account (Microsoft Account) to complete the sign-in.

๐Ÿš€ Deploy the sample policy

Web app with two URLs to sign in using the same email address but against different identity providers

Prerequisites

๐Ÿ’ป Deploy the sample web application

This sample is based on Azure AD B2C: ASP.NET Core Web App and Azure AD B2C. Modifications were made to add domain_hint as query parameter. Two URLs were added to the homepage to allow users to sign in using the same email address but against different identity providers.

To deploy the application follow the instructions in the sample.

๐Ÿ“ Further references

Configure custom domains in Azure AD B2C
Customize the user interface with Azure Active Directory B2C
Customize UI with HTML

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.