markusthoemmes commented on a change in pull request #3788: Store and pass
variant data in AuthKey
URL:
https://github.com/apache/incubator-openwhisk/pull/3788#discussion_r197821706
##########
File path: core/controller/src/main/scala/whisk/core/controller/Triggers.scala
##########
@@ -387,15 +387,17 @@ trait WhiskTriggersApi extends WhiskCollectionAPI {
.map(pkg => Path / pkg.namespace / rule.action.name.asString)
.getOrElse(Path / rule.action.name.asString)
- val request = HttpRequest(
- method = POST,
- uri = url.withPath(actionUrl ++ actionPath),
- headers = List(
- Authorization(BasicHttpCredentials(user.authkey.uuid.asString,
user.authkey.key.asString)),
- transid.toHeader),
- entity = HttpEntity(MediaTypes.`application/json`, args.compactPrint))
+ user.authkey.getCredentials
+ .map { creds =>
+ val request = HttpRequest(
+ method = POST,
+ uri = url.withPath(actionUrl ++ actionPath),
+ headers = List(Authorization(creds), transid.toHeader),
+ entity = HttpEntity(MediaTypes.`application/json`,
args.compactPrint))
- singleRequest(request)
+ singleRequest(request)
+ }
+ .getOrElse(Future.failed(new RuntimeException("invalid credentials
passed")))
Review comment:
Need to think about which exception to throw here and which message to use.
If we need to write it ourselves, let's add it to `Messages.scala`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services