当前位置: 首页>>代码示例>>Java>>正文


Java SecurityContextHolderAwareRequestWrapper类代码示例

本文整理汇总了Java中org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestWrapper的典型用法代码示例。如果您正苦于以下问题:Java SecurityContextHolderAwareRequestWrapper类的具体用法?Java SecurityContextHolderAwareRequestWrapper怎么用?Java SecurityContextHolderAwareRequestWrapper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SecurityContextHolderAwareRequestWrapper类属于org.springframework.security.web.servletapi包,在下文中一共展示了SecurityContextHolderAwareRequestWrapper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: plagicojInspecctionResultList

import org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestWrapper; //导入依赖的package包/类
@RequestMapping(value = "/plagicoj/plagicojinspectionresultlist.xhtml")
public String plagicojInspecctionResultList(SecurityContextHolderAwareRequestWrapper requestWrapper, Model model, Principal principal,
        @RequestParam(required = false, value = "vid") String vid) {

    int countDictums = plagiCOJDAO.countDictums(submitId1, submitId2, submitIdRangeStart, submitIdRangeEnd, problemId,onlyAC,matchLanguage,ownSubmission,sameUser);        
    
    loadParameters(requestWrapper);

    if (buildNavigating(countDictums, 50, "", getNumber(), model) != 0) {
        top = getNumber() - 1;            
        top*=50;            
    }
    
    resultList = plagiCOJDAO.getDictums(submitId1, submitId2, submitIdRangeStart, submitIdRangeEnd, problemId, onlyAC,matchLanguage,ownSubmission,sameUser,top,50);
    
    if (!resultList.isEmpty()){            
        maximumPageDictum = getNumber() == 1?1.0:resultList.get(0).getDictum();
        minimumPageDictum = resultList.size() < 50?0.0:resultList.get(resultList.size() - 1).getDictum();
    }
    
    model.addAttribute(
            "resultsList", resultList);
    return "/plagicoj/plagicojinspectionresultlist";
}
 
开发者ID:dovier,项目名称:coj-web,代码行数:25,代码来源:PlagiCojController.java

示例2: loadParameters

import org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestWrapper; //导入依赖的package包/类
private void loadParameters(SecurityContextHolderAwareRequestWrapper requestWrapper) {
    orderby = requestWrapper.getParameter("orderby");
    setInv(0);
    try {
        setInv((int) new Integer(requestWrapper.getParameter("inv")));
    } catch (Exception e) {
    }
    int pos = 1;
    try {
        pos = new Integer(requestWrapper.getParameter("vid"));
        if (pos <= 0) {
            pos = 1;
        }
    } catch (Exception ex) {
    }

    if (requestWrapper.getParameter("mrnav") != null) {
        setMrNumber(pos);
    } else if (requestWrapper.getParameter("mcnav") != null) {
        setMcNumber(pos);
    } else {
        setNumber(pos);
    }
}
 
开发者ID:dovier,项目名称:coj-web,代码行数:25,代码来源:PlagiCojController.java

示例3: manageProblemI18N

import org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestWrapper; //导入依赖的package包/类
@RequestMapping(value = "/manageproblemI18N.xhtml", method = RequestMethod.POST)
public String manageProblemI18N(Model model, SecurityContextHolderAwareRequestWrapper requestWrapper, Principal principal, HttpServletRequest request, Problem problem, BindingResult result) {
    Integer uid = problemDAO.integer("select.uid.by.username", getUsername(principal));
    if (!(requestWrapper.isUserInRole(Roles.ROLE_ADMIN) || requestWrapper.isUserInRole(Roles.ROLE_SUPER_PSETTER) || (problemDAO.bool("is.psetter.problem", uid, problem.getPid()) && requestWrapper
            .isUserInRole(Roles.ROLE_PSETTER)))) {
        return "/admin/adminproblems";
    }

    if (result.hasErrors()) {
        model.addAttribute(problem);
        return "/admin/manageproblemI18N";
    }

    problemDAO.updateProblemI18N(problem);

    problemDAO.log("editing problem I18N " + problem.getPid(), getUsername(principal));
    return "redirect:/24h/problem.xhtml?pid=" + problem.getPid();
}
 
开发者ID:dovier,项目名称:coj-web,代码行数:19,代码来源:ProblemController.java

示例4: BestSolutions

import org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestWrapper; //导入依赖的package包/类
@RequestMapping(value = "/24h/bestsolutions.xhtml", method = RequestMethod.GET)
public String BestSolutions(Locale locale, Principal principal,
		SecurityContextHolderAwareRequestWrapper requestWrapper,
		PagingOptions options, Model model, @RequestParam Integer pid) {
	Problem problem = problemDAO.getStatistics(locale.getLanguage(), pid);
	if (requestWrapper.isUserInRole(Roles.ROLE_USER)) {
		int uid = submissionDAO.integer("select.uid.by.username",
				getUsername(principal));
		problem.setSolved(problemDAO.bool("issolved.byuser", uid,
				problem.getPid()));
		if (problem.isSolved()) {
			problem.setLocked(problemDAO.isLocked(uid, problem.getPid()));
		}
	}
	model.addAttribute("problem", problem);
	return "/24h/bestsolutions";
}
 
开发者ID:dovier,项目名称:coj-web,代码行数:18,代码来源:SubmissionController.java

示例5: testBestSolutions

import org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestWrapper; //导入依赖的package包/类
@RequestMapping(value = "/tables/bestsolutions.xhtml", method = RequestMethod.GET)
public String testBestSolutions(Locale locale, Principal principal,
		SecurityContextHolderAwareRequestWrapper requestWrapper,
		PagingOptions options, Model model, @RequestParam Integer pid) {
	Problem problem = problemDAO.getStatistics(locale.getLanguage(), pid);
	if (requestWrapper.isUserInRole(Roles.ROLE_USER)) {
		int uid = submissionDAO.integer("select.uid.by.username",
				getUsername(principal));
		problem.setSolved(problemDAO.bool("issolved.byuser", uid,
				problem.getPid()));
		if (problem.isSolved()) {
			problem.setLocked(problemDAO.isLocked(uid, problem.getPid()));
		}
	}
	int found = submissionDAO.countBestSolutions(pid);
	if (found != 0) {

		IPaginatedList<SubmissionJudge> submissions = submissionDAO
				.bestSolutions(pid, found, options, requestWrapper, problem);

		model.addAttribute("submissions", submissions);

	}
	return "/tables/bestsolutions";
}
 
开发者ID:dovier,项目名称:coj-web,代码行数:26,代码来源:SubmissionController.java

示例6: SourceView

import org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestWrapper; //导入依赖的package包/类
@RequestMapping(value = "/24h/submission.xhtml", method = RequestMethod.GET)
public String SourceView(Principal principal,
		SecurityContextHolderAwareRequestWrapper requestWrapper,
		Model model, @RequestParam("id") Integer id) {
	try {
		if (!canAccessSubmission(principal, requestWrapper, id)) {
			return "/error/cancel";
		} else {
			SubmissionJudge submission = submissionDAO.getSourceCode(id);
			int uid = submissionDAO.integer("select.uid.by.username",
					getUsername(principal));
			if (!requestWrapper.isUserInRole(Roles.ROLE_ADMIN)
					&& !(submission.getUsername()
							.equals(getUsername(principal)))
					&& !(problemDAO.bool("issolved.byuser", uid,
							submission.getPid()) && problemDAO.isLocked(
							uid, submission.getPid()))) {
				throw new EmptyResultDataAccessException(0);
			}
			model.addAttribute("submission", submission);
		}
	} catch (EmptyResultDataAccessException ex) {
		return "/error/accessdenied";
	}
	return "/24h/submission";
}
 
开发者ID:dovier,项目名称:coj-web,代码行数:27,代码来源:SubmissionController.java

示例7: contestAwards

import org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestWrapper; //导入依赖的package包/类
@RequestMapping(value = "/contest/cawards.xhtml", method = RequestMethod.GET)
public String contestAwards(Model model, SecurityContextHolderAwareRequestWrapper requestWrapper, Locale locale, @RequestParam("cid") Integer cid) {

	Contest contest = contestDAO.loadContest(cid);
	List<Problem> problems = problemDAO.getContestProblems(locale.getLanguage(), cid);
	IACMScoreboard iacmscoreboard = contestDAO.getRankingAcm(cid, null, false, problems);
	List<User> users = iacmscoreboard.assignMedals(contest);

	model.addAttribute("cid", cid);
	model.addAttribute("users", users);

	if (!contest.isPast()) {
		return "/error/accessdenied";
	}
	model.addAttribute("contest", contest);
	awards(model, cid);
	return "/contest/cawards";
}
 
开发者ID:dovier,项目名称:coj-web,代码行数:19,代码来源:ContestScoreboardsController.java

示例8: tablesContestProblems

