@Test(expected = AuthenticationException.class) public void testValidateTicketWhenInvalidTicket() throws Exception { context.checking(commonConfigExpectations()); context.checking(new Expectations() { { oneOf(validator).validate(TICKET, SERVICE_URL + REQUEST_PATH); will(throwException(new TicketValidationException("some message"))); } }); authenticator.validateTicket(REQUEST_PATH, PROTOCOL.getTicketParameterName() + "=" + TICKET); }
@Override public IdentityAssertion validateTicket(String requestPath, String queryString) throws NoTicketException, AuthenticationException { String ticket = QueryUtil.findParameter( config.getProtocol().getTicketParameterName(), queryString); if (ticket == null) { throw new NoTicketException(); } try { ticket = URLDecoder.decode(ticket, "UTF-8"); } catch (UnsupportedEncodingException ex) { throw new AuthenticationException("cannot decode ticket", ex); } String serviceUrl = serviceUrl(requestPath, queryString); if (LOGGER.isDebugEnabled()) { LOGGER.debug("validating ticket '" + ticket + "' for service " + serviceUrl); } try { return new JasigIdentityAssertion(this, validator.validate(ticket, serviceUrl), config.getAttributeTransformers()); } catch (TicketValidationException ex) { throw new AuthenticationException(ex.getMessage(), ex); } }
JasigAuthenticator implements Authenticator, Serializable { @Override public IdentityAssertion validateTicket(String requestPath, String queryString) throws NoTicketException, AuthenticationException { String ticket = QueryUtil.findParameter( config.getProtocol().getTicketParameterName(), queryString); if (ticket == null) { throw new NoTicketException(); } try { ticket = URLDecoder.decode(ticket, "UTF-8"); } catch (UnsupportedEncodingException ex) { throw new AuthenticationException("cannot decode ticket", ex); } String serviceUrl = serviceUrl(requestPath, queryString); if (LOGGER.isDebugEnabled()) { LOGGER.debug("validating ticket '" + ticket + "' for service " + serviceUrl); } try { return new JasigIdentityAssertion(this, validator.validate(ticket, serviceUrl), config.getAttributeTransformers()); } catch (TicketValidationException ex) { throw new AuthenticationException(ex.getMessage(), ex); } } }
JasigAuthenticator implements Authenticator, Serializable { @Override public IdentityAssertion validateTicket(String requestPath, String queryString) throws NoTicketException, AuthenticationException { String ticket = QueryUtil.findParameter( config.getProtocol().getTicketParameterName(), queryString); if (ticket == null) { throw new NoTicketException(); } try { ticket = URLDecoder.decode(ticket, "UTF-8"); } catch (UnsupportedEncodingException ex) { throw new AuthenticationException("cannot decode ticket", ex); } String serviceUrl = serviceUrl(requestPath, queryString); if (LOGGER.isDebugEnabled()) { LOGGER.debug("validating ticket '" + ticket + "' for service " + serviceUrl); } try { return new JasigIdentityAssertion(this, validator.validate(ticket, serviceUrl), config.getAttributeTransformers()); } catch (TicketValidationException ex) { throw new AuthenticationException(ex.getMessage(), ex); } } JasigAuthenticator(Configuration config, TicketValidator validator); }
JasigAuthenticator implements Authenticator, Serializable { @Override public IdentityAssertion validateTicket(String requestPath, String queryString) throws NoTicketException, AuthenticationException { String ticket = QueryUtil.findParameter( config.getProtocol().getTicketParameterName(), queryString); if (ticket == null) { throw new NoTicketException(); } try { ticket = URLDecoder.decode(ticket, "UTF-8"); } catch (UnsupportedEncodingException ex) { throw new AuthenticationException("cannot decode ticket", ex); } String serviceUrl = serviceUrl(requestPath, queryString); if (LOGGER.isDebugEnabled()) { LOGGER.debug("validating ticket '" + ticket + "' for service " + serviceUrl); } try { return new JasigIdentityAssertion(this, validator.validate(ticket, serviceUrl), config.getAttributeTransformers()); } catch (TicketValidationException ex) { throw new AuthenticationException(ex.getMessage(), ex); } } JasigAuthenticator(Configuration config, TicketValidator validator); @Override boolean isPostAuthRedirect(); @Override String loginUrl(String requestPath, String queryString); @Override String logoutUrl(String path); @Override IdentityAssertion validateTicket(String requestPath,
      String queryString); @Override String postAuthUrl(String requestUrl, String queryString); }
JasigAuthenticator implements Authenticator, Serializable { @Override public IdentityAssertion validateTicket(String requestPath, String queryString) throws NoTicketException, AuthenticationException { String ticket = QueryUtil.findParameter( config.getProtocol().getTicketParameterName(), queryString); if (ticket == null) { throw new NoTicketException(); } try { ticket = URLDecoder.decode(ticket, "UTF-8"); } catch (UnsupportedEncodingException ex) { throw new AuthenticationException("cannot decode ticket", ex); } String serviceUrl = serviceUrl(requestPath, queryString); if (LOGGER.isDebugEnabled()) { LOGGER.debug("validating ticket '" + ticket + "' for service " + serviceUrl); } try { return new JasigIdentityAssertion(this, validator.validate(ticket, serviceUrl), config.getAttributeTransformers()); } catch (TicketValidationException ex) { throw new AuthenticationException(ex.getMessage(), ex); } } JasigAuthenticator(Configuration config, TicketValidator validator); @Override boolean isPostAuthRedirect(); @Override String loginUrl(String requestPath, String queryString); @Override String logoutUrl(String path); @Override IdentityAssertion validateTicket(String requestPath,
      String queryString); @Override String postAuthUrl(String requestUrl, String queryString); static final String LOGIN_PATH; static final String LOGOUT_PATH; }