mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-06 15:15:58 +00:00
Fixing http redirect status codes
This commit is contained in:
parent
468ba90158
commit
28fdeb5a93
@ -54,7 +54,7 @@ object CodeFlowRoutes {
|
|||||||
logger.debug(
|
logger.debug(
|
||||||
s"Redirecting to OAuth/OIDC provider ${cfg.providerId.id}: ${uri.asString}"
|
s"Redirecting to OAuth/OIDC provider ${cfg.providerId.id}: ${uri.asString}"
|
||||||
) *>
|
) *>
|
||||||
SeeOther().map(_.withHeaders(Location(Uri.unsafeFromString(uri.asString))))
|
Found(Location(Uri.unsafeFromString(uri.asString)))
|
||||||
case None =>
|
case None =>
|
||||||
logger.debug(s"No OAuth/OIDC provider found with id '$id'") *>
|
logger.debug(s"No OAuth/OIDC provider found with id '$id'") *>
|
||||||
NotFound()
|
NotFound()
|
||||||
|
@ -57,7 +57,7 @@ object OpenId {
|
|||||||
logger.warn(
|
logger.warn(
|
||||||
s"Can't retrieve user data using collective-key=${cfg.collectiveKey.asString}: $message"
|
s"Can't retrieve user data using collective-key=${cfg.collectiveKey.asString}: $message"
|
||||||
) *>
|
) *>
|
||||||
TemporaryRedirect(location)
|
SeeOther(location)
|
||||||
|
|
||||||
case ExtractResult.Account(accountId) =>
|
case ExtractResult.Account(accountId) =>
|
||||||
signUpAndLogin[F](backend)(config, accountId, location, baseUrl)
|
signUpAndLogin[F](backend)(config, accountId, location, baseUrl)
|
||||||
@ -68,7 +68,7 @@ object OpenId {
|
|||||||
logger.warn(
|
logger.warn(
|
||||||
s"Can't retrieve user data using user-key=${cfg.userKey}: $message"
|
s"Can't retrieve user data using user-key=${cfg.userKey}: $message"
|
||||||
) *>
|
) *>
|
||||||
TemporaryRedirect(location)
|
SeeOther(location)
|
||||||
|
|
||||||
case ExtractResult.Identifier(name) =>
|
case ExtractResult.Identifier(name) =>
|
||||||
signUpAndLogin[F](backend)(
|
signUpAndLogin[F](backend)(
|
||||||
@ -112,23 +112,23 @@ object OpenId {
|
|||||||
res <- setup match {
|
res <- setup match {
|
||||||
case SignupResult.Failure(ex) =>
|
case SignupResult.Failure(ex) =>
|
||||||
logger.error(ex)(s"Error when creating external account!") *>
|
logger.error(ex)(s"Error when creating external account!") *>
|
||||||
TemporaryRedirect(location)
|
SeeOther(location)
|
||||||
|
|
||||||
case SignupResult.SignupClosed =>
|
case SignupResult.SignupClosed =>
|
||||||
logger.error(s"External accounts don't work when signup is closed!") *>
|
logger.error(s"External accounts don't work when signup is closed!") *>
|
||||||
TemporaryRedirect(location)
|
SeeOther(location)
|
||||||
|
|
||||||
case SignupResult.CollectiveExists =>
|
case SignupResult.CollectiveExists =>
|
||||||
logger.error(
|
logger.error(
|
||||||
s"Error when creating external accounts! Collective exists error reported. This is a bug!"
|
s"Error when creating external accounts! Collective exists error reported. This is a bug!"
|
||||||
) *>
|
) *>
|
||||||
TemporaryRedirect(location)
|
SeeOther(location)
|
||||||
|
|
||||||
case SignupResult.InvalidInvitationKey =>
|
case SignupResult.InvalidInvitationKey =>
|
||||||
logger.error(
|
logger.error(
|
||||||
s"Error when creating external accounts! Invalid invitation key reported. This is a bug!"
|
s"Error when creating external accounts! Invalid invitation key reported. This is a bug!"
|
||||||
) *>
|
) *>
|
||||||
TemporaryRedirect(location)
|
SeeOther(location)
|
||||||
|
|
||||||
case SignupResult.Success =>
|
case SignupResult.Success =>
|
||||||
loginAndVerify(backend, cfg)(accountId, location, baseUrl)
|
loginAndVerify(backend, cfg)(accountId, location, baseUrl)
|
||||||
@ -156,12 +156,12 @@ object OpenId {
|
|||||||
.withQueryParam("auth", session.asString)
|
.withQueryParam("auth", session.asString)
|
||||||
)
|
)
|
||||||
else location
|
else location
|
||||||
TemporaryRedirect(loc)
|
SeeOther(loc)
|
||||||
.map(_.addCookie(CookieData(session).asCookie(baseUrl)))
|
.map(_.addCookie(CookieData(session).asCookie(baseUrl)))
|
||||||
|
|
||||||
case failed =>
|
case failed =>
|
||||||
Logger.log4s(log).error(s"External login failed: $failed") *>
|
Logger.log4s(log).error(s"External login failed: $failed") *>
|
||||||
TemporaryRedirect(location)
|
SeeOther(location)
|
||||||
}
|
}
|
||||||
} yield resp
|
} yield resp
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user