Skip to content

Commit

Permalink
fix #2008
Browse files Browse the repository at this point in the history
  • Loading branch information
mathieuancelin committed Oct 14, 2024
1 parent 1e7148a commit 6693ca0
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions otoroshi/app/gateway/handlers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ object GatewayRequestHandler {
val u: Future[Option[PrivateAppsUser]] = auth match {
case _: SamlAuthModuleConfig =>
request.cookies
.find(c => c.name.startsWith("oto-papps-"))
.find(c => c.name.startsWith(s"oto-papps-${auth.cookieSuffix(routeLegacy)}"))
.flatMap(env.extractPrivateSessionId)
.map {
env.datastores.privateAppsUserDataStore.findById(_)
Expand All @@ -190,9 +190,11 @@ object GatewayRequestHandler {
case Right(value) =>
value match {
case None => {
val cookieOpt = request.cookies.find(c => c.name.startsWith("oto-papps-"))
val cookieOpt = request.cookies.find(c => c.name.startsWith(s"oto-papps-${auth.cookieSuffix(routeLegacy)}"))
cookieOpt.flatMap(env.extractPrivateSessionId).map { id =>
env.datastores.privateAppsUserDataStore.findById(id).map(_.foreach(_.delete()))
env.datastores.privateAppsUserDataStore.findById(id).map { user =>
user.foreach(_.delete())
}
}
val finalRedirect =
req.getQueryString("redirect").getOrElse(s"${req.theProtocol}://${req.theHost}")
Expand All @@ -205,7 +207,7 @@ object GatewayRequestHandler {
.discardingCookies(env.removePrivateSessionCookies(req.theHost, routeLegacy, auth): _*)
}
case Some(logoutUrl) => {
val cookieOpt = request.cookies.find(c => c.name.startsWith("oto-papps-"))
val cookieOpt = request.cookies.find(c => c.name.startsWith(s"oto-papps-${auth.cookieSuffix(routeLegacy)}"))
cookieOpt.flatMap(env.extractPrivateSessionId).map { id =>
env.datastores.privateAppsUserDataStore.findById(id).map(_.foreach(_.delete()))
}
Expand Down

0 comments on commit 6693ca0

Please sign in to comment.