Skip to content

Commit 18dd08e

Browse files
committed
auth check endpoint
1 parent 7ee2476 commit 18dd08e

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

app/controllers/Auth.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,10 @@ final class Auth(env: Env, accountC: => Account) extends LilaController(env):
487487
Firewall:
488488
consumingToken(token) { authenticateUser(_, remember = true, pwned = IsPwned.No) }
489489

490+
def check = OpenOrScoped() { ctx ?=>
491+
if ctx.isAuth then NoContent else Unauthorized
492+
}
493+
490494
private def consumingToken(token: String)(f: UserModel => Fu[Result])(using Context) =
491495
env.security.loginToken
492496
.consume(token)

conf/routes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,7 @@ POST /auth/token/:token controllers.Auth.loginWithTokenPost(token
584584
GET /auth/magic-link controllers.Auth.magicLink
585585
POST /auth/magic-link/send controllers.Auth.magicLinkApply
586586
GET /auth/magic-link/sent controllers.Auth.magicLinkSent
587+
GET /auth/check controllers.Auth.check
587588

588589
# Mod
589590
POST /mod/:username/alt/:v controllers.Mod.alt(username: UserStr, v: Boolean)

0 commit comments

Comments
 (0)