return Authentication.SEND_CONTINUE; } catch (IOException e) { throw new ServerAuthException(e);
private void sendChallenge(HttpServletResponse response, String token) throws ServerAuthException { try { setSpnegoToken(response, token); response.sendError(HttpServletResponse.SC_UNAUTHORIZED); } catch (IOException x) { throw new ServerAuthException(x); } }
throw new ServerAuthException(e.getMessage());
throw new ServerAuthException(ioe);
private void redirectToCas( final HttpServletRequest request, final HttpServletResponse response) throws ServerAuthException { try { final String redirectUrl = CommonUtils.constructRedirectUrl( casServerLoginUrl, protocol.getServiceParameterName(), serviceUrl(request, response), renew, false); logger.debug("Redirecting to {}", redirectUrl); response.sendRedirect(redirectUrl); } catch (IOException e) { logger.debug("Redirect to CAS failed with error", e); throw new ServerAuthException("Redirect to CAS failed", e); } } }
@Override public Authentication validateRequest(ServletRequest request, ServletResponse response, boolean mandatory) throws ServerAuthException { final Authentication computedAuth = super.validateRequest(request, response, mandatory); try { return sendChallengeIfNecessary(computedAuth, request, response); } catch (IOException e) { throw new ServerAuthException(e); } }
@Override public Authentication validateRequest(ServletRequest request, ServletResponse response, boolean mandatory) throws ServerAuthException { final Authentication computedAuth = super.validateRequest(request, response, mandatory); try { return sendChallengeIfNecessary(computedAuth, request, response); } catch (IOException e) { throw new ServerAuthException(e); } }
public boolean secureResponse(JaspiMessageInfo messageInfo, Authentication validatedUser) throws ServerAuthException { try { String authContextId = _authConfig.getAuthContextID(messageInfo); ServerAuthContext authContext = _authConfig.getAuthContext(authContextId, _serviceSubject, _authProperties); // TODO // authContext.cleanSubject(messageInfo,validatedUser.getUserIdentity().getSubject()); AuthStatus status = authContext.secureResponse(messageInfo, _serviceSubject); return (AuthStatus.SEND_SUCCESS.equals(status)); } catch (AuthException e) { throw new ServerAuthException(e); } }
public boolean secureResponse(JaspiMessageInfo messageInfo, Authentication validatedUser) throws ServerAuthException { try { String authContextId = _authConfig.getAuthContextID(messageInfo); ServerAuthContext authContext = _authConfig.getAuthContext(authContextId, _serviceSubject, _authProperties); // TODO // authContext.cleanSubject(messageInfo,validatedUser.getUserIdentity().getSubject()); AuthStatus status = authContext.secureResponse(messageInfo, _serviceSubject); return (AuthStatus.SEND_SUCCESS.equals(status)); } catch (AuthException e) { throw new ServerAuthException(e); } }
public boolean secureResponse(JaspiMessageInfo messageInfo, Authentication validatedUser) throws ServerAuthException { try { String authContextId = _authConfig.getAuthContextID(messageInfo); ServerAuthContext authContext = _authConfig.getAuthContext(authContextId, _serviceSubject, _authProperties); // TODO // authContext.cleanSubject(messageInfo,validatedUser.getUserIdentity().getSubject()); AuthStatus status = authContext.secureResponse(messageInfo, _serviceSubject); return (AuthStatus.SEND_SUCCESS.equals(status)); } catch (AuthException e) { throw new ServerAuthException(e); } }
return Authentication.SEND_CONTINUE; } catch (IOException e) { throw new ServerAuthException(e);
throw new ServerAuthException(ioe);
@Override public Authentication validateRequest( final ServletRequest servletRequest, final ServletResponse servletResponse, final boolean mandatory) throws ServerAuthException { final HttpServletRequest request = (HttpServletRequest) servletRequest; final HttpServletResponse response = (HttpServletResponse) servletResponse; CasAuthentication authentication = fetchCachedAuthentication(request); if (authentication != null) { return authentication; } final String ticket = request.getParameter(protocol.getArtifactParameterName()); if (ticket != null && mandatory) { try { logger.debug("Attempting to validate {}", ticket); final Assertion assertion = ticketValidator.validate(ticket, serviceUrl(request, response)); logger.info("Successfully authenticated {}", assertion.getPrincipal()); authentication = new CasAuthentication(this, ticket, assertion); cacheAuthentication(request, authentication); } catch (Exception e) { throw new ServerAuthException("CAS ticket validation failed", e); } } if (authentication != null) { return authentication; } else if (mandatory) { redirectToCas(request, response); return Authentication.SEND_CONTINUE; } return Authentication.UNAUTHENTICATED; }
throw new ServerAuthException(ioe);
throw new ServerAuthException(ioe);