Created
October 1, 2018 11:35
-
-
Save zeburek/4d27ac363beae579d5aebebc60c99f9b to your computer and use it in GitHub Desktop.
An example of SignatureCalculator for Gatling 2.3.1
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
package test.utils | |
import java.net.URI | |
import test.Test | |
import org.asynchttpclient.{Request, RequestBuilderBase, SignatureCalculator} | |
class HawkAuth extends SignatureCalculator { | |
override def calculateAndAddSignature(request: Request, requestBuilder: RequestBuilderBase[_]): Unit = { | |
val creds = Test.hawk.hawk_creds(Test.sessionToken) | |
val url = request.getUrl | |
val method = request.getMethod | |
val authHeader = Test.hawk.generate_hawk(creds.getId, creds.getKey, new URI(url), method) | |
requestBuilder.setHeader("Authorization", authHeader) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment