gitbucket
f46f5909f1b6
(refs #1554)Enable DB session for plugin git repo authentication
Naoki Takezoe
3 days ago

49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
} } 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) account <- authenticate(settings, username, password) } yield { request.setAttribute(Keys.Request.UserName, account.userName) account }
val account = for { auth <- Option(request.getHeader("Authorization")) Array(username, password) = AuthUtil.decodeAuthHeader(auth).split(":", 2) account <- authenticate(settings, username, password) } yield { request.setAttribute(Keys.Request.UserName, account.userName) account } if(filter.filter(request.gitRepositoryPath, account.map(_.userName), settings, isUpdating)){ chain.doFilter(request, response) } else { AuthUtil.requireAuth(response)
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 = {
About FluentSend Feedback