import org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestWrapper; //导入依赖的package包/类
@RequestMapping(value = "/tables/cproblems.xhtml", method = RequestMethod.GET)
public String tablesContestProblems(Locale locale,Model model, SecurityContextHolderAwareRequestWrapper requestWrapper,Principal principal, PagingOptions options, @RequestParam("cid") Integer cid) {
    String username = getUsername(principal);
    Contest contest = contestDAO.loadContest(cid);
    contestDAO.unfreezeIfNecessary(contest);
    model.addAttribute("contest", contest);
    if (contest.isRunning() || contest.isPast()) {
        contest.setShow_status(false);
        if (contest.isShow_problem_out() || (username != null && hasAnyPrivileges(requestWrapper,Roles.ROLE_ADMIN,Roles.ROLE_SUPER_PSETTER,Roles.ROLE_PSETTER)) || (!contest.isShow_problem_out() && username != null && contestDAO.isInContest(cid, contestDAO.integer("select.uid.by.username", username)))) {
            contest.setShow_status(true);
            int found = problemDAO.countProblemContest(cid);
            if (found > 0) {
                model.addAttribute("problems", problemDAO.getContestProblems(found,locale.getLanguage(),username, contest, options));
            }
        }
    }
    
    return "/tables/cproblems";
}
 
开发者ID:dovier,项目名称:coj-web,代码行数:20,代码来源:ContestProblemController.java

示例9: doFilter

import org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestWrapper; //导入依赖的package包/类
@Override
public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain)
        throws IOException, ServletException {

    if (request instanceof SecurityContextHolderAwareRequestWrapper) {
        boolean isMustChangePassword =
                SecurityContextHolder.getContext().getAuthentication().getAuthorities().stream().anyMatch(
                        authority -> StandardEntitlement.MUST_CHANGE_PASSWORD.equals(authority.getAuthority()));

        SecurityContextHolderAwareRequestWrapper wrapper =
                SecurityContextHolderAwareRequestWrapper.class.cast(request);
        if (isMustChangePassword && "GET".equalsIgnoreCase(wrapper.getMethod())
                && !ArrayUtils.contains(ALLOWED, wrapper.getPathInfo())) {

            throw new AccessDeniedException("Please change your password first");
        }
    }

    chain.doFilter(request, response);
}
 
开发者ID:apache,项目名称:syncope,代码行数:21,代码来源:MustChangePasswordFilter.java

示例10: sourceCodeDetectorResult

import org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestWrapper; //导入依赖的package包/类
@RequestMapping(value = "/plagicoj/sourcecodedetectorresult.xhtml", method = RequestMethod.GET)
public String sourceCodeDetectorResult(SecurityContextHolderAwareRequestWrapper requestWrapper, Model model, Principal principal,
        @RequestParam(required = true, value = "ssid") Integer sourceSubmissionx,
        @RequestParam(required = true, value = "dsid") Integer destinationSubmissiony) {
            
        SubmissionJudge sourceSubmission = plagiCOJDAO.getSubmissions(sourceSubmissionx.toString(), null, null, null, null, false, null, null, principal != null, requestWrapper.isUserInRole("ROLE_ADMIN"), getUsername(principal), false).get(0);
        SubmissionJudge destinationSubmission = plagiCOJDAO.getSubmissions(destinationSubmissiony.toString(), null, null, null, null, false, null, null, principal != null, requestWrapper.isUserInRole("ROLE_ADMIN"), getUsername(principal), false).get(0);
    
        SourceCode source = new SourceCode(sourceSubmission.getCode(),cu.uci.plagicoj.utils.Language.valueOf(formatLanguageCode(sourceSubmission.getLang())));
        SourceCode destination = new SourceCode(destinationSubmission.getCode(),cu.uci.plagicoj.utils.Language.valueOf(formatLanguageCode(destinationSubmission.getLang())));
    
        Detector stringTilingDetector = new StringTilingDetector(source,destination);        
        
        cu.uci.plagicoj.PlagiCOJ plagiCOJ = cu.uci.plagicoj.PlagiCOJ.create(stringTilingDetector);        
        cu.uci.plagicoj.PlagiCOJResult plagiCOJResult = plagiCOJ.detectPlagiarism();
        
        SourceCodeDetectorResult detectorResult = (SourceCodeDetectorResult) plagiCOJResult.getDetectorResults().get(0);
        
        model.addAttribute("matches", detectorResult.getMatches());
        model.addAttribute("sourceTokens", detectorResult.getSourceTokens());
        model.addAttribute("destinationTokens", detectorResult.getDestinationTokens());

        model.addAttribute("judgesRevisions", plagiCOJDAO.getPlagiCOJDetectorResultJudgeRevisions(sourceSubmissionx, destinationSubmissiony, PlagiCOJDetectorType.PlagiCOJStringTilingDetector));
        model.addAttribute("sourceSubmission", sourceSubmission);
        model.addAttribute("destinationSubmission", destinationSubmission);
        model.addAttribute("plagiCOJDetectorResult", detectorResult);      
    return "/plagicoj/sourcecodedetectorresult";
}
 
