mp
05/18/2018, 1:23 PMvalidate
, but that only applies when a session is present, so it won't get hit on a request with no session or an invalid session cookie. What would be a better place to apply the header that can access call.authentication.principal()
or equivalent, yet will also get called on requests without sessions, etc?Deactivated User
05/18/2018, 1:28 PMmp
05/18/2018, 1:34 PMval session = call.sessions.get<T>()
val principal = session?.let { provider.validator(call, it) }
mp
05/18/2018, 1:35 PMmp
05/18/2018, 1:36 PMX-authn-state = true
if you have a cookie that maps to a valid session that maps to a valid user, and X-authn-state = false
in all other casesmp
05/18/2018, 1:39 PMsession
like so:
session<ApiSessionData>("name of optional auth") {
validate(closureThatReturnsNullablePrincipal)
challenge = SessionAuthChallenge.Ignore
}
Deactivated User
05/18/2018, 1:50 PMmp
05/18/2018, 1:51 PM