aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/xyz/driver/core/rest.scala
diff options
context:
space:
mode:
authorZach Smith <zach@driver.xyz>2017-05-24 17:10:24 -0700
committerZach Smith <zach@driver.xyz>2017-05-24 17:10:24 -0700
commit5d3de80a62fcf4cebec7d87cc3ef503d40c30b5a (patch)
tree664bb207b6243c81bcf5703157c6717977993e7f /src/main/scala/xyz/driver/core/rest.scala
parent763e68cb1140ed8b1d0bbbeccec45debce3a66b1 (diff)
downloaddriver-core-5d3de80a62fcf4cebec7d87cc3ef503d40c30b5a.tar.gz
driver-core-5d3de80a62fcf4cebec7d87cc3ef503d40c30b5a.tar.bz2
driver-core-5d3de80a62fcf4cebec7d87cc3ef503d40c30b5a.zip
Change to lazy loading public key
Diffstat (limited to 'src/main/scala/xyz/driver/core/rest.scala')
-rw-r--r--src/main/scala/xyz/driver/core/rest.scala4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/main/scala/xyz/driver/core/rest.scala b/src/main/scala/xyz/driver/core/rest.scala
index 2ff8ae8..1db9d09 100644
--- a/src/main/scala/xyz/driver/core/rest.scala
+++ b/src/main/scala/xyz/driver/core/rest.scala
@@ -180,7 +180,7 @@ package rest {
Future.successful(AuthorizationResult(authorized = true, ctx.permissionsToken))
}
- class CachedTokenAuthorization[U <: User](publicKey: PublicKey, issuer: String) extends Authorization[U] {
+ class CachedTokenAuthorization[U <: User](publicKey: => PublicKey, issuer: String) extends Authorization[U] {
override def userHasPermissions(user: U, permissions: Seq[Permission])(
implicit ctx: ServiceRequestContext): Future[AuthorizationResult] = {
import spray.json._
@@ -213,7 +213,7 @@ package rest {
object CachedTokenAuthorization {
def apply[U <: User](publicKeyFile: Path, issuer: String): CachedTokenAuthorization[U] = {
- val publicKey: PublicKey = {
+ lazy val publicKey: PublicKey = {
val publicKeyBytes = Files.readAllBytes(publicKeyFile)
val spec = new X509EncodedKeySpec(publicKeyBytes)
KeyFactory.getInstance("RSA").generatePublic(spec)