use of org.jasig.cas.client.validation.Cas20ProxyTicketValidator in project ddf by codice.
the class CasProxyTicketValidator method setCasServerUrl.
public void setCasServerUrl(String serverUrl) {
proxyTicketValidator = new Cas20ProxyTicketValidator(PropertyResolver.resolveProperties(serverUrl));
proxyTicketValidator.setProxyCallbackUrl(proxyCallbackUrl.getResolvedString());
proxyTicketValidator.setAcceptAnyProxy(acceptAnyProxy);
proxyTicketValidator.setProxyGrantingTicketStorage(proxyGrantingTicketStorage);
}
use of org.jasig.cas.client.validation.Cas20ProxyTicketValidator in project ddf by codice.
the class WebSSOTokenValidator method validate.
/**
* Validate the CAS ticket and service
*
* @param ticket
* @param service
* @return
* @throws TicketValidationException
*/
public Assertion validate(String ticket, String service) throws TicketValidationException {
LOGGER.trace("CAS Server URL = {}", casServerUrl);
Cas20ProxyTicketValidator casValidator = new Cas20ProxyTicketValidator(casServerUrl.getResolvedString());
casValidator.setAcceptAnyProxy(true);
return casValidator.validate(ticket, service);
}
use of org.jasig.cas.client.validation.Cas20ProxyTicketValidator in project mycore by MyCoRe-Org.
the class MCRCASServlet method doGetPost.
public void doGetPost(MCRServletJob job) throws Exception {
HttpServletRequest req = job.getRequest();
HttpServletResponse res = job.getResponse();
String ticket = req.getParameter("ticket");
if ((ticket == null) || (ticket.trim().length() == 0)) {
res.sendError(HttpServletResponse.SC_BAD_REQUEST);
return;
}
// Validate ticket at CAS server
Cas20ProxyTicketValidator sv = new Cas20ProxyTicketValidator(serverURL);
sv.setAcceptAnyProxy(true);
Assertion a = sv.validate(ticket, clientURL);
AttributePrincipal principal = a.getPrincipal();
// Get user name logged in
String userName = principal.getName();
LOGGER.info("Login {}", userName);
MCRUser user;
boolean userExists = MCRUserManager.exists(userName, realmID);
if (userExists)
user = MCRUserManager.getUser(userName, realmID);
else
user = new MCRUser(userName, realmID);
// Get user properties from LDAP server
boolean userChanged = MCRLDAPClient.instance().updateUserProperties(user);
if (userChanged && userExists) {
MCRUserManager.updateUser(user);
}
// Store login user in session and redirect browser to target url
MCRSessionMgr.getCurrentSession().setUserInformation(user);
// MCR-1154
req.changeSessionId();
MCRLoginServlet.redirect(res);
}
Aggregations