-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update the authentication process for remote storages #4241
Update the authentication process for remote storages #4241
Conversation
...orage/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/storage/StoragePluginModule.scala
Outdated
Show resolved
Hide resolved
delta/sdk/src/main/scala/ch/epfl/bluebrain/nexus/delta/sdk/auth/AuthTokenProvider.scala
Outdated
Show resolved
Hide resolved
delta/sdk/src/main/scala/ch/epfl/bluebrain/nexus/delta/sdk/auth/AuthenticateAs.scala
Outdated
Show resolved
Hide resolved
delta/sdk/src/main/scala/ch/epfl/bluebrain/nexus/delta/sdk/auth/AuthTokenProvider.scala
Outdated
Show resolved
Hide resolved
delta/kernel/src/main/scala/ch/epfl/bluebrain/nexus/delta/kernel/cache/KeyValueStore.scala
Outdated
Show resolved
Hide resolved
delta/sdk/src/main/scala/ch/epfl/bluebrain/nexus/delta/sdk/auth/AuthTokenProvider.scala
Outdated
Show resolved
Hide resolved
delta/sdk/src/main/scala/ch/epfl/bluebrain/nexus/delta/sdk/auth/KeycloakAuthService.scala
Outdated
Show resolved
Hide resolved
Encoder.AsObject.instance[TokenError] { | ||
case TokenHttpError(r) => | ||
JsonObject(keywords.tpe := "TokenHttpError", "reason" := r.reason) | ||
case TokenNotFoundInResponse(r) => | ||
JsonObject(keywords.tpe -> "TokenNotFoundInResponse".asJson, "reason" := r.message) | ||
case ExpiryNotFoundInResponse(r) => | ||
JsonObject(keywords.tpe -> "ExpiryNotFoundInResponse".asJson, "reason" := r.message) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried semi-automatic derivation, but the error messages are bad and I couldn't see the problem
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean ?
Also if you only use the message/reason from DecodingFailure
/ HttpClientError
because it is what we are interested in here, you should not run into this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When using semi-automatic derivation for an Encoder[TokenError], there were errors which were unclear. I tried changing some obvious things, but could not fix the issue. I noticed that we had used this method elsewhere in the codebase, so I did that.
delta/sdk/src/main/scala/ch/epfl/bluebrain/nexus/delta/sdk/auth/AuthTokenProvider.scala
Show resolved
Hide resolved
@@ -146,8 +147,12 @@ class StoragePluginModule(priority: Int) extends ModuleDef { | |||
|
|||
many[ResourceShift[_, _, _]].ref[Storage.Shift] | |||
|
|||
make[AuthTokenProvider].from { (cfg: StorageTypeConfig) => | |||
AuthTokenProvider(cfg) | |||
make[KeycloakAuthService].from { (httpClient: HttpClient @Id("storage"), realms: Realms, clock: Clock[UIO]) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to go in sdk
and use the same http client as Identities
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see any modules inside of sdk? Also it's using the config from the storage part
delta/kernel/src/main/scala/ch/epfl/bluebrain/nexus/delta/kernel/cache/KeyValueStore.scala
Outdated
Show resolved
Hide resolved
delta/sdk/src/main/scala/ch/epfl/bluebrain/nexus/delta/sdk/auth/AuthTokenProvider.scala
Outdated
Show resolved
Hide resolved
delta/sdk/src/main/scala/ch/epfl/bluebrain/nexus/delta/sdk/auth/AuthenticateAs.scala
Outdated
Show resolved
Hide resolved
delta/sdk/src/main/scala/ch/epfl/bluebrain/nexus/delta/sdk/auth/AuthenticateAs.scala
Outdated
Show resolved
Hide resolved
delta/sdk/src/main/scala/ch/epfl/bluebrain/nexus/delta/sdk/auth/AuthTokenProvider.scala
Outdated
Show resolved
Hide resolved
delta/sdk/src/main/scala/ch/epfl/bluebrain/nexus/delta/sdk/auth/KeycloakAuthService.scala
Outdated
Show resolved
Hide resolved
delta/sdk/src/main/scala/ch/epfl/bluebrain/nexus/delta/sdk/auth/AuthTokenProvider.scala
Outdated
Show resolved
Hide resolved
case class Credentials(user: String, password: Secret[String], realm: Label) extends AuthMethod | ||
object Credentials { | ||
@nowarn("cat=unused") | ||
implicit private val labelConfigReader: ConfigReader[Label] = ConfigReader.fromString(str => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't already have one for Label ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we do I don't know where it is
delta/sdk/src/main/scala/ch/epfl/bluebrain/nexus/delta/sdk/auth/Credentials.scala
Outdated
Show resolved
Hide resolved
delta/sdk/src/main/scala/ch/epfl/bluebrain/nexus/delta/sdk/auth/Credentials.scala
Outdated
Show resolved
Hide resolved
delta/sdk/src/main/scala/ch/epfl/bluebrain/nexus/delta/sdk/auth/Credentials.scala
Outdated
Show resolved
Hide resolved
delta/sdk/src/main/scala/ch/epfl/bluebrain/nexus/delta/sdk/auth/AuthTokenProvider.scala
Outdated
Show resolved
Hide resolved
...e/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/storage/storages/StoragesConfig.scala
Outdated
Show resolved
Hide resolved
delta/sdk/src/main/scala/ch/epfl/bluebrain/nexus/delta/sdk/auth/AuthTokenProvider.scala
Show resolved
Hide resolved
delta/sdk/src/main/scala/ch/epfl/bluebrain/nexus/delta/sdk/auth/KeycloakAuthService.scala
Outdated
Show resolved
Hide resolved
delta/sdk/src/main/scala/ch/epfl/bluebrain/nexus/delta/sdk/auth/KeycloakAuthService.scala
Outdated
Show resolved
Hide resolved
...orage/src/main/scala/ch/epfl/bluebrain/nexus/delta/plugins/storage/StoragePluginModule.scala
Outdated
Show resolved
Hide resolved
delta/sdk/src/main/scala/ch/epfl/bluebrain/nexus/delta/sdk/auth/AuthTokenProvider.scala
Outdated
Show resolved
Hide resolved
delta/sdk/src/main/scala/ch/epfl/bluebrain/nexus/delta/sdk/auth/AuthTokenProvider.scala
Show resolved
Hide resolved
delta/sdk/src/main/scala/ch/epfl/bluebrain/nexus/delta/sdk/auth/AuthTokenProvider.scala
Outdated
Show resolved
Hide resolved
delta/sdk/src/main/scala/ch/epfl/bluebrain/nexus/delta/sdk/auth/AuthTokenProvider.scala
Outdated
Show resolved
Hide resolved
delta/sdk/src/main/scala/ch/epfl/bluebrain/nexus/delta/sdk/auth/AuthTokenProvider.scala
Outdated
Show resolved
Hide resolved
delta/sdk/src/main/scala/ch/epfl/bluebrain/nexus/delta/sdk/auth/OpenIdAuthService.scala
Outdated
Show resolved
Hide resolved
delta/sdk/src/main/scala/ch/epfl/bluebrain/nexus/delta/sdk/error/AuthTokenError.scala
Show resolved
Hide resolved
docs/src/main/paradox/docs/getting-started/running-nexus/configuration/index.md
Outdated
Show resolved
Hide resolved
delta/sdk/src/main/scala/ch/epfl/bluebrain/nexus/delta/sdk/auth/OpenIdAuthService.scala
Outdated
Show resolved
Hide resolved
@@ -114,6 +114,41 @@ Storages can no longer be created with credentials that would get stored: | |||
|
|||
These should instead be defined in the Delta configuration. | |||
|
|||
#### Remote storages |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To put in the storages page and a link here to the chapter in the storage page
Fixes #4063
Remaining tasks: