0.1.1
Added JwtResponseHelper
trait to make it easier to sign Play responses with refreshed self-authenticated JWTs. For simplicity you might want to add a ConfiguredJwtResponseHelper
to your project to adjust the helper to your needs
Example of a ConfiguredJwtResponseHelper
that logs failed token generation:
trait ConfiguredJwtResponseHelper
extends JwtResponseHelper
with ResponseHelpers {
protected def logger: HostContextLogger
import io.toolsplus.atlassian.connect.play.api.models.AtlassianHostUser.Implicits._
def withJwtHeader(result: Result)(
implicit hostUser: AtlassianHostUser): Result = {
withJwtResponseHeader(result) match {
case Right(signedResult) => signedResult
case Left(error) =>
logger.error(
s"Failed to generate self-authenticated JWT: ${error.getMessage}")
internalServerError("Failed to generate self-authenticated JWT")
}
}
}