Skip to content

Implementations of a "transparent" Auth Gateway that links a third-party Identity Provider with own authorisation rules (scopes, roles, etc.)

License

Notifications You must be signed in to change notification settings

AKlaus/Transparent-Auth-Gateway

Repository files navigation

Build

Code samples for a series of articles about implementing Transparent Auth Gateway:

  1. Needs and means. Requirements for enterprise apps and available off-the-shelf solutions.
  2. Auth Flows. Relevant authentication/authorisation flows (OAuth2, OIDC) with sequence diagrams.
  3. Writing the code in C#. Comments to the code in this repo – a Transparent Auth Gateway in .NET.
  4. Deploying to Azure. App Registrations and Firewall settings (Azure WAF / Front Door).

Transparent Auth Gateway for Enterprise apps

A trusted authority for our enterprise application(s) that

  • transparently (without additional user interaction) confirms the identity with the linked Identity Provider (an Azure AD tenant in this case), supporting SSO;
  • conducts extra authentication checks (with a potential for own user management);
  • issues an access token with app-specific attributes (user’s roles/groups/etc.);
  • is self-hosted without reliance on third-party services.

The code uses Azure AD as the linked Identity Provider (for the identity checks) and its own bespoke authorisation server.

Transparent Auth Gateway

The implemented protocols:

Code structure

There are 3 projects:

  • AzureADAuthClient – a quick way to ensure that Azure AD authentication is configured. Uses Swagger UI to acquire a token and the standard Microsoft.Identity way to validate the token on WebAPI.
  • OpenIdDict.Server – a bespoke Transparent Auth Gateway to confirm the user's identity from the linked provider and authorise the user (issue own access token) according to the bespoke rules:
    • implements OAuth 2 flows to serve as the trusted authorization authority to other client apps:
    • for users authorization, it perform authentication from the linked Identity Provider (a specified tenant of Azure Entra ID).
  • OpenIdDict.Client.Api – A Web API app that validates the access token issued by the Auth Gateway (OpenIdDict.Server). Contains:
    • Swagger front-end to request the token and run HTTP requests;
    • test API end-points.

How's it different?

The key differences:

  • Issues its own access token based on internal rules and confirmed user's identity from an Azure Entra ID tenant.
  • Requires no database.
  • Has minimum code and "magical" behaviour from the packages.

About

Implementations of a "transparent" Auth Gateway that links a third-party Identity Provider with own authorisation rules (scopes, roles, etc.)

Topics

Resources

License

Stars

Watchers

Forks