Merge pull request #2277 from kounoike/pr-auth-querystring

add parameter style token authentication
This commit is contained in:
Naoki Takezoe
2019-03-09 11:15:36 +09:00
committed by GitHub

View File

@@ -25,6 +25,9 @@ class ApiAuthenticationFilter extends Filter with AccessTokenService with Accoun
case auth if auth.startsWith("Basic ") => doBasicAuth(auth, loadSystemSettings(), request).toRight(()) case auth if auth.startsWith("Basic ") => doBasicAuth(auth, loadSystemSettings(), request).toRight(())
case _ => Left(()) case _ => Left(())
} }
.orElse {
Option(req.getParameter("access_token")).map(AccessTokenService.getAccountByAccessToken(_).toRight(()))
}
.orElse { .orElse {
Option(request.getSession.getAttribute(Keys.Session.LoginAccount).asInstanceOf[Account]).map(Right(_)) Option(request.getSession.getAttribute(Keys.Session.LoginAccount).asInstanceOf[Account]).map(Right(_))
} match { } match {