开发者ID:dovier,项目名称:coj-web,代码行数:29,代码来源:PlagiCojController.java

示例11: doContestImages

import org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestWrapper; //导入依赖的package包/类
public String doContestImages(Model model, Principal principal,
        SecurityContextHolderAwareRequestWrapper requestWrapper,
        @RequestParam(value = "cid") Integer cid) {
    Contest contest = new Contest();
    contest.setCid(cid);
    model.addAttribute("contest", contest);
    model.addAttribute("images", utils.getContestImages(cid));
    model.addAttribute("eproblem", withProblems(cid));
    return "/admin/contestimg";
}
 
开发者ID:dovier,项目名称:coj-web,代码行数:11,代码来源:ContestController.java

示例12: contestImages

import org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestWrapper; //导入依赖的package包/类
@RequestMapping(value = "/contestimg.xhtml", method = RequestMethod.POST)
public String contestImages(Model model,
        SecurityContextHolderAwareRequestWrapper requestWrapper,
        Principal principal, Contest contest, HttpServletRequest request,
        BindingResult result, RedirectAttributes redirectAttributes) {

    handleFiles(contest.getCid(), request);

    redirectAttributes.addFlashAttribute("message", Notification.getSuccesfullUpdate());
    return doContestImages(model, principal, requestWrapper,
            contest.getCid());
}
 
开发者ID:dovier,项目名称:coj-web,代码行数:13,代码来源:ContestController.java

示例13: unfreezeContest

import org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestWrapper; //导入依赖的package包/类
@RequestMapping(value = "/unlock.xhtml", method = RequestMethod.GET)
public String unfreezeContest(Model model,
                              SecurityContextHolderAwareRequestWrapper requestWrapper,
                              @RequestParam("cid") Integer cid) throws IOException {
    Contest contest = contestDAO.loadContest(cid);
    if (requestWrapper.isUserInRole(Roles.ROLE_ADMIN) && contest.isPast()) {
        // se cambian las banderas block y unfreeze auto del contest a
        // valores complementarios
        contestDAO.dml("update.freeze.blocked.contest", false, true, cid);
        contestDAO.repointContest(contest, false);
    }
    return "redirect:/contest/cscoreboard.xhtml?cid=" + cid;
}
 
开发者ID:dovier,项目名称:coj-web,代码行数:14,代码来源:ContestController.java

示例14: freezeContest

import org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestWrapper; //导入依赖的package包/类
@RequestMapping(value = "/lock.xhtml", method = RequestMethod.GET)
public String freezeContest(Model model,
                            SecurityContextHolderAwareRequestWrapper requestWrapper,
                            @RequestParam("cid") Integer cid) throws IOException {
    Contest contest = contestDAO.loadContest(cid);
    if (requestWrapper.isUserInRole(Roles.ROLE_ADMIN) && contest.isPast()) {
        // se cambian las banderas block y unfreeze auto del contest a
        // valores complementarios
        contestDAO.freezeContest(contest);
    }
    return "redirect:/contest/cscoreboard.xhtml?cid=" + cid;
}
 
开发者ID:dovier,项目名称:coj-web,代码行数:13,代码来源:ContestController.java

示例15: JudgementsTable

import org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestWrapper; //导入依赖的package包/类
@RequestMapping(value = "/tables/status.xhtml", method = RequestMethod.GET)
public String JudgementsTable(
		Principal principal,
		Model model,
		SecurityContextHolderAwareRequestWrapper requestWrapper,
		PagingOptions options,
		@RequestParam(required = false, value = "username") String filter_user,
		@RequestParam(required = false, value = "pid") Integer pid,
		@RequestParam(required = false, value = "status") String status,
		@RequestParam(required = false, value = "planguage") String language) {
           
	String lang = submissionDAO.string(
			"select language from language where key=?", language);
	int found = submissionDAO.countSubmissions(filter_user, lang, pid,
			Config.getProperty("judge.status." + status));
	if (found != 0) {
		IPaginatedList<SubmissionJudge> submissions = submissionDAO
				.getSubmissions(filter_user, found, lang, pid,
						Config.getProperty("judge.status." + status),
						options, principal != null,
						requestWrapper.isUserInRole(Roles.ROLE_ADMIN),
						principal == null ? null : getUsername(principal));

		model.addAttribute("submissions", submissions);
	}
	return "/tables/status";
}
 
开发者ID:dovier,项目名称:coj-web,代码行数:28,代码来源:SubmissionController.java


注:本文中的org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestWrapper类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。