Example #1
0
 protected void initializeCas20Protocol(final WebContext context) {
   this.ticketValidator = new Cas20ServiceTicketValidator(this.casPrefixUrl);
   final Cas20ServiceTicketValidator cas20ServiceTicketValidator =
       (Cas20ServiceTicketValidator) this.ticketValidator;
   cas20ServiceTicketValidator.setEncoding(this.encoding);
   if (this.casProxyReceptor != null) {
     cas20ServiceTicketValidator.setProxyCallbackUrl(
         this.casProxyReceptor.computeFinalCallbackUrl(context));
     cas20ServiceTicketValidator.setProxyGrantingTicketStorage(
         this.casProxyReceptor.getProxyGrantingTicketStorage());
   }
 }
 private AuthenticationInfo getUserFromTicket(
     String ticket, String serviceUrl, HttpServletRequest request) {
   AuthenticationInfo authnInfo = null;
   Cas20ServiceTicketValidator sv = new Cas20ServiceTicketValidator(casServerUrl);
   try {
     Assertion a = sv.validate(ticket, serviceUrl);
     request.getSession().setAttribute(CONST_CAS_ASSERTION, a);
     authnInfo = createAuthnInfo(a);
   } catch (TicketValidationException e) {
     LOGGER.error(e.getMessage());
   }
   return authnInfo;
 }
Example #3
0
 @Override
 protected void internalInit() {
   CommonHelper.assertNotBlank("callbackUrl", this.callbackUrl);
   CommonHelper.assertNotNull("logoutHandler", this.logoutHandler);
   if (CommonHelper.isBlank(this.casLoginUrl) && CommonHelper.isBlank(this.casPrefixUrl)) {
     throw new TechnicalException("casLoginUrl and casPrefixUrl cannot be both blank");
   }
   if (this.casPrefixUrl != null && !this.casPrefixUrl.endsWith("/")) {
     this.casPrefixUrl += "/";
   }
   if (CommonHelper.isBlank(this.casPrefixUrl)) {
     this.casPrefixUrl = this.casLoginUrl.replaceFirst("/login", "/");
   } else if (CommonHelper.isBlank(this.casLoginUrl)) {
     this.casLoginUrl = this.casPrefixUrl + "login";
   }
   if (this.casProtocol == CasProtocol.CAS10) {
     this.ticketValidator = new Cas10TicketValidator(this.casPrefixUrl);
   } else if (this.casProtocol == CasProtocol.CAS20) {
     this.ticketValidator = new Cas20ServiceTicketValidator(this.casPrefixUrl);
     if (this.casProxyReceptor != null) {
       final Cas20ServiceTicketValidator cas20ServiceTicketValidator =
           (Cas20ServiceTicketValidator) this.ticketValidator;
       cas20ServiceTicketValidator.setProxyCallbackUrl(this.casProxyReceptor.getCallbackUrl());
       cas20ServiceTicketValidator.setProxyGrantingTicketStorage(
           this.casProxyReceptor.getProxyGrantingTicketStorage());
     }
   } else if (this.casProtocol == CasProtocol.CAS20_PROXY) {
     this.ticketValidator = new Cas20ProxyTicketValidator(this.casPrefixUrl);
     final Cas20ProxyTicketValidator cas20ProxyTicketValidator =
         (Cas20ProxyTicketValidator) this.ticketValidator;
     cas20ProxyTicketValidator.setAcceptAnyProxy(this.acceptAnyProxy);
     cas20ProxyTicketValidator.setAllowedProxyChains(this.allowedProxyChains);
     if (this.casProxyReceptor != null) {
       cas20ProxyTicketValidator.setProxyCallbackUrl(this.casProxyReceptor.getCallbackUrl());
       cas20ProxyTicketValidator.setProxyGrantingTicketStorage(
           this.casProxyReceptor.getProxyGrantingTicketStorage());
     }
   } else if (this.casProtocol == CasProtocol.SAML) {
     this.ticketValidator = new Saml11TicketValidator(this.casPrefixUrl);
   }
 }