Skip to content

Commit

Permalink
added StoreTokenBucketError
Browse files Browse the repository at this point in the history
  • Loading branch information
AsterITA committed Sep 21, 2023
1 parent 1a65060 commit f8995cf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,10 @@ import it.pagopa.interop.authorizationmanagement.client.model._
import it.pagopa.interop.authorizationserver.api.AuthApiService
import it.pagopa.interop.authorizationserver.common.ApplicationConfiguration
import it.pagopa.interop.authorizationserver.common.ApplicationConfiguration.jwtFallbackBucketPath
import it.pagopa.interop.authorizationserver.error.AuthServerErrors.ClientAssertionValidationWrapper
import it.pagopa.interop.authorizationserver.error.AuthServerErrors.{ClientAssertionValidationWrapper, StoreTokenBucketError}
import it.pagopa.interop.authorizationserver.error.ResponseHandlers._
import it.pagopa.interop.authorizationserver.model.TokenType.Bearer
import it.pagopa.interop.authorizationserver.model.{
ClientAssertionDetails,
ClientCredentialsResponse,
JWTDetailsMessage,
Problem
}
import it.pagopa.interop.authorizationserver.model.{ClientAssertionDetails, ClientCredentialsResponse, JWTDetailsMessage, Problem}
import it.pagopa.interop.authorizationserver.service.{AuthorizationManagementService, QueueService}
import it.pagopa.interop.clientassertionvalidation.Errors.{PurposeIdNotProvided, PurposeNotFound}
import it.pagopa.interop.clientassertionvalidation.Validation._
Expand Down Expand Up @@ -194,9 +189,8 @@ final case class AuthApiServiceImpl(
.storeBytes(jwtFallbackBucketPath, jwtPathInfo.path, jwtPathInfo.filename)(content)
.void
.recoverWith { case storeError =>
val errorMsg = s"Unable to save JWT details to fallback bucket. JWT: $jsonStr"
logger.error(errorMsg, storeError)
Future.failed(new RuntimeException(errorMsg, storeError))
logger.error(s"Unable to save JWT details to fallback bucket. JWT: $jsonStr", storeError)
Future.failed(StoreTokenBucketError(jsonStr))
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ object AuthServerErrors {
final object CreateTokenRequestError
extends ComponentError("0008", s"Unable to generate a token for the given request")

final case class StoreTokenBucketError(jsonStr: String)
extends ComponentError("0009", s"Unable to save JWT details to fallback bucket. JWT: $jsonStr")

final case class KeyNotFound(clientId: UUID, kid: String)
extends ComponentError("0011", s"Key $kid not found for Client $clientId")

}

0 comments on commit f8995cf

Please sign in to comment.