mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-03 12:05:59 +01:00
(refs #1554)Enable DB session for plugin git repo authentication
This commit is contained in:
@@ -51,8 +51,7 @@ class GitAuthenticationFilter extends Filter with RepositoryService with Account
|
||||
|
||||
private def pluginRepository(request: HttpServletRequest, response: HttpServletResponse, chain: FilterChain,
|
||||
settings: SystemSettings, isUpdating: Boolean, filter: GitRepositoryFilter): Unit = {
|
||||
implicit val r = request
|
||||
|
||||
Database() withSession { implicit session =>
|
||||
val account = for {
|
||||
auth <- Option(request.getHeader("Authorization"))
|
||||
Array(username, password) = AuthUtil.decodeAuthHeader(auth).split(":", 2)
|
||||
@@ -62,12 +61,13 @@ class GitAuthenticationFilter extends Filter with RepositoryService with Account
|
||||
account
|
||||
}
|
||||
|
||||
if(filter.filter(request.gitRepositoryPath, account.map(_.userName), settings, isUpdating)){
|
||||
if (filter.filter(request.gitRepositoryPath, account.map(_.userName), settings, isUpdating)) {
|
||||
chain.doFilter(request, response)
|
||||
} else {
|
||||
AuthUtil.requireAuth(response)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private def defaultRepository(request: HttpServletRequest, response: HttpServletResponse, chain: FilterChain,
|
||||
settings: SystemSettings, isUpdating: Boolean): Unit = {
|
||||
|
||||
Reference in New Issue
Block a user