-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove callback to Delta to check the token, validate it locally
- Loading branch information
Simon Dumas
committed
Oct 6, 2023
1 parent
c1d5d65
commit 68a81c1
Showing
37 changed files
with
622 additions
and
617 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
2 changes: 1 addition & 1 deletion
2
...elta/sdk/identities/model/AuthToken.scala → ...in/nexus/delta/kernel/jwt/AuthToken.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
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
55 changes: 55 additions & 0 deletions
55
delta/kernel/src/main/scala/ch/epfl/bluebrain/nexus/delta/kernel/jwt/TokenRejection.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,55 @@ | ||
package ch.epfl.bluebrain.nexus.delta.kernel.jwt | ||
|
||
/** | ||
* Enumeration of token rejections. | ||
* | ||
* @param reason | ||
* a descriptive message for reasons why a token is rejected by the system | ||
*/ | ||
// $COVERAGE-OFF$ | ||
sealed abstract class TokenRejection(reason: String) extends Exception with Product with Serializable { | ||
override def fillInStackTrace(): Throwable = this | ||
override def getMessage: String = reason | ||
} | ||
|
||
object TokenRejection { | ||
|
||
/** | ||
* Rejection for cases where the AccessToken is not a properly formatted signed JWT. | ||
*/ | ||
final case class InvalidAccessTokenFormat(details: String) | ||
extends TokenRejection( | ||
s"Access token is invalid; possible causes are: JWT not signed, encoded parts are not properly encoded or each part is not a valid json, details: '$details'" | ||
) | ||
|
||
/** | ||
* Rejection for cases where the access token does not contain a subject in the claim set. | ||
*/ | ||
final case object AccessTokenDoesNotContainSubject extends TokenRejection("The token doesn't contain a subject.") | ||
|
||
/** | ||
* Rejection for cases where the access token does not contain an issuer in the claim set. | ||
*/ | ||
final case object AccessTokenDoesNotContainAnIssuer extends TokenRejection("The token doesn't contain an issuer.") | ||
|
||
/** | ||
* Rejection for cases where the issuer specified in the access token claim set is unknown; also applies to issuers | ||
* of deprecated realms. | ||
*/ | ||
final case object UnknownAccessTokenIssuer extends TokenRejection("The issuer referenced in the token was not found.") | ||
|
||
/** | ||
* Rejection for cases where the access token is invalid according to JWTClaimsVerifier | ||
*/ | ||
final case class InvalidAccessToken(subject: String, issuer: String, details: String) | ||
extends TokenRejection(s"The provided token is invalid for user '$subject/$issuer' .") | ||
|
||
/** | ||
* Rejection for cases where we couldn't fetch the groups from the OIDC provider | ||
*/ | ||
final case class GetGroupsFromOidcError(subject: String, issuer: String) | ||
extends TokenRejection( | ||
"The token is invalid; possible causes are: the OIDC provider is unreachable." | ||
) | ||
} | ||
// $COVERAGE-ON$ |
2 changes: 1 addition & 1 deletion
2
.../delta/sdk/syntax/NonEmptySetSyntax.scala → ...lta/kernel/syntax/NonEmptySetSyntax.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
2 changes: 1 addition & 1 deletion
2
delta/kernel/src/main/scala/ch/epfl/bluebrain/nexus/delta/kernel/syntax/package.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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
package ch.epfl.bluebrain.nexus.delta.kernel | ||
|
||
package object syntax extends KamonSyntax with ClassTagSyntax with IOSyntax with InstantSyntax | ||
package object syntax extends KamonSyntax with ClassTagSyntax with IOSyntax with InstantSyntax with NonEmptySetSyntax |
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
3 changes: 2 additions & 1 deletion
3
delta/sdk/src/main/scala/ch/epfl/bluebrain/nexus/delta/sdk/identities/Identities.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
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.