Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Key rotation in Panda #143

Open
rtyley opened this issue May 21, 2024 · 0 comments
Open

Key rotation in Panda #143

rtyley opened this issue May 21, 2024 · 0 comments

Comments

@rtyley
Copy link
Member

rtyley commented May 21, 2024

This is mainly notes for Roberto, feel free to ignore:

def readAuthenticatedUser(request: RequestHeader): Option[AuthenticatedUser] = readCookie(request) map { cookie =>
CookieUtils.parseCookieData(cookie.cookie.value, settings.publicKey)
}
def readCookie(request: RequestHeader): Option[PandomainCookie] = {
request.cookies.get(settings.cookieSettings.cookieName).map { cookie =>
val forceExpiry = request.cookies.get(FORCE_EXPIRY_KEY).exists(_.value != "0")
PandomainCookie(cookie, forceExpiry)
}
}
def generateCookie(authedUser: AuthenticatedUser): Cookie =
Cookie(
name = settings.cookieSettings.cookieName,
value = CookieUtils.generateCookieData(authedUser, settings.privateKey),
domain = Some(domain),
secure = true,
httpOnly = true
)

There can be two PanDomainAuthSettingsRefresher instances in a single project:

https://github.com/guardian/login.gutools/blob/31f80134fb99b020acfa2d3196171ad549365082/app/AppComponents.scala#L14-L31

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant