AuthEndpoints.OpenIddict 4.0.0-preview.1
AuthEndpoints.OpenIddict
- New package.
AddAuthEndpointsOpenIddict<TUser, TContext>(),modelBuilder.UseAuthEndpointsOpenIddict<TUser>(), andMapAuthEndpointsOpenIddict()turn an AuthEndpoints app into an OAuth 2.0 authorization server. It depends on AuthEndpoints[4.0.0, 5.0.0)and OpenIddict 7.7.2. - Authorization code flow with PKCE (S256 only). Refresh tokens rotate on every use with no reuse leeway. Access tokens are reference tokens that last 15 minutes.
POST /connect/revokerevokes tokens, andGET /.well-known/oauth-authorization-serverserves RFC 8414 metadata. /connect/authorizesends signed-out users toLoginUrlwith areturnUrlon this server, and signed-in users toConsentUrl?request={id}. The host's consent page approves or denies throughMapOAuthConsentEndpoints()orIOAuthConsentService.IOAuthPrincipalFactorysets the token subject; the default is the Identity user id.- Dynamic client registration (RFC 7591) and protected resource metadata (RFC 9728) are off by default. Registration accepts public clients only, validates redirect URIs, and is rate limited per client IP.
- Every code exchange and refresh checks the approving user again: the user must still exist, be able to sign in, not be locked out, and have the same security stamp. A failed check returns
invalid_grantand revokes the grant. Changing the password, resetting the authenticator, or callingUpdateSecurityStampAsyncends the user's OAuth grants. - OpenID Connect is opt-in: add
openidtoScopes. The token endpoint then returns ID tokens withiss,aud,sub(fromIOAuthPrincipalFactory),nonce, andamr, plusemailandemail_verifiedwith theemailscope./connect/userinfo,/connect/logout, and/.well-known/openid-configurationare served. A host withoutopenidkeeps OAuth 2.0 only, andopenidis rejected. amrreflects how the user signed in: password (pwd), two-factor (pwd,otp,mfa), passkey (pop, plusmfawhen Identity requires user verification), external (fed), and email code (otp). ID token claims never reach access tokens, and the approving user's id and security stamp never reach any token.- Logout redirects only to a post-logout URI registered for the client named by
client_idorid_token_hint, and signs a user out only with anid_token_hintissued to that user, or through the optionalLogoutUrlconfirmation page. Configured clients, dynamically registered clients, and developer apps can register post-logout redirect URIs. - The issuer, endpoint URLs, and audience come from configuration, never from the request
Hostheader. HTTPS, resource validation, and per-client resource permissions are on by default. - Clients can be defined in configuration and created with
SeedOAuthClientsAsync(). Signing and encryption keys come from a persisted self-signed pair (Certificates.Path), certificates you supply, or ephemeral keys for tests.
Enabling the package needs a migration that adds the OpenIddict tables and the OAuthRequests table. OpenID Connect in this preview has no profile, phone, or address claims and no auth_time, so prompt=login and max_age are refused, and logout is RP-initiated only. See the package README's Limitations section for the other known gaps.
Packages
- AuthEndpoints.OpenIddict
4.0.0-preview.1(new) - AuthEndpoints unchanged at
4.1.0 - AuthEndpoints.External.OAuth, AuthEndpoints.OAuth.GitHub, and AuthEndpoints.OAuth.Google unchanged at
4.0.1