Vefa.CustomAuth.AspNetCore
3.0.0
dotnet add package Vefa.CustomAuth.AspNetCore --version 3.0.0
NuGet\Install-Package Vefa.CustomAuth.AspNetCore -Version 3.0.0
<PackageReference Include="Vefa.CustomAuth.AspNetCore" Version="3.0.0" />
<PackageVersion Include="Vefa.CustomAuth.AspNetCore" Version="3.0.0" />
<PackageReference Include="Vefa.CustomAuth.AspNetCore" />
paket add Vefa.CustomAuth.AspNetCore --version 3.0.0
#r "nuget: Vefa.CustomAuth.AspNetCore, 3.0.0"
#:package Vefa.CustomAuth.AspNetCore@3.0.0
#addin nuget:?package=Vefa.CustomAuth.AspNetCore&version=3.0.0
#tool nuget:?package=Vefa.CustomAuth.AspNetCore&version=3.0.0
Vefa.CustomAuth.AspNetCore
ASP.NET Core endpoint and dependency injection integration for Vefa.CustomAuth.
This package maps OAuth2 and OpenID Connect endpoints and registers the runtime services used by the authorization server.
Typical Usage
builder.Services
.AddCustomAuth(options =>
{
options.Issuer = "https://auth.example.com";
})
.AddJwtTokenSigning();
app.MapCustomAuthEndpoints();
Register a persistence provider separately, such as Vefa.CustomAuth.EntityFrameworkCore or Vefa.CustomAuth.MongoDB.
Endpoints
GET /.well-known/openid-configuration
GET /.well-known/jwks.json
GET /connect/authorize
POST /connect/token
GET /connect/logout
POST /connect/logout
GET /connect/userinfo
POST /connect/userinfo
POST /connect/revoke
POST /login
This package ships no HTML. The host application owns the login and logout
confirmation pages. POST /login validates the antiforgery token and credentials,
opens an SSO session, and redirects; on failure it redirects back to LoginPath
with ?error=<code>&returnUrl=<orig>. The host renders the GET login page and
surfaces the error code.
Grant types
The token endpoint dispatches each request to a registered ICustomAuthGrantHandler
(Vefa.CustomAuth.AspNetCore.Endpoints.Grants) keyed by grant_type. Built-in handlers cover:
authorization_code(with PKCE)refresh_tokenclient_credentials— confidential machine-to-machine clients. Requires a confidentialTokenEndpointAuthMethodand the per-client opt-inCustomAuthClient.AllowClientCredentials. Issues an access token only (no ID token, no refresh token), withsubset to the client id.
Register an additional ICustomAuthGrantHandler to add a custom grant; a registration whose
GrantType matches a built-in grant overrides it (last registration wins).
Relying-Party Integration
The same package ships the client-side OpenID Connect integration so relying-party applications do not have to hand-wire cookie and OpenID Connect authentication.
builder.Services.AddCustomAuthClient(options =>
{
options.Authority = "https://auth.example.com";
options.ClientId = "web-app";
options.AdditionalScopes.Add("sample-api");
});
app.MapCustomAuthSignOut("/logout");
AddCustomAuthClient configures code flow with PKCE, saves tokens, and requests
openid profile email offline_access by default. MapCustomAuthSignOut pairs cookie
sign-out with the upstream OpenID Connect end-session call.
Security Notes
Keep PKCE enabled, use exact redirect URI matching, and configure HTTPS in production.
Refresh tokens require client refresh-token support and the offline_access scope. They are rotated on use, have sliding and absolute expiration, and detect reuse of consumed tokens.
The client credentials grant requires confidential client authentication (private_key_jwt); public clients cannot use it.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. 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.AspNetCore.Authentication.OpenIdConnect (>= 10.0.8)
- Microsoft.IdentityModel.Protocols (>= 8.18.0)
- Microsoft.IdentityModel.Protocols.OpenIdConnect (>= 8.18.0)
- Vefa.CustomAuth.Core (>= 3.0.0)
- Vefa.CustomAuth.Tokens (>= 3.0.0)
-
net8.0
- Microsoft.AspNetCore.Authentication.OpenIdConnect (>= 8.0.10)
- Microsoft.IdentityModel.Protocols (>= 8.18.0)
- Microsoft.IdentityModel.Protocols.OpenIdConnect (>= 8.18.0)
- Vefa.CustomAuth.Core (>= 3.0.0)
- Vefa.CustomAuth.Tokens (>= 3.0.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Vefa.CustomAuth.AspNetCore:
| Package | Downloads |
|---|---|
|
Vefa.CustomAuth.Server
OAuth2 / OpenID Connect based custom SSO library for ASP.NET Core. |
GitHub repositories
This package is not used by any popular GitHub repositories.