@Override public Authentication authenticate(HttpServletRequest req, HttpServletResponse rsp, String username, String password) throws IOException, ServletException { if (DISABLE) return null; UsernamePasswordAuthenticationToken authRequest = new UsernamePasswordAuthenticationToken(username, password); authRequest.setDetails(authenticationDetailsSource.buildDetails(req)); try { Authentication a = Jenkins.getInstance().getSecurityRealm().getSecurityComponents().manager.authenticate(authRequest); // Authentication success LOGGER.log(FINER, "Authentication success: {0}", a); return a; } catch (AuthenticationException failed) { // Authentication failed LOGGER.log(FINER, "Authentication request for user: {0} failed: {1}", new Object[]{username,failed}); return null; } }
auth.setDetails(authenticationDetailsSource.buildDetails(request));
/** * Provided so that subclasses may configure what is put into the authentication request's details * property. * * @param request that an authentication request is being created for * @param authRequest the authentication request object that should have its details set */ protected void setDetails(HttpServletRequest request, UsernamePasswordAuthenticationToken authRequest) { authRequest.setDetails(authenticationDetailsSource.buildDetails(request)); } }
public Authentication attemptAuthentication(HttpServletRequest request) throws AuthenticationException { String username = CAS_STATEFUL_IDENTIFIER; String password = request.getParameter("ticket"); if (password == null) { password = ""; } UsernamePasswordAuthenticationToken authRequest = new UsernamePasswordAuthenticationToken(username, password); authRequest.setDetails(authenticationDetailsSource.buildDetails((HttpServletRequest) request)); return this.getAuthenticationManager().authenticate(authRequest); }
protected Authentication createAuthentication(ServletRequest request) { Assert.isInstanceOf(HttpServletRequest.class, request, "ServletRequest must be an instance of HttpServletRequest"); AnonymousAuthenticationToken auth = new AnonymousAuthenticationToken(key, userAttribute.getPassword(), userAttribute.getAuthorities()); auth.setDetails(authenticationDetailsSource.buildDetails((HttpServletRequest) request)); return auth; }
UsernamePasswordAuthenticationToken authRequest = new UsernamePasswordAuthenticationToken(username, password); authRequest.setDetails(authenticationDetailsSource.buildDetails((HttpServletRequest) request));
@Override public Authentication authenticate(HttpServletRequest req, HttpServletResponse rsp, String username, String password) throws IOException, ServletException { if (DISABLE) return null; UsernamePasswordAuthenticationToken authRequest = new UsernamePasswordAuthenticationToken(username, password); authRequest.setDetails(authenticationDetailsSource.buildDetails(req)); try { Authentication a = Jenkins.getInstance().getSecurityRealm().getSecurityComponents().manager.authenticate(authRequest); // Authentication success LOGGER.log(FINER, "Authentication success: {0}", a); return a; } catch (AuthenticationException failed) { // Authentication failed LOGGER.log(FINER, "Authentication request for user: {0} failed: {1}", new Object[]{username,failed}); return null; } }
auth.setDetails(authenticationDetailsSource.buildDetails((HttpServletRequest) request));
targetUserRequest.setDetails(authenticationDetailsSource.buildDetails((HttpServletRequest) request));
X509AuthenticationToken authRequest = new X509AuthenticationToken(clientCertificate); authRequest.setDetails(authenticationDetailsSource.buildDetails((HttpServletRequest) request)); authResult = authenticationManager.authenticate(authRequest); successfulAuthentication(httpRequest, httpResponse, authResult);
user.getPassword()); authRequest.setDetails(authenticationDetailsSource.buildDetails((HttpServletRequest) request));
public void login(Authentication authToken) { HTTPRequestContext httpContext = HTTPRequestContext.get(); HttpServletRequest httpRequest = null; HttpServletResponse httpResponse = null; if (httpContext != null) { httpRequest = httpContext.getRequest(); httpResponse = httpContext.getResponse(); } if ((httpContext != null) && (authToken instanceof AbstractAuthenticationToken)) { ((AbstractAuthenticationToken)authToken).setDetails(authenticationDetailsSource.buildDetails(httpRequest)); } try { Authentication authResult = authenticationManager.authenticate(authToken); SecurityContextHolder.getContext().setAuthentication(authResult); if ((httpContext != null) && (rememberMeServices != null)) { rememberMeServices.loginSuccess(httpRequest, httpResponse, authResult); } } finally { SecurityContextHolder.getContext().setAuthentication(null); if ((httpContext != null) && (rememberMeServices != null)) { rememberMeServices.loginFail(httpRequest, httpResponse); } } }
public void login(Authentication authToken) { HTTPRequestContext httpContext = HTTPRequestContext.get(); HttpServletRequest httpRequest = null; HttpServletResponse httpResponse = null; if (httpContext != null) { httpRequest = httpContext.getRequest(); httpResponse = httpContext.getResponse(); } if ((httpContext != null) && (authToken instanceof AbstractAuthenticationToken)) { ((AbstractAuthenticationToken)authToken).setDetails(authenticationDetailsSource.buildDetails(httpRequest)); } try { Authentication authResult = authenticationManager.authenticate(authToken); SecurityContextHolder.getContext().setAuthentication(authResult); if ((httpContext != null) && (rememberMeServices != null)) { rememberMeServices.loginSuccess(httpRequest, httpResponse, authResult); } } finally { SecurityContextHolder.getContext().setAuthentication(null); if ((httpContext != null) && (rememberMeServices != null)) { rememberMeServices.loginFail(httpRequest, httpResponse); } } }