//*********************************************************************
// Utility methods
private String getAuthenticatedNetid(String ticket)
throws ParserConfigurationException, SAXException, IOException, JspTagException {
ProxyTicketValidator pv = new ProxyTicketValidator();
pv.setCasValidateUrl(casValidate);
pv.setServiceTicket(ticket);
pv.setService(service);
pv.validate();
if (!pv.isAuthenticationSuccesful())
throw new JspTagException(
"CAS authentication error: " + pv.getErrorCode());
if (pv.getProxyList().size() != 0) {
// ticket was proxied
if (acceptedProxies.size() == 0)
throw new JspTagException("this page does not accept proxied tickets");
else if (!acceptedProxies.contains(pv.getProxyList().get(0)))
throw new JspTagException(
"unauthorized top-level proxy: '" + pv.getProxyList().get(0) + "'");
}
return pv.getUser();
}