LeadX.Identity.Client 1.0.0
LeadX.Identity.Client
A helper library for authenticating with LeadX Auth server for both clients and resource servers.
Clients (Request access tokens)
Startup.cs
Register LeadX Auth Client in startup
services.AddLeadXIdentityClient(options =>
{
options.ClientId = "someclientid";
options.ClientSecret = "someclientsecret";
options.Audience = "https://testportal.birdigo.com";
options.Scopes = new string[] { "offline_access" };
options.Issuer = "https://testauth.leadx.app";
});
Inject ILeadXAuth in the constructor.
To get the access token: GetAccessTokenAsync().
To get the full token response: GetTokensAsync().
To renew the access token with refresh token: RenewAccessTokenAsync()
To get new pair of tokens: RenewTokensAsync()
Resource Servers (to authenticate requests)
A call to the Birdigo IdP server is made during token introspect to validate the token.
Startup.cs
public void ConfigureServices(IServiceCollection services){
// --snip--
services.AddAuthentication(options =>
{
options.DefaultAuthenticateScheme = LeadXIdentityValidationOptionDefaults.AuthenticationScheme;
options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme; // add existing authentication if needed. This can be used for backward compatibility.
})
.AddLeadXTokenAuthentication(LeadXIdentityValidationOptionDefaults.AuthenticationScheme, options =>
{
options.Authority = configuration["AppSettings:AuthenticationDetail:Authority"]; // the valid authority for the token, usually https://testauth.leadx.app/ or https://auth.birdigo.com/
options.Audience = configuration["AppSettings:AuthenticationDetail:Audience"]; // the valid audience, eg. for API it could be https://api.leadx.app/
options.ClientId = "XXXXXXXXXXXXXXXXX"; // the resource server's id and secret for basic authentication when calling the IdP
options.ClientSecret = "xxxxxxxxx";
options.IntrospectToken = true; // Calls the IdP for authenticating tokens
options.ValidateTokenSignature = true; // Uses IdP's signing keys to validate the token locally
})
// ... add existing authentication if needed
// --snip--
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggingBuilder)
{
// --snip--
app.UseAuthentication();
app.UseAuthorization();
// --snip
}
Showing the top 20 packages that depend on LeadX.Identity.Client.
| Packages | Downloads |
|---|---|
|
Birdigo.Sdk
Typed .NET client for the Birdigo API with M2M authentication, tenant-scoped clients (organizations, leads, labels, conversations, calls) and automatic vendorId resolution.
|
0 |
|
Birdigo.Sdk
Typed .NET client for the Birdigo API with M2M authentication, tenant-scoped clients (organizations, leads, labels, conversations, calls, form fields) and automatic vendorId resolution.
|
0 |
.NET 6.0
- Microsoft.AspNetCore.Authentication (>= 2.2.0)
- Microsoft.Extensions.Caching.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Caching.Memory (>= 8.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.1)
- Microsoft.Extensions.Http (>= 8.0.0)
- System.IdentityModel.Tokens.Jwt (>= 7.6.2)
.NET 8.0
- Microsoft.AspNetCore.Authentication (>= 2.2.0)
- Microsoft.Extensions.Caching.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Caching.Memory (>= 8.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.1)
- Microsoft.Extensions.Http (>= 8.0.0)
- System.IdentityModel.Tokens.Jwt (>= 7.6.2)