Skip to content

Commit

Permalink
Scala 2.12 support: Don't use .toLongOption or .toBooleanOption
Browse files Browse the repository at this point in the history
Revert this when #149
is fixed!
  • Loading branch information
rtyley committed Aug 9, 2024
1 parent f40aa8d commit 998db1f
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import com.gu.pandomainauth.model.{AuthenticatedUser, User}
import com.gu.pandomainauth.service.CookieUtils.CookieIntegrityFailure.{MalformedCookieText, MissingOrMalformedUserData, SignatureNotValid}

import java.security.{PrivateKey, PublicKey}
import scala.util.Try

object CookieUtils {
sealed trait CookieIntegrityFailure
Expand Down Expand Up @@ -38,8 +39,8 @@ object CookieUtils {
email <- data.get("email")
system <- data.get("system")
authedIn <- data.get("authedIn")
expires <- data.get("expires").flatMap(_.toLongOption)
multiFactor <- data.get("multifactor").flatMap(_.toBooleanOption)
expires <- data.get("expires").flatMap(text => Try(text.toLong).toOption)
multiFactor <- data.get("multifactor").flatMap(text => Try(text.toBoolean).toOption)
} yield AuthenticatedUser(
user = User(firstName, lastName, email, data.get("avatarUrl")),
authenticatingSystem = system,
Expand Down

0 comments on commit 998db1f

Please sign in to comment.