Every protocol behaviour in PassportKit maps to a row here. Add or update rows in the same change as the code and its test.
Level is the strength of the RFC requirement (MUST, SHOULD, MAY, SHOULD NOT, NOT RECOMMENDED), or
Library policy for behaviour the RFC does not prescribe. A partial requirement row is an explicit, documented
deviation.
Status values: planned, partial, done, not planned (give the
reason in Notes). In the Scope table, done means every requirement row
for the RFC is done; features left out on purpose are listed in Notes.
| RFC | Title | Status | Notes |
|---|---|---|---|
| 6749 | OAuth 2.0 Authorization Framework | partial | Authorization code, refresh, client credentials and extension grants. Implicit and resource owner password grants are not planned. Endpoints must use https; http on a loopback host only with an explicit opt-in for local development (TLS-1). |
| 6750 | Bearer Token Usage | done | Authorization header only; WWW-Authenticate challenge parsing; RequestAuthorizer. No form-body or query-parameter tokens. |
| 7636 | PKCE | done | S256 always; plain not supported. |
| 8252 | OAuth 2.0 for Native Apps | partial | System browser (ASWebAuthenticationSession), loopback and claimed HTTPS redirects. A localhost redirect is accepted although NOT RECOMMENDED (AZC-11), and the reverse-domain form of private-use schemes is not enforced (APL-7). |
| 8628 | Device Authorization Grant | done | |
| 8693 | Token Exchange | done | Access-token and refresh-token subjects; claims inside tokens are not interpreted. |
| 8707 | Resource Indicators | done | |
| 8414 | Authorization Server Metadata | partial | Configurable issuer validation; IssuerValidation.disabled is an explicit opt-out of the §3.3 check (DISC-3). |
| 9110 | HTTP Semantics | done | Only what a client needs: WWW-Authenticate challenge syntax (§11), Retry-After (§10.2.3) with HTTP-date (§5.6.7), and 5xx as transient (§15.6). |
| 6585 | Additional HTTP Status Codes | done | 429 Too Many Requests (§4) is transient. |
| 7009 | Token Revocation | done | |
| 9207 | Authorization Server Issuer Identification | done | |
| 9700 | OAuth 2.0 Security Best Current Practice | partial | PKCE on every code flow, exact redirect matching, single-use codes, refresh token rotation handling. Sender-constrained tokens need DPoP (RFC 9449), which is not planned yet. |
| 7662 | Token Introspection | not planned | Resource-server concern. |
| 9449 | DPoP | not planned | Candidate for a later version. |
| 9126 | Pushed Authorization Requests | not planned | Candidate for a later version. |
| ID | RFC § | Level | Requirement | Status | Code | Test |
|---|---|---|---|---|---|---|
| FORM-1 | 6749 App. B | MUST | Form bodies are UTF-8; all but unreserved characters percent-encoded, space as + |
done | Sources/PassportKit/HTTP/FormEncoding.swift |
FormEncodingTests |
| AUTH-1 | 6749 §2.3.1 | MUST | Basic client credentials: client id and secret form-encoded before base64 | done | Sources/PassportKit/Configuration/ClientAuthentication.swift |
ClientAuthenticationTests |
| AUTH-3 | 6749 §2.3 | MUST | At most one client authentication method per request: client_id and client_secret are reserved against additional parameters in every mode |
done | Sources/PassportKit/Client/FormRequest.swift, Sources/PassportKit/Core/AdditionalParameters.swift |
ClientAuthenticationTests |
| AUTH-2 | 6749 §2.3.1, §3.2.1 | MAY | client_secret in the body; public clients send client_id |
done | Sources/PassportKit/Configuration/ClientAuthentication.swift |
ClientAuthenticationTests |
| TLS-1 | 6749 §3.1, §3.2; 7009 §2.1; 8414 §3 | MUST | Every endpoint, the issuer and the metadata URL use https. Plain http is refused unless the app sets allowsInsecureLoopbackEndpoints, which admits loopback hosts (localhost, 127.0.0.1, ::1) only, for local development; a non-loopback http URL is refused even then. Redirect URIs are not endpoints (AZC-3) |
done | Sources/PassportKit/Configuration/Endpoints.swift, ClientConfiguration.swift, Discovery/Discovery.swift |
EndpointsTests, DiscoveryTests |
| TOK-1 | 6749 §5.1 | MUST | Success response needs access_token and token_type; token_type compared case-insensitively |
done | Sources/PassportKit/Tokens/TokenResponse+Parsing.swift |
TokenResponseTests |
| TOK-2 | 6749 §5.1 | MUST | Unknown response members are ignored by the protocol and preserved for the app | done | Sources/PassportKit/Tokens/TokenResponse+Parsing.swift |
TokenResponseTests |
| TOK-3 | 6749 §3.3, §5.1 | MUST | Omitted scope means the requested scope was granted; response scope is exposed as returned |
done | Sources/PassportKit/Tokens/TokenResponse.swift |
TokenResponseTests |
| TOK-5 | 6749 §5.1, §6 | MUST | A refresh that omits scope renews the originally granted scope, so a response without scope yields a token with the credential's recorded scope; a refresh that renews the whole grant records the scope the server returned, a narrower target never does |
done | Sources/PassportKit/Session/TokenManager+Targets.swift, TokenManager+Lane.swift |
OmittedScopeTests |
| TOK-4 | 6749 §5.1 | SHOULD | expires_in read from a number or numeric string; absence tolerated |
done | Sources/PassportKit/Tokens/TokenResponse+Parsing.swift |
TokenResponseTests |
| ERR-1 | 6749 §5.2 | MUST | Error responses classified by the JSON error code, not by HTTP status |
done | Sources/PassportKit/Errors/PassportError+Classification.swift |
ErrorClassificationTests |
| ERR-2 | 6749 §5.2 | MUST | error_description and error_uri preserved; description sanitized (controls, line separators, invisible format characters, token-like runs) and truncated; error_uri only http(s) |
done | Sources/PassportKit/Errors/PassportError.swift, PassportError+Classification.swift |
PassportErrorTests, ErrorClassificationTests |
| ERR-5 | 6749 §5.2, §4.1.2.1 | MUST | A server error code outside %x20-21 / %x23-5B / %x5D-7E or longer than 64 characters is not trusted: invalidResponse, no raw text kept |
done | Sources/PassportKit/Errors/PassportError+Code.swift, PassportError+Classification.swift, Sources/PassportKit/Client/OAuthClient+AuthorizationCode.swift |
ErrorClassificationTests, AuthorizationCompletionTests |
| ERR-3 | 6749 §6; 8693 §2.2.2 | MUST | invalid_grant on a refresh-token-consuming request ends the session; elsewhere it does not |
done | Sources/PassportKit/Errors/PassportError+Classification.swift |
ErrorClassificationTests |
| ERR-4 | 9110 §10.2.3 | SHOULD | Retry-After delta-seconds and HTTP-date (IMF-fixdate and the two obsolete forms, relative to the injected wall clock) honoured on 429 and 5xx; a two-digit RFC 850 year more than 50 years ahead is read as the most recent past year (§5.6.7) |
done | Sources/PassportKit/Errors/PassportError+Classification.swift |
ErrorClassificationTests |
| ERR-6 | 6585 §4; 9110 §15.6 | Library policy | A status of 429 or 5xx without an OAuth error body is temporarilyUnavailable with retryLater; a number outside 0...999 is not a status and is never transient |
done | Sources/PassportKit/HTTP/HTTPResponse+Status.swift, Sources/PassportKit/Errors/PassportError+Classification.swift |
ErrorClassificationTests (outOfRangeStatus), LifecycleTests (transientRefreshFailureKeepsSession) |
| PKCE-1 | 7636 §4.1 | MUST | Verifier from 32 random octets, base64url without padding (43 characters) | done | Sources/PassportKit/PKCE/PKCE.swift |
PKCETests |
| PKCE-2 | 7636 §4.2, App. B | MUST | S256 challenge is base64url(SHA-256(ASCII(verifier))); Appendix B vector passes |
done | Sources/PassportKit/PKCE/PKCE.swift (CryptoKit SHA256) |
PKCETests |
| TRN-1 | 6749 §3.2 | MUST | Token endpoint requests do not follow redirects (POST) |
done | Sources/PassportKit/HTTP/URLSessionTransportDelegate.swift |
URLSessionTransportTests |
| TRN-2 | 6749 §10.3 | SHOULD | Redirects never leave HTTPS for HTTP; a redirect to another origin drops every non-standard request header | done | Sources/PassportKit/HTTP/URLSessionTransportDelegate.swift |
URLSessionTransportTests |
| TRN-3 | 6749 §10 | SHOULD | Requests time out (30 s idle, 60 s total by default); a complete response survives a late cancellation so a rotated refresh token is not lost | done | Sources/PassportKit/HTTP/URLSessionTransport.swift |
URLSessionTransportTests |
| GRANT-1 | 6749 §6 | MUST | Refresh grant sends grant_type, refresh_token and optional scope; invalid_grant ends the session |
done | Sources/PassportKit/Client/OAuthClient+TokenGrants.swift |
OAuthClientTests |
| GRANT-2 | 6749 §4.4 | MUST | Client credentials grant sends grant_type and optional scope with client authentication |
done | Sources/PassportKit/Client/OAuthClient+TokenGrants.swift |
OAuthClientTests |
| GRANT-3 | 6749 §4.5 | MAY | Extension grants through requestToken(grantType:parameters:) with full error parsing |
done | Sources/PassportKit/Client/OAuthClient+TokenGrants.swift |
OAuthClientTests |
| XCH-1 | 8693 §2.1 | MUST | Exchange sends subject_token(_type), optional actor token and types, requested_token_type, repeated audience, resource, scope; actor token needs its type |
done | Sources/PassportKit/Client/OAuthClient+TokenGrants.swift |
OAuthClientTests |
| XCH-4 | 8693 §2.2.1 | MUST | An exchange response without issued_token_type is invalid |
done | Sources/PassportKit/Tokens/TokenResponse+Parsing.swift |
OAuthClientTests |
| XCH-2 | 8693 §2.2.1 | MUST | token_type is required in a response, except that it is tolerated when absent if issued_token_type is not an access token (N_A there) |
done | Sources/PassportKit/Tokens/TokenResponse+Parsing.swift |
OAuthClientTests |
| XCH-3 | 8693 §2.2.2; 6749 §5.2 | MUST | Exchange errors classified by body; invalid_grant with a refresh-token subject ends the session |
done | Sources/PassportKit/Client/OAuthClient+TokenGrants.swift |
OAuthClientTests |
| RES-1 | 8707 §2 | MUST | resource is an absolute URI without fragment, sent as a repeated parameter; a host is not required (urn:example:api) |
done | Sources/PassportKit/Client/ParameterList.swift |
OAuthClientTests, ResourceIndicatorTests |
| RES-3 | 8707 §2 | SHOULD NOT | A resource with a query is allowed: some resources are identified by one, and the RFC only discourages it |
done | Sources/PassportKit/Client/ParameterList.swift |
ResourceIndicatorTests |
| RES-2 | 8707 §2.2 | SHOULD | The resources of an authorization request are repeated on its token request | done | Sources/PassportKit/Client/OAuthClient+AuthorizationCode.swift |
AuthorizationCompletionTests |
| REV-1 | 7009 §2.1 | MUST | Revocation request sends token and optional token_type_hint with client authentication (clientSecretBasic and clientSecretPost tested); missing endpoint is a configuration error |
done | Sources/PassportKit/Client/OAuthClient+Revocation.swift |
OAuthClientTests (revokeAuthenticatesConfidentialClients) |
| REV-2 | 7009 §2.2, §2.2.1 | MUST | A 200 response is success whatever its body; 503 with Retry-After is retryable; error JSON is parsed |
done | Sources/PassportKit/Client/OAuthClient+Revocation.swift |
OAuthClientTests |
| REV-3 | 7009 §2, §2.2 | Library policy | Best-effort revocation of a token that is not a session: never throws, gives up after a time limit on the client's clock, reports revoked, failed, timedOut, cancelled or skipped (no endpoint) |
done | Sources/PassportKit/Client/OAuthClient+Revocation.swift |
OAuthClientTests (bestEffortRevokeOutcomes, bestEffortRevokeTimesOut, bestEffortRevokeCancelled, bestEffortRevokeWithoutEndpoint) |
| DEV-1 | 8628 §3.1, §3.2 | MUST | Device authorization request sends client_id and optional scope; response needs device_code, user_code, a verification URI (verification_url alias accepted) and expires_in; interval defaults to 5 s |
done | Sources/PassportKit/Client/DeviceAuthorization.swift, OAuthClient+DeviceAuthorization.swift |
DeviceAuthorizationTests (confidential clients: confidentialClientAuthenticatesStartAndPolls) |
| DEV-7 | 8628 §3.2, §3.5 | MUST | Hostile numbers cannot trap: interval above 1 h is invalid, slow_down stops at 1 h, expires_in is clamped; verification URIs must be https (loopback http only with allowsInsecureLoopbackEndpoints) |
done | Sources/PassportKit/Client/DeviceAuthorization.swift, OAuthClient+DeviceAuthorization.swift |
DeviceAuthorizationTests |
| DEV-2 | 8628 §3.3 | MUST | verification_uri_complete is passed on verbatim; the library never opens a browser |
done | Sources/PassportKit/Client/DeviceAuthorization.swift |
DeviceAuthorizationTests |
| DEV-3 | 8628 §3.4 | MUST | Poll with grant_type device code and device_code, client authentication, no request after the deadline |
done | Sources/PassportKit/Client/OAuthClient+DeviceAuthorization.swift |
DeviceAuthorizationTests |
| DEV-4 | 8628 §3.5 | MUST | Wait the interval before every request; authorization_pending continues; slow_down adds 5 s permanently |
done | Sources/PassportKit/Client/OAuthClient+DeviceAuthorization.swift |
DeviceAuthorizationTests |
| DEV-5 | 8628 §3.5; 9110 §10.2.3 | SHOULD | Transport errors, 429 and 5xx back off exponentially (cap 30 s), larger Retry-After wins, reset after the next server answer |
done | Sources/PassportKit/Client/OAuthClient+DeviceAuthorization.swift |
DeviceAuthorizationTests |
| DEV-6 | 8628 §3.5 | MUST | access_denied and expired_token end polling; denial has no recovery, expiry needs reauthentication |
done | Sources/PassportKit/Client/OAuthClient+DeviceAuthorization.swift |
DeviceAuthorizationTests |
| DEV-8 | 8628 §3.3 | MUST | Displaying the user code and verification URI is the app's job; the library refuses a user_code over 64 characters or with control, line-separator or invisible format characters, so it is safe to show |
done | Sources/PassportKit/Client/DeviceAuthorization.swift |
DeviceAuthorizationTests |
| AZC-1 | 6749 §4.1.1; 7636 §4.3 | MUST | Authorization request sends response_type=code, client_id, redirect_uri, state, code_challenge, code_challenge_method=S256, optional scope, repeated resource, login_hint, prompt; existing endpoint query preserved |
done | Sources/PassportKit/Client/OAuthClient+AuthorizationCode.swift |
AuthorizationRequestTests |
| AZC-2 | 6749 §10.12; 7636 §4.1 | MUST | state and verifier are 32 octets from the injected random source, base64url |
done | Sources/PassportKit/PKCE/PKCE.swift |
AuthorizationRequestTests |
| AZC-3 | 6749 §3.1.2; 8252 §7, §7.3, §8.3 | MUST | Redirect URI absolute, no fragment, https, private-use scheme or loopback http; callback matched on scheme, host, port, path; a callback with userinfo is rejected and a query on the registered redirect must appear in the callback |
done | Sources/PassportKit/Client/OAuthClient+AuthorizationCode.swift, Sources/PassportKit/Configuration/LoopbackHost.swift, Sources/PassportKit/Client/AuthorizationCallback.swift |
AuthorizationRequestTests, AuthorizationCompletionTests |
| AZC-4 | 6749 §4.1.2, §10.12 | MUST | state compared in constant time; mismatch rejected before anything else is trusted |
done | Sources/PassportKit/Client/OAuthClient+AuthorizationCode.swift |
AuthorizationCompletionTests |
| AZC-5 | 6749 §4.1.2.1 | MUST | error, error_description, error_uri become a typed error; access_denied has recovery none |
done | Sources/PassportKit/Client/OAuthClient+AuthorizationCode.swift |
AuthorizationCompletionTests |
| AZC-6 | 6749 §3.1 | MUST | Repeated response parameters are rejected | done | Sources/PassportKit/Client/AuthorizationCallback.swift |
AuthorizationCompletionTests |
| AZC-7 | 6749 §4.1.3; 7636 §4.5 | MUST | Token request sends grant_type=authorization_code, code, redirect_uri, code_verifier and client authentication |
done | Sources/PassportKit/Client/OAuthClient+AuthorizationCode.swift |
AuthorizationCompletionTests, AuthorizeTests |
| AZC-8 | 6749 §4.1.2; 9700 §2.1.1 | MUST | A code is redeemed once: a pending authorization is single use and expires after a configurable lifetime (10 minutes by default) on the injected clock | done | Sources/PassportKit/Client/PendingAuthorization.swift |
AuthorizationCompletionTests |
| AZC-9 | 9207 §2.4 | MUST | The authorization code flow needs a configured issuer (beginAuthorization, authorize and completeAuthorization throw .invalidConfiguration without one), so an iss is never accepted unchecked; response iss must equal it by string comparison, also in error responses; a missing iss fails when requiresIssuerInAuthorizationResponse is set; ClientConfiguration(metadata:authentication:) sets it from authorization_response_iss_parameter_supported (RFC 9207 §3) |
done | Sources/PassportKit/Client/OAuthClient+AuthorizationCode.swift |
AuthorizationCompletionTests |
| AZC-10 | 8252 §4, §8 | SHOULD | The library never opens a browser; an app-supplied AuthorizationUserAgent presents the URL |
done | Sources/PassportKit/Client/AuthorizationRequest.swift |
AuthorizeTests |
| AZC-11 | 8252 §7.3 | NOT RECOMMENDED | localhost as the host of a loopback redirect URI is accepted because registered redirects exist; LoopbackRedirectListener always uses the IP literal 127.0.0.1 |
partial | Sources/PassportKit/Client/OAuthClient+AuthorizationCode.swift, Sources/PassportKit/Configuration/LoopbackHost.swift |
AuthorizationRequestTests |
| AZC-12 | 6749 §4.1.2 | MUST | Unknown authorization response parameters are ignored | done | Sources/PassportKit/Client/AuthorizationCallback.swift |
AuthorizationCompletionTests |
| AZC-13 | 9207 §2.4; 9700 §4.4.2 | SHOULD | When the server does not advertise authorization_response_iss_parameter_supported, a missing iss is accepted and the library gives no mix-up protection for that server: the app uses another defence, such as a distinct redirect URI per authorization server. The device flow has no authorization response and is not affected |
partial | Sources/PassportKit/Client/OAuthClient+AuthorizationCode.swift |
AuthorizationCompletionTests |
| AZC-14 | 9700 §2.1; 7636 §4 | MUST | CSRF is prevented by the per-request state (AZC-4) and PKCE; the PKCE S256 challenge is sent on every request whatever code_challenge_methods_supported says |
done | Sources/PassportKit/Client/OAuthClient+AuthorizationCode.swift |
AuthorizationCompletionTests, DiscoveryTests |
| AZC-15 | OpenID Connect Core §3.1.2.1 | MUST | prompt=none is never combined with another value: such a request is invalidConfiguration before anything is sent |
done | Sources/PassportKit/Client/OAuthClient+AuthorizationCode.swift |
AuthorizationRequestTests (noInteractionPromptStandsAlone) |
| DISC-1 | 8414 §3.1 | MUST | Well-known URL inserts /.well-known/oauth-authorization-server between host and path, dropping a terminating slash; OpenID Connect style appends /.well-known/openid-configuration |
done | Sources/PassportKit/Discovery/Discovery.swift |
DiscoveryTests |
| DISC-2 | 8414 §3 | MUST | Metadata is fetched with GET, Accept: application/json; non-2xx and malformed responses are errors |
done | Sources/PassportKit/Discovery/Discovery.swift |
DiscoveryTests |
| DISC-3 | 8414 §3.3 | MUST | Metadata issuer must be identical to the requested issuer; expected-issuer mode is explicit. IssuerValidation.disabled is an opt-out that violates this MUST and is for servers whose metadata cannot be fixed |
partial | Sources/PassportKit/Discovery/Discovery.swift |
DiscoveryTests |
| DISC-4 | 8414 §2 | MUST | Metadata members use their RFC names; unknown members are preserved and re-encoded | done | Sources/PassportKit/Discovery/AuthorizationServerMetadata.swift |
DiscoveryTests |
| DISC-5 | 8414 §2; 6749 §3.2 | MUST | Endpoints derived from metadata need a token endpoint and TLS (allowsInsecureLoopbackEndpoints as in TLS-1) |
done | Sources/PassportKit/Configuration/Endpoints+Metadata.swift |
DiscoveryTests |
| CHAL-1 | 9110 §11.6.1; 6750 §3 | MUST | Challenges parsed from several header lines and several per line; auth-params as tokens or quoted strings with backslash escapes; commas inside quotes do not split | done | Sources/PassportKit/HTTP/AuthenticationChallenge.swift |
AuthenticationChallengeTests |
| CHAL-2 | 9110 §11.1, §11.2 | MUST | Scheme and parameter names are case-insensitive and stored lower-cased | done | Sources/PassportKit/HTTP/AuthenticationChallenge.swift |
AuthenticationChallengeTests |
| CHAL-3 | 9110 §11.2 | MUST | The token68 form is recognised, including = padding |
done | Sources/PassportKit/HTTP/AuthenticationChallenge.swift |
AuthenticationChallengeTests |
| CHAL-4 | 6750 §3.1; 9449 §7.1 | MUST | error, error_description, scope, algs and other parameters are exposed verbatim; empty or malformed input never crashes |
done | Sources/PassportKit/HTTP/AuthenticationChallenge.swift |
AuthenticationChallengeTests |
| SES-1 | 6749 §6; 9700 §4.14 | MUST | Refresh tokens may rotate: every response carrying refresh_token is persisted before the access token is returned; an unsaveable one is kept in memory |
done | Sources/PassportKit/Session/TokenManager+Lane.swift |
PersistenceTests |
| SES-2 | 9700 §4.14; ADR 0005 | MUST | Operations that send the refresh token (refresh, exchange, revocation) run one at a time per session, each reading the token when it starts (a revocation reads the newest token of the ended session) | done | Sources/PassportKit/Session/RefreshLane.swift, TokenManager+Lane.swift |
LaneTests, StoreOrderingTests, SessionReplacementTests |
| SES-3 | 8693 §2.1, §2.2.1 | MUST | A refresh-token subject is spent like a refresh grant and its rotated refresh_token is persisted; a refresh_token in an access-token-subject response is not the root grant and is ignored |
done | Sources/PassportKit/Session/TokenManager+Lane.swift, TokenManager+Targets.swift |
PersistenceTests, ExpiryTests |
| SES-4 | 6749 §3.3, §5.1; ADR 0004 | MUST | Every issued access token passes the acceptance policy before it is cached or returned; a rejection keeps the rotated refresh token and the session, is remembered per target for a short time, and a policy that does not answer in time rejects | done | Sources/PassportKit/Session/TokenManager+Targets.swift |
PersistenceTests, AcceptanceTests |
| SES-5 | 6749 §5.2 | MUST | Only invalid_grant for the refresh token (recovery reauthenticate) from a lane operation ends the session; a stale one from a replaced session is ignored; invalid_scope and invalid_target do not end it |
done | Sources/PassportKit/Session/TokenManager+Lane.swift |
LifecycleTests, AcceptanceTests |
| SES-6 | 6749 §5.1; 8693 §2.2.1 | SHOULD | Expiry from expires_in, else the default lifetime, else refresh on every use; derived tokens never outlive their subject |
done | Sources/PassportKit/Session/TokenManager+Targets.swift |
ExpiryTests |
| SES-7 | 7009 §2.1; ADR 0005, 0014 | SHOULD | Sign-out clears local state first, then revokes the refresh token in the lane, best effort within a time limit; beginSignOut returns once local state is cleared, with a handle for the delete and the revocation |
done | Sources/PassportKit/Session/TokenManager.swift, PendingSignOut.swift |
LifecycleTests |
| SES-8 | 6750 §3.1 | SHOULD | A token reported as rejected is dropped only if it is still the cached one, so concurrent 401s cause one refresh | done | Sources/PassportKit/Session/TokenCache.swift |
LaneTests |
| SES-9 | 7009 §2.1; ADR 0007 | MUST | Saves and deletes of the stored credential are applied in the order decided, so a late save cannot revive a signed-out session; a sign-out revokes the newest refresh token of the session even when a request rotated it meanwhile | done | Sources/PassportKit/Session/TokenManager.swift, TokenManager+Lane.swift |
StoreOrderingTests |
| SES-10 | Library | SHOULD | The token cache and the remembered rejections hold at most 256 targets each; insertion drops expired entries, then the oldest | done | Sources/PassportKit/Session/TokenCache.swift |
TokenCacheTests |
| SES-11 | 6749 §6 | Library policy | A session can start from a refresh token the app holds (signIn(refreshToken:grantedScope:idToken:)): the credential is saved before the call returns, nothing is sent, the first accessToken(for:) refreshes with it and persists the rotation; an empty token is invalidConfiguration and leaves the current session untouched |
done | Sources/PassportKit/Session/TokenManager.swift |
SeededSessionTests |
| SES-12 | 8693 §2.2.1; 7009 §2.1; ADR 0015 | Library policy | An exchange answered after its session ended returns its issued token to the caller; the rotated subject goes to the ended session's revocation and the current session is untouched | done | Sources/PassportKit/Session/TokenManager+Lane.swift |
StoreOrderingTests (exchangeAnsweredAfterSignOut) |
| AUZ-1 | 6750 §2.1; 6750 §5.3 | MUST | Protected requests carry Authorization: Bearer <token>; no request is ever sent without a token, and a token is sent only over https, or to a loopback host when allowsInsecureLoopbackEndpoints is set |
done | Sources/PassportKit/Authorization/RequestAuthorizer.swift |
RequestAuthorizerTests, RequestAuthorizerConformanceTests |
| AUZ-2 | 6750 §3.1 | MAY | Library policy: 401 with invalid_token or no Bearer error, and a 401 without any challenge: invalidate the token and retry once; a second 401 fails with unauthorized. The RFC prescribes no retry |
done | Sources/PassportKit/Authorization/RequestAuthorizer.swift |
RequestAuthorizerTests, RequestAuthorizerConformanceTests |
| AUZ-3 | 6750 §3.1 | Library policy | insufficient_scope and every 403 are never refreshed (a new token would not carry more scope); the session survives |
done | Sources/PassportKit/Authorization/RequestAuthorizer.swift |
RequestAuthorizerTests, RequestAuthorizerConformanceTests |
| AUZ-4 | 6750 §3.1 | SHOULD | Concurrent 401s for one token cause one refresh; a 401 after another caller refreshed retries with the new token without a refresh | done | Sources/PassportKit/Authorization/RequestAuthorizer.swift |
RequestAuthorizerConformanceTests |
| AUZ-5 | 6750 §2.1 | MUST | Only tokens whose type is Bearer (case-insensitive) are sent as bearer credentials; another type, such as a sender-constrained one, is invalidConfiguration and nothing is sent |
done | Sources/PassportKit/Authorization/RequestAuthorizer.swift |
RequestAuthorizerConformanceTests |
| AUZ-6 | 6750 §2.1 | MUST | A token that is not a b64token (1*( ALPHA / DIGIT / "-" / "." / "_" / "~" / "+" / "/" ) *"=") is refused with invalidResponse before it reaches a header |
done | Sources/PassportKit/Authorization/RequestAuthorizer.swift |
RequestAuthorizerTests |
| AUZ-7 | 6750 §3.1; 9110 §11.6.1 | Library policy | A 401 whose challenges are all for another scheme (Basic, DPoP) is delivered without a refresh: a new bearer token would not change the answer |
done | Sources/PassportKit/Authorization/RequestAuthorizer.swift |
RequestAuthorizerTests |
| AUZ-8 | 6750 §5.2 | SHOULD | allowedOrigins limits where a token may be sent (scheme, host, port); another origin fails with invalidConfiguration before a token is obtained |
done | Sources/PassportKit/Authorization/RequestAuthorizer.swift |
RequestAuthorizerTests |
| AUZ-9 | 6749 §10.3 | SHOULD | data(for:target:session:) applies the transport redirect policy per task: never HTTPS to HTTP, credential headers dropped across origins |
done | Sources/PassportKit/HTTP/RedirectPolicy.swift, Sources/PassportKit/Authorization/RequestAuthorizer.swift |
RequestAuthorizerTests, URLSessionTransportTests |
| APL-1 | 8252 §6, §7.1, §8.12 | MUST | A private-use scheme redirect is delivered by ASWebAuthenticationSession, which runs in the system browser context, not an embedded web view; a dismissed sheet is .userCancelled |
done | Sources/PassportKit/UserAgents/WebAuthenticationSessionUserAgent.swift |
WebAuthenticationSessionUserAgentTests |
| APL-2 | 8252 §7.2 | SHOULD | An https (claimed URL) redirect is accepted where the OS supports it and rejected with .invalidConfiguration where it does not |
done | Sources/PassportKit/UserAgents/WebAuthenticationSessionUserAgent.swift |
WebAuthenticationSessionUserAgentTests |
| APL-3 | 8252 §7.3, §8.3 | MUST | The loopback listener binds the IPv4 literal 127.0.0.1 (never localhost) on an ephemeral port and the redirect URI carries the real port |
done | Sources/PassportKit/UserAgents/LoopbackRedirectListener.swift |
LoopbackRedirectListenerTests |
| APL-4 | 8252 §7.3, §8.3 | MUST | The listener accepts one GET for the configured path on the loopback Host whose query has state and code or error, answers other requests with an error status, never echoes the query and stops after the callback, a timeout or cancellation |
done | Sources/PassportKit/UserAgents/LoopbackRedirectListener.swift, LoopbackRequestHead.swift |
LoopbackRedirectListenerTests, LoopbackRequestHeadTests |
| APL-5 | 8252 §6 | MUST | The system browser opens the authorization URL through an injected opener; the listener is cancelled when opening fails | done | Sources/PassportKit/UserAgents/LoopbackUserAgent.swift |
LoopbackRedirectListenerTests |
| APL-6 | 8252 §7.3, §8.3 | MUST | Listener lifetime and stray-request resilience: a request without state and code/error, with Sec-Fetch-Mode other than navigate or Sec-Fetch-Dest other than document, or refused by the accept predicate (LoopbackUserAgent matches state) gets 400 and does not use up the listener; at most 8 connections, each closed after 5 s on the injected clock; cancel(), delivery and release close the listener and its connections |
done | Sources/PassportKit/UserAgents/LoopbackRedirectListener.swift, LoopbackConnection.swift, LoopbackRequestHead.swift, LoopbackUserAgent.swift |
LoopbackRedirectListenerTests, LoopbackRequestHeadTests |
| APL-7 | 8252 §7.1 | SHOULD | A private-use scheme should be the reverse domain name of a domain the app controls; the library requires a valid scheme only and does not check the form | not planned | Sources/PassportKit/Client/AuthorizationRequest.swift |
AuthorizationRequestTests |
| STO-1 | 9700 §4.14; 6749 §10.4 | MUST | The Keychain store keeps the credential in a non-synchronizable generic password item, distinguishes "not found" from errors; the stored item is verified non-synchronizable; a save updates the existing item in place, so a failed save never removes the stored credential (ADR 0009) | done | Sources/PassportKit/Storage/KeychainCredentialStore.swift |
KeychainCredentialStoreTests |
| STO-2 | 6749 §10.4 | SHOULD | Items default to kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly; a locked device is .storageFailure with retryLater; statuses in errors never carry item data. The accessibility attribute is asserted off macOS only: the file-based keychain does not report accessibility classes; the data protection keychain is not used on macOS (ADR 0009) |
done | Sources/PassportKit/Storage/KeychainCredentialStore.swift |
KeychainCredentialStoreTests |
| STO-3 | Library | SHOULD | Loading, saving and deleting the stored credential match the item by class, service, account, synchronizable and access group only, so an item written with another accessibility class is found, moved to the configured class on save and removed on sign-out; with an access group, items of other groups are not touched, and without one (accessGroup: nil) the query matches the item in any access group the app can reach; deleting a missing item succeeds |
done | Sources/PassportKit/Storage/KeychainCredentialStore.swift |
KeychainCredentialStoreTests |