This repository has been archived by the owner on Sep 27, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Refactored rejection and error handling * Updated iam client to discriminate between 401 and 403 * Updated identity regexes to accept any scheme * Removed endpoint env
- Loading branch information
1 parent
239482f
commit 9e2435c
Showing
36 changed files
with
706 additions
and
649 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
client/src/main/scala/ch/epfl/bluebrain/nexus/iam/client/IamClientError.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package ch.epfl.bluebrain.nexus.iam.client | ||
import akka.http.scaladsl.model.StatusCode | ||
|
||
import scala.reflect.ClassTag | ||
|
||
@SuppressWarnings(Array("IncorrectlyNamedExceptions")) | ||
sealed abstract class IamClientError(val message: String) extends Exception { | ||
override def fillInStackTrace(): IamClientError = this | ||
override val getMessage: String = message | ||
} | ||
|
||
@SuppressWarnings(Array("IncorrectlyNamedExceptions")) | ||
object IamClientError { | ||
|
||
final case class Unauthorized(entityAsString: String) | ||
extends IamClientError("The request did not complete successfully due to an invalid authentication method.") | ||
|
||
final case class Forbidden(entityAsString: String) | ||
extends IamClientError("The request did not complete successfully due to lack of access to the resource.") | ||
|
||
final case class UnmarshallingError[A: ClassTag](reason: String) | ||
extends IamClientError( | ||
s"Unable to parse or decode the response from IAM to a '${implicitly[ClassTag[A]]}' due to '$reason'.") | ||
|
||
final case class UnknownError(status: StatusCode, entityAsString: String) | ||
extends IamClientError("The request did not complete successfully.") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.