Skip to content

Commit c4c1a62

Browse files
committed
server: respond 401 for unknown tokens
1 parent d9bba20 commit c4c1a62

File tree

1 file changed

+4
-1
lines changed
  • server/src/main/kotlin/cloud/skadi/gist/routing

1 file changed

+4
-1
lines changed

server/src/main/kotlin/cloud/skadi/gist/routing/Gist.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,11 @@ fun Application.configureGistRoutes(
4242
else
4343
null
4444

45-
if (token != null && user == null)
45+
if (token != null && user == null) {
4646
log.warn("Can't find user by token ($token)")
47+
call.respond(HttpStatusCode.Unauthorized, "Token expired")
48+
return@post
49+
}
4750

4851
val (name, description, visibility, roots) = call.receive<GistCreationRequest>()
4952

0 commit comments

Comments
 (0)