From 599990c6136eda8f020c026a9675091704b0dd79 Mon Sep 17 00:00:00 2001 From: Rein Krul Date: Wed, 27 Sep 2023 12:50:20 +0200 Subject: [PATCH] feedback --- auth/api/iam/api.go | 18 +++++++++++++----- auth/api/iam/error.go | 2 ++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/auth/api/iam/api.go b/auth/api/iam/api.go index 21a05464d1..9a0b4e3c1c 100644 --- a/auth/api/iam/api.go +++ b/auth/api/iam/api.go @@ -116,19 +116,27 @@ func (r Wrapper) HandleTokenRequest(ctx context.Context, request HandleTokenRequ // Options: // - OpenID4VCI // - OpenID4VP, vp_token is sent in Token Response - panic("not implemented") + return nil, OAuth2Error{ + Code: UnsupportedGrantType, + Description: "not implemented yet", + } case "vp_token": // Options: // - service-to-service vp_token flow - panic("not implemented") + return nil, OAuth2Error{ + Code: UnsupportedGrantType, + Description: "not implemented yet", + } case "urn:ietf:params:oauth:grant-type:pre-authorized_code": // Options: // - OpenID4VCI - panic("not implemented") + return nil, OAuth2Error{ + Code: UnsupportedGrantType, + Description: "not implemented yet", + } default: return nil, OAuth2Error{ - Code: InvalidRequest, - Description: "unsupported grant_type", + Code: UnsupportedGrantType, } } } diff --git a/auth/api/iam/error.go b/auth/api/iam/error.go index a7e988905b..a70c005052 100644 --- a/auth/api/iam/error.go +++ b/auth/api/iam/error.go @@ -35,6 +35,8 @@ const ( // InvalidRequest is returned when the request is missing a required parameter, includes an invalid parameter value, // includes a parameter more than once, or is otherwise malformed. InvalidRequest ErrorCode = "invalid_request" + // UnsupportedGrantType is returned when the authorization grant type is not supported by the authorization server. + UnsupportedGrantType ErrorCode = "unsupported_grant_type" // UnsupportedResponseType is returned when the authorization server does not support obtaining an authorization code using this method. UnsupportedResponseType ErrorCode = "unsupported_response_type" // ServerError is returned when the Authorization Server encounters an unexpected condition that prevents it from fulfilling the request.