TrustIdentity.ExternalProviders
1.0.2
dotnet add package TrustIdentity.ExternalProviders --version 1.0.2
NuGet\Install-Package TrustIdentity.ExternalProviders -Version 1.0.2
<PackageReference Include="TrustIdentity.ExternalProviders" Version="1.0.2" />
<PackageVersion Include="TrustIdentity.ExternalProviders" Version="1.0.2" />
<PackageReference Include="TrustIdentity.ExternalProviders" />
paket add TrustIdentity.ExternalProviders --version 1.0.2
#r "nuget: TrustIdentity.ExternalProviders, 1.0.2"
#:package TrustIdentity.ExternalProviders@1.0.2
#addin nuget:?package=TrustIdentity.ExternalProviders&version=1.0.2
#tool nuget:?package=TrustIdentity.ExternalProviders&version=1.0.2
TrustIdentity.ExternalProviders
External identity provider integration
📦 Overview
TrustIdentity.ExternalProviders enables integration with external identity providers like Azure AD, Google, Facebook, and GitHub for federated authentication.
✨ Supported Providers
- ✅ Azure AD - Microsoft Azure Active Directory
- ✅ Azure AD B2C - Azure AD B2C tenants
- ✅ Google - Google authentication
- ✅ Facebook - Facebook login
- ✅ GitHub - GitHub authentication
- ✅ Generic OIDC - Any OpenID Connect provider
🚀 Installation
dotnet add package TrustIdentity.ExternalProviders
🔧 Usage
Azure AD
using TrustIdentity.ExternalProviders.Extensions;
builder.Services.AddTrustIdentity(options => { ... })
.AddExternalProvider("AzureAD", options =>
{
options.ClientId = "your-azure-client-id";
options.ClientSecret = "your-azure-client-secret";
options.TenantId = "your-tenant-id";
options.CallbackPath = "/signin-azuread";
});
builder.Services.AddTrustIdentity(options => { ... })
.AddExternalProvider("Google", options =>
{
options.ClientId = "your-google-client-id.apps.googleusercontent.com";
options.ClientSecret = "your-google-client-secret";
options.CallbackPath = "/signin-google";
});
builder.Services.AddTrustIdentity(options => { ... })
.AddExternalProvider("Facebook", options =>
{
options.AppId = "your-facebook-app-id";
options.AppSecret = "your-facebook-app-secret";
options.CallbackPath = "/signin-facebook";
});
GitHub
builder.Services.AddTrustIdentity(options => { ... })
.AddExternalProvider("GitHub", options =>
{
options.ClientId = "your-github-client-id";
options.ClientSecret = "your-github-client-secret";
options.CallbackPath = "/signin-github";
});
📋 Configuration
Azure AD B2C
builder.Services.AddExternalProvider("AzureADB2C", options =>
{
options.Instance = "https://yourtenant.b2clogin.com";
options.Domain = "yourtenant.onmicrosoft.com";
options.TenantId = "your-tenant-id";
options.ClientId = "your-client-id";
options.ClientSecret = "your-client-secret";
options.SignUpSignInPolicyId = "B2C_1_signupsignin";
options.CallbackPath = "/signin-azureadb2c";
});
Generic OIDC Provider
builder.Services.AddExternalProvider("CustomOIDC", options =>
{
options.Authority = "https://custom-idp.example.com";
options.ClientId = "your-client-id";
options.ClientSecret = "your-client-secret";
options.ResponseType = "code";
options.Scope.Add("openid");
options.Scope.Add("profile");
options.Scope.Add("email");
options.CallbackPath = "/signin-custom";
});
🎯 Use Cases
Social Login
Allow users to login with their social accounts:
builder.Services.AddTrustIdentity(options => { ... })
.AddExternalProvider("Google", googleOptions)
.AddExternalProvider("Facebook", facebookOptions)
.AddExternalProvider("GitHub", githubOptions);
Enterprise Federation
Integrate with corporate identity providers:
builder.Services.AddTrustIdentity(options => { ... })
.AddExternalProvider("AzureAD", azureOptions)
.AddExternalProvider("Okta", oktaOptions)
.AddExternalProvider("Auth0", auth0Options);
🔧 Advanced Configuration
Claims Mapping
builder.Services.AddExternalProvider("Google", options =>
{
options.ClientId = "...";
options.ClientSecret = "...";
// Map external claims to internal claims
options.ClaimActions.MapJsonKey("picture", "picture");
options.ClaimActions.MapJsonKey("locale", "locale");
// Save tokens
options.SaveTokens = true;
// Additional scopes
options.Scope.Add("https://www.googleapis.com/auth/userinfo.profile");
});
Custom Events
builder.Services.AddExternalProvider("AzureAD", options =>
{
options.Events = new OAuthEvents
{
OnCreatingTicket = async context =>
{
// Custom logic after successful authentication
var email = context.Principal.FindFirst(ClaimTypes.Email)?.Value;
await CreateOrUpdateUserAsync(email);
},
OnRemoteFailure = async context =>
{
// Handle authentication failures
await LogFailureAsync(context.Failure);
}
};
});
📊 Provider Setup Guides
Google Setup
- Go to Google Cloud Console
- Create a new project
- Enable Google+ API
- Create OAuth 2.0 credentials
- Add authorized redirect URI:
https://yourdomain.com/signin-google - Copy Client ID and Client Secret
Azure AD Setup
- Go to Azure Portal
- Navigate to Azure Active Directory
- Go to App registrations → New registration
- Add redirect URI:
https://yourdomain.com/signin-azuread - Create a client secret
- Copy Application (client) ID, Directory (tenant) ID, and client secret
Facebook Setup
- Go to Facebook Developers
- Create a new app
- Add Facebook Login product
- Configure OAuth redirect URI:
https://yourdomain.com/signin-facebook - Copy App ID and App Secret
GitHub Setup
- Go to GitHub Settings
- Create a new OAuth App
- Set Authorization callback URL:
https://yourdomain.com/signin-github - Copy Client ID and Client Secret
🏗️ Architecture
TrustIdentity.ExternalProviders/
├── Providers/ # Provider implementations
│ ├── AzureADProvider.cs
│ ├── GoogleProvider.cs
│ ├── FacebookProvider.cs
│ └── GitHubProvider.cs
├── Extensions/ # Configuration extensions
└── Models/ # Provider models
📚 Documentation
- External Providers Guide - Detailed setup
- Setup Guide - General setup
📄 License
Apache 2.0 - See LICENSE
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Microsoft.Extensions.Http (>= 10.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.0)
- Microsoft.Identity.Client (>= 4.66.0)
- System.IdentityModel.Tokens.Jwt (>= 8.2.1)
- TrustIdentity.Abstractions (>= 1.0.2)
- TrustIdentity.Core (>= 1.0.2)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on TrustIdentity.ExternalProviders:
| Package | Downloads |
|---|---|
|
TrustIdentity.Server
Complete Enterprise IAM Server - OAuth 2.0, OIDC, SAML, WS-Fed |
GitHub repositories
This package is not used by any popular GitHub repositories.
- Full implementation of OAuth 2.0 and OpenID Connect 1.0.
- Integrated SAML 2.0 and WS-Federation support.
- Advanced AI/ML-driven fraud detection and behavioral analysis.
- FAPI 1.0 & 2.0 (Security Profile) compliance.
- Support for PKCE, DPoP, Mutual TLS, PAR, and JAR.
- Entity Framework Core support for SQL Server, PostgreSQL, MySQL, and SQLite.
- Multi-tenant isolation and Backend-for-Frontend (BFF) patterns.
- Complete Admin UI and REST API for identity management.