Package org.jasig.cas.client.validation

Examples of org.jasig.cas.client.validation.Assertion


     *
     * @return String
     */
    public String readUserIdentifier(HttpServletRequest request){
    HttpSession session=request.getSession();
    Assertion assertion = (Assertion) session.getAttribute(AbstractCasFilter.CONST_CAS_ASSERTION);
    String userInSession=assertion.getPrincipal().getName();
  //String user=(String)request.getRemoteUser();
  //logger.debug("CAS user in HttpServletRequest:"+user);
  logger.debug("CAS user in HttpSession:"+userInSession);
  return userInSession;
    }
View Full Code Here


     * @param session PortletSession
     *
     * @return String
     */
    public String readUserIdentifier(PortletSession session){
    Assertion assertion = (Assertion) session.getAttribute(AbstractCasFilter.CONST_CAS_ASSERTION);
    String user=assertion.getPrincipal().getName();
  logger.debug("CAS user in PortletSession:"+user);
  return user;
    }
View Full Code Here

      SourceBean sourceBeanConf = (SourceBean) engineConfig.getAttribute("FILTER_RECEIPT");
      String filterReceipt = (String) sourceBeanConf.getCharacters();
      logger.debug("Read filterReceipt=" + filterReceipt);
      filterReceipt = spagoBiServerURL + filterReceipt;
     
      Assertion assertion = (Assertion) session.getAttribute(AbstractCasFilter.CONST_CAS_ASSERTION);
      ticket=assertion.getPrincipal().getProxyTicketFor(filterReceipt);

      logger.debug("OUT.ticket="+ticket);
      return ticket;
    }
View Full Code Here

  try {
    AttributePrincipal principal = null;
    Cas20ProxyTicketValidator sv = new Cas20ProxyTicketValidator(validateUrl);
    sv.setAcceptAnyProxy(true);

      Assertion a = sv.validate(ticket, validateService);
    principal = a.getPrincipal();
    logger.debug("Ticket is VALID, username=" + principal.getName());
     
  } catch (TicketValidationException e) {
    logger.error("An exception occured while validating the cas token");
    throw new SecurityException("An exception occured while validating the cas token", e);
View Full Code Here

    Cas20ProxyTicketValidator ticketValidator = new Cas20ProxyTicketValidator(casServerUrl);
      ticketValidator.setRenew(this.renewTicket);
     
      //String serviceUrl = "http://"+ httpRequest.getServerName() +":" + httpRequest.getServerPort() +
      //httpRequest.getContextPath() +"/private/classic";
      Assertion assertion = ticketValidator.validate(ticket, this.casServiceUrl);
     
      log.debug("------------------------------------------------------------------------------------");
      log.debug("Service: "+this.casServiceUrl);
      log.debug("Principal: "+assertion.getPrincipal().getName());
      log.debug("------------------------------------------------------------------------------------");

      String principal = assertion.getPrincipal().getName();
       this.saveSSOCredentials(principal, httpRequest);
  }   
View Full Code Here

        return result;
    }

    private CasAuthenticationToken authenticateNow(final Authentication authentication) throws AuthenticationException {
        try {
            final Assertion assertion = this.ticketValidator.validate(authentication.getCredentials().toString(), serviceProperties.getService());
            final UserDetails userDetails = loadUserByAssertion(assertion);
            userDetailsChecker.check(userDetails);
            return new CasAuthenticationToken(this.key, userDetails, authentication.getCredentials(), userDetails.getAuthorities(), userDetails, assertion);
        } catch (final TicketValidationException e) {
            throw new BadCredentialsException(e.getMessage(), e);
View Full Code Here

    Cas20ProxyTicketValidator ticketValidator = new Cas20ProxyTicketValidator(casServerUrl);
    ticketValidator.setRenew(this.renewTicket);
   
    String serviceUrl = "http://"+ httpRequest.getServerName() +":" + httpRequest.getServerPort() +
    httpRequest.getContextPath() +"/private/classic";
    Assertion assertion = ticketValidator.validate(ticket, serviceUrl);
   
    log.debug("------------------------------------------------------------------------------------");
    log.debug("Service: "+serviceUrl);
    log.debug("Principal: "+assertion.getPrincipal().getName());
    log.debug("------------------------------------------------------------------------------------");
   
       
    //Use empty password....it shouldn't be needed...this is a SSO login. The password has
    //already been presented with the SSO server. It should not be passed around for
    //better security
    Credentials credentials = new Credentials(assertion.getPrincipal().getName(), "");
    httpRequest.getSession().setAttribute(GenericSSOAgent.CREDENTIALS, credentials);       
  }   
View Full Code Here

            LoginReason.OK.stampRequestResponse(request, response);
            return existingUser;
        }

        final HttpSession session = request.getSession();
        final Assertion assertion = (Assertion) session.getAttribute(AbstractCasFilter.CONST_CAS_ASSERTION);

        if (assertion != null) {
            final String username = assertion.getPrincipal().getName();
            final Principal user = getUser(username);
            final String remoteIP = request.getRemoteAddr();
            final String remoteHost = request.getRemoteHost();

            if (user != null) {
View Full Code Here

        if (session.getAttribute(LOGGED_IN_KEY) != null) {
            LOGGER.debug("Session found; user already logged in.");
            return (Principal) session.getAttribute(LOGGED_IN_KEY);
        }

        final Assertion assertion = (Assertion) session.getAttribute(AbstractCasFilter.CONST_CAS_ASSERTION);

        if (assertion != null) {
            final Principal p = getUser(assertion.getPrincipal().getName());

            LOGGER.debug("Logging in [{}] from CAS.", p.getName());

            session.setAttribute(LOGGED_IN_KEY, p);
            session.setAttribute(LOGGED_OUT_KEY, null);
View Full Code Here

        if (existingUser != null) {
            LOGGER.debug("Session found; user already logged in.");
        }

        final HttpSession session = request.getSession();
        final Assertion assertion = (Assertion) session.getAttribute(AbstractCasFilter.CONST_CAS_ASSERTION);

        if (assertion != null) {
            final String username = assertion.getPrincipal().getName();
            final Principal user = getUser(username);

            if (user != null) {
                putPrincipalInSessionContext(request, user);
                getElevatedSecurityGuard().onSuccessfulLoginAttempt(request, username);
View Full Code Here

TOP

Related Classes of org.jasig.cas.client.validation.Assertion

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.