refactor tests, introduce TokenEndpointCall

This commit is contained in:
Dusan Jakub
2023-09-19 21:53:29 +02:00
parent e081da00da
commit 8ec906c0b8
8 changed files with 125 additions and 69 deletions
@@ -123,7 +123,8 @@ public class OAuthResource {
return switch (params.getGrantType()) {
case "authorization_code" -> redeemAuthorizationCode(params);
case "urn:ietf:params:oauth:grant-type:device_code" -> redeemDeviceCode(params);
default -> throw new OAuthApiException(ErrorResponse.Error.invalid_request, "Unsupported grant type");
default ->
throw new OAuthApiException(ErrorResponse.Error.unsupported_grant_type, "Unsupported grant type");
};
}
@@ -5,7 +5,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
public record ErrorResponse(@JsonProperty("error") Error error,
@JsonProperty("error_description") String description) {
public enum Error {
invalid_request, unauthorized_client, unsupported_response_type,
invalid_request, unauthorized_client, unsupported_response_type, unsupported_grant_type,
access_denied, invalid_scope, server_error, temporarily_unavailable, authorization_pending
}
}