Changelog¶
Notable changes to rn-forge-auth, newest first, in the
Keep a Changelog format.
[Unreleased]¶
[0.2.1] - 2026-11-20¶
Changed¶
- The
oidcextra requirespyjwt[crypto]>=2.15.1.
[0.2.0] - 2026-11-17¶
Added¶
-
link_bearer_principal,session_principalandPrincipalLinkError, session and transaction record functions, and fixed-window arithmetic functions inrn_forge.auth. -
admit_loginandAdmittedLogin, which turn a completed login into the account, session content and validatedreturn_toor aLoginFailed;TRANSACTION_COOKIEandtransaction_cookie_value; andjson_string_fields, inrn_forge.auth.
Changed¶
- The
rn-forge-commonsrequirement admits 0.10 (<0.11). - An ID token whose
typheader is neither absent norJWTis rejected. - The authorization-context cache drops expired entries when it next stores one, bounding entries held by the accounts resolved within one TTL.
- In-memory replay, transaction and session stores sweep expired records only when one can have expired, instead of on every call.
- Session ID tokens and login transaction state, nonce and PKCE verifier no longer appear in dataclass representations.
[0.1.1] - 2026-11-13¶
Changed¶
- The
rn-forge-commonsrequirement admits 0.9 (>=0.8.0,<0.10).
[0.1.0] - 2026-10-29¶
Added¶
rn_forge.auth.conformance:CASES, oneSecurityControlCaseper row of the design's security controls,case_by_id, andtagged_tests, which finds the tests of a suite that carry@pytest.mark.security_control("<id>"). Both framework bindings' suites fail when a case has no tagged test.rn_forge.auth.audit(audit,AUDIT_LOGGER), the audit event helper on thern_forge.audit.authAppLoggerchannel, which both framework bindings emit their auth events through.LoginFlow.completereturnsCompletedLogin(identityand the consumed transaction'sreturn_to).ExternalIdentitygainsid_token, set byOidcProvideronly withrp_initiated_logout, so a binding can keep it in the session.- The
rn-forge-authpackage: thern_forge.authcore, theoidcextra for thern_forge.auth.oidcadapter and theredisextra for thern_forge.auth.redisadapter. Principal,Requirement,Authenticator,AsyncAuthenticator,Authorizer,ScopeAuthorizerandprincipal_from_claims, moved fromrn-forge-webinto thern_forge.authcore, andOidcAuthenticator, moved fromrn_forge.web.oidcintorn_forge.auth.oidc.JwtVerifier,discover_oidc,fetch_json,FetchJson,OidcConfigurationandTokenVerificationError, moved fromrn_forge.commons.integration.authintorn_forge.auth.oidc.JwtVerifiergainsfrom_jwks_url.- The identity and authorization contracts:
ExternalIdentity,IdentityProvider,ProviderKind,LoginStart,LoginTransaction,SessionInfo,AccountResolver,AccountRejected,AuthorizationContext,AuthorizationContextProviderandResourcePolicy. requirement_for,effective_permissionsandMechanism, andDEFAULT_PERMISSION_ACTION_MAP, moved fromrn-forge-django.AuthorizationContextCache, which caches anAuthorizationContextProviderby account and authorization version with a TTL, withAuthorizationVersions,InMemoryAuthorizationVersionsandAccountStateWriter.IdTokenVerifier, the ID-token profile, which runs Authlib'sCodeIDTokenand checksauth_timeagainstmax_age, andLogoutTokenVerifier, the back-channel logout-token profile, which checkstyp, theiatwindow and a single-usejti.JwtVerifierandOidcAuthenticatortakemode("rfc9068"or"rfc7519") andlogin_client_id; the latter is refused as an audience outside RFC 9068 mode.ReplayStoreandInMemoryReplayStore, the single-use and revoked-sidrecords.TransactionStoreandSessionStore, withInMemoryTransactionStoreandInMemorySessionStore, which are not safe across processes.RedisTransactionStore,RedisSessionStore,RedisReplayStoreandRedisAuthorizationVersionsinrn_forge.auth.redis.validate_return_toandInvalidReturnTo, which accept only a relative path under configured prefixes;SessionBody, the camelCase/auth/sessionbody; andCallbackError, the closed list of callback error codes.rn_forge.auth.testing, behind theoidcextra:FakeOidcProvider, an in-process OIDC provider with discovery, key rotation, authorization, token and UserInfo endpoints and logout tokens, andFaults, a switch for each OIDC failure.- The login adapters:
LoginFlowandLoginFailed, the framework-neutral login flow, andLoginRequest, the thin request protocol providers read.beginvalidatesreturn_toand saves the transaction for 600 seconds;completeconsumes it once, rejects a missing, expired, used or foreign transaction, and ends every failure in aLoginFailedcarrying aCallbackError.OidcProviderinrn_forge.auth.oidc, the OIDC login provider over Authlib'sOAuth2Session: discovery with the issuer check,state, nonce, PKCE S256, the RFC 9207isscheck,max_age, ID-token verification and UserInfo with asubcheck.default_claim_mapper, aclaim_mapperhook and atoken_hook(the only receiver of the upstream tokens,UpstreamTokens) shape the result. No token, code or verifier is logged.OidcProvider.oauth2andOAuth2Endpoints, the same provider for an OAuth 2.0 server that issues no ID token: it keepsstateand PKCE, sends no nonce, calls the user endpoint with the access token and maps the result (subject_fieldpicks the subject, numbers are stringified). Theissresponse check applies only withresponse_issuer.OidcProvider.logout_redirect, which returns the discoveredend_session_endpointwithid_token_hint,post_logout_redirect_uriandclient_idwhen the provider is built withrp_initiated_logout=True, andBackchannelLogoutwithLogoutRevocation, which validate a back-channel logout token and return the(issuer, sid)to revoke, or the account whose session version to bump for a token with onlysub.PasswordIdentityProviderandDevelopmentIdentityProviderinrn_forge.auth.local, withPasswordVerifier,DevelopmentAccountandDevelopmentModeRequired. Neither needs an extra.OidcConfiguration.metadata, the whole discovery document.
FakeOidcProvidergainsoauth2_onlyandauth_age, andFaultsgainsuserinfo_error.- Optional Keycloak tests of the broker profile under
tests/broker/, run by the non-gatingbroker-profileworkflow. - Guides for the contracts, the login providers (including connecting a SAML IdP through a broker), the token profiles, the stores, and the fake provider with the broker tests.
Changed¶
- Breaking:
Principalgainsexternal_subject,permissions,attributes,auth_timeandamr, andmechanismis theMechanismliteral ("session","bearer"or"basic") instead ofstr. - Breaking:
Requirementgainsany_permissionandall_permissions, checked againstPrincipal.permissions, and losesany_roleandall_roles. - Breaking:
JwtVerifierrejects a token carryingnonceorevents, and enforcestyp:JWTor none by default,at+jwtin RFC 9068 mode. JwtVerifiertakes its keys from PyJWT'sPyJWKClient, replacingJwksCache.from_issuerandfrom_jwks_urltakelifespan(default 300 seconds) andcooldown_duration(default 30 seconds) in place ofmax_age, andfrom_jwks_urlno longer takesfetch: only the discovery document usesfetch_json.- The
oidcextra ispyjwt[crypto]withauthlib>=1.9.1andjoserfc>=1.7.7; it requires PyJWT 2.15.0 or later. - The package declares the MIT licence and is published to PyPI.