List of usage examples for org.springframework.web.context.request ServletRequestAttributes getRequest
public final HttpServletRequest getRequest()
From source file:org.egov.infra.config.security.authentication.provider.ApplicationAuthenticationProvider.java
private Authentication unlockAccount(Authentication authentication, LockedException le) { ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder .currentRequestAttributes(); HttpServletRequest request = attributes.getRequest(); if (isNotBlank(request.getParameter(RECAPTCHA_RESPONSE)) || isNotBlank(request.getParameter(J_CAPTCHA_RESPONSE))) { if (recaptchaUtils.captchaIsValid(request)) { loginAttemptService.resetFailedAttempt(authentication.getName()); return super.authenticate(authentication); } else {/*from w w w. j a va 2s. c om*/ throw new LockedException(format(INVALID_CAPTCHA_MSG_FORMAT, le.getMessage())); } } throw le; }
From source file:org.orcid.core.manager.impl.ValidationManagerForLegacyApiVersionsImpl.java
@Override protected void doSchemaValidation(OrcidMessage orcidMessage) { // Hack to support legacy API versions RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes(); if (requestAttributes instanceof ServletRequestAttributes) { ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) requestAttributes; String contentType = servletRequestAttributes.getRequest().getContentType(); if (!StringUtils.containsIgnoreCase(contentType, "json")) { super.doSchemaValidation(orcidMessage); }//from w w w. j a v a 2 s .c o m } else { super.doSchemaValidation(orcidMessage); } }