From 06c960958774dcbc0b9e01cab6c5a89e4f77b150 Mon Sep 17 00:00:00 2001 From: KOUNOIKE Date: Sat, 2 Mar 2019 15:35:38 +0900 Subject: [PATCH] add parameter style token authentication --- .../scala/gitbucket/core/servlet/ApiAuthenticationFilter.scala | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/scala/gitbucket/core/servlet/ApiAuthenticationFilter.scala b/src/main/scala/gitbucket/core/servlet/ApiAuthenticationFilter.scala index 4576b0c89..6ab4226ec 100644 --- a/src/main/scala/gitbucket/core/servlet/ApiAuthenticationFilter.scala +++ b/src/main/scala/gitbucket/core/servlet/ApiAuthenticationFilter.scala @@ -25,6 +25,9 @@ class ApiAuthenticationFilter extends Filter with AccessTokenService with Accoun case auth if auth.startsWith("Basic ") => doBasicAuth(auth, loadSystemSettings(), request).toRight(()) case _ => Left(()) } + .orElse { + Option(req.getParameter("access_token")).map(AccessTokenService.getAccountByAccessToken(_).toRight(())) + } .orElse { Option(request.getSession.getAttribute(Keys.Session.LoginAccount).asInstanceOf[Account]).map(Right(_)) } match {