Package it.eng.spagobi.services.cas

Source Code of it.eng.spagobi.services.cas.CasSsoService3NoProxy

/**

SpagoBI - The Business Intelligence Free Platform

Copyright (C) 2005-2008 Engineering Ingegneria Informatica S.p.A.

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

**/
package it.eng.spagobi.services.cas;

import it.eng.spago.base.SourceBean;
import it.eng.spago.configuration.ConfigSingleton;
import it.eng.spagobi.services.common.EnginConf;
import it.eng.spagobi.services.common.SsoServiceInterface;
import it.eng.spagobi.services.security.exceptions.SecurityException;

import java.io.IOException;

import javax.portlet.PortletSession;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.apache.log4j.Logger;

import org.jasig.cas.client.authentication.AttributePrincipal;
import org.jasig.cas.client.authentication.AuthenticationFilter;
import org.jasig.cas.client.util.AbstractCasFilter;
import org.jasig.cas.client.validation.Assertion;
import org.jasig.cas.client.validation.Cas20ProxyTicketValidator;
import org.jasig.cas.client.validation.TicketValidationException;



/**
* This class contain the specific code of CAS
*/
public class CasSsoService3NoProxy implements SsoServiceInterface {

    static private Logger logger = Logger.getLogger(CasSsoService3NoProxy.class);
   
    /**
     * Read user id.
     *
     * @param session HttpSession
     *
     * @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 user;
    }
   
    /**
     * Read user id.
     *
     * @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;
    }
   
    /**
     * Get a new ticket.
     *
     * @param session HttpSession
     *
     * @return String
     *
     * @throws IOException Signals that an I/O exception has occurred.
     */
    public String readTicket(HttpSession session) throws IOException{
      logger.debug("IN");
      logger.debug("OUT. No ticket ");
      return "";
    }

    /**
     * This method verify the ticket.
     *
     * @param ticket String, ticket to validate
     * @param userId String, user id
     *
     * @return String
     *
     * @throws SecurityException the security exception
     */
    public void validateTicket(String ticket, String userId)throws SecurityException {
  logger.debug("IN");


    }

}
TOP

Related Classes of it.eng.spagobi.services.cas.CasSsoService3NoProxy

TOP
Copyright © 2018 www.massapi.com. 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.