This is an updated test plan for a server, incorporating best current practices from RFC 9700 and the OAuth 2.1 Authorization Framework. This updated checklist removes the deprecated Implicit Grant flow and adds new requirements, recommendations, and security considerations.
-
REQUIRED:
- The server MUST use HTTPS for all communication.
- The server MUST support the Authorization Code Grant with PKCE (
response_type=code). This is the only grant type recommended for public clients (e.g., single-page applications, native apps). - Redirect URIs MUST be validated using an exact string match against a pre-registered list. Wildcard matching and partial path matching are NOT RECOMMENDED.
- The
stateparameter is now a REQUIRED element to protect against CSRF attacks. - The server MUST NOT support the Implicit Grant (
response_type=token). Verify that it is not supported.
-
RECOMMENDED:
- Use a short lifetime for access tokens and a longer lifetime for refresh tokens.
- Implement refresh token rotation to improve security. After a refresh token is used, a new one is issued, and the old one is invalidated.
- Use sender-constrained access tokens to mitigate token theft and replay attacks.
- Consider using Pushed Authorization Requests (PAR) to prevent exposing authorization request parameters in the browser's URL.
- Avoid issuing bearer tokens in URL query parameters.
-
Error Responses:
- All error responses MUST follow the format defined in RFC 6749, including the
erroranderror_descriptionparameters. - The server MUST return appropriate HTTP status codes (e.g.,
400 Bad Request,401 Unauthorized).
- All error responses MUST follow the format defined in RFC 6749, including the
- REQUIRED:
- The server MUST reject requests with
response_type=tokenas the Implicit Grant is no longer considered secure. - Verify that the
client_idparameter is validated and corresponds to a registered client. - The
redirect_uriMUST be validated using exact string matching. - The
scopeparameter MUST be supported and correctly interpreted. - The
stateparameter is now REQUIRED and must be returned unchanged in the authorization response. - The server MUST validate the
code_challengeandcode_challenge_methodparameters from the PKCE flow.
- The server MUST reject requests with
- Error Responses:
- Validate that if a
response_typeother thancodeis used, the server returns anunsupported_response_typeerror. - Check that if the
code_challengeis invalid or missing for a public client, the server returns aninvalid_requesterror. - Confirm that if the
redirect_uridoes not exactly match a pre-registered URI, the server returns aninvalid_requesterror.
- Validate that if a
- REQUIRED:
- Test that the server handles the
grant_typeparameter correctly (authorization_codeandrefresh_tokenare the primary types). The Resource Owner Password Credentials Grant and Implicit Grant are no longer recommended. - The
client_idandclient_secret(for confidential clients) MUST be correctly authenticated. - The server MUST return a new
access_tokenandtoken_typein a JSON object. - The
expires_inparameter MUST be included. - For the Authorization Code Grant, the server MUST validate the
code_verifierfrom the client against thecode_challengeprovided in the authorization request. - Using an invalid or expired
authorization_codeMUST result in aninvalid_granterror.
- Test that the server handles the
- RECOMMENDED:
- Refresh token rotation should be implemented, issuing a new refresh token with each refresh token grant.
- Error Responses:
- Validate that an invalid
grant_typereturns anunsupported_grant_typeerror. - Check that if the client authentication fails, the server returns an
invalid_clienterror. - Confirm that a missing or invalid
redirect_urireturns aninvalid_requesterror.
- Validate that an invalid
- REQUIRED:
- The access token must be a cryptographically random, non-guessable string.
- The token must be validated by the resource server before granting access to a protected resource.
- The access token MUST expire after the time specified in
expires_in. - A resource server MUST return an
invalid_tokenerror for an expired or invalid access token.
- REQUIRED:
- A client MUST be able to use a valid refresh token at the token endpoint to obtain a new
access_token. - Using an expired or invalid refresh token MUST result in an
invalid_granterror.
- A client MUST be able to use a valid refresh token at the token endpoint to obtain a new
- RECOMMENDED:
- Implement refresh token rotation: after a refresh token is used, it should be revoked to prevent its reuse. The server should then issue a new refresh token.