当前位置: 首页>>代码示例>>Java>>正文


Java AbstractCasFilter类代码示例

本文整理汇总了Java中org.jasig.cas.client.util.AbstractCasFilter的典型用法代码示例。如果您正苦于以下问题:Java AbstractCasFilter类的具体用法?Java AbstractCasFilter怎么用?Java AbstractCasFilter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


AbstractCasFilter类属于org.jasig.cas.client.util包,在下文中一共展示了AbstractCasFilter类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: retrievePrincipalFromSessionOrRequest

import org.jasig.cas.client.util.AbstractCasFilter; //导入依赖的package包/类
/**
 * Crea principal a traves de la request
 */
protected CasPrincipal retrievePrincipalFromSessionOrRequest(final ServletRequest servletRequest) {
    final HttpServletRequest request = (HttpServletRequest) servletRequest;
    final HttpSession session = request.getSession(false);
    final Assertion assertion = (Assertion) (session == null ? request.getAttribute(AbstractCasFilter.CONST_CAS_ASSERTION) : session.getAttribute(AbstractCasFilter.CONST_CAS_ASSERTION));
    
    if (assertion == null){
    	return null;
    }else{
    	List<String> roles = new ArrayList<String>();
    	String apellidosNombre,nif,listaRoles;
    	char metodoAutenticacion;
    	
    	// Recuperamos info de CAS
    	AttributePrincipal ap = assertion.getPrincipal();
    	apellidosNombre = (String) ap.getAttributes().get(this.nombreAttribute);
    	nif = (String) ap.getAttributes().get(this.nifAttribute);
    	metodoAutenticacion = ((String) ap.getAttributes().get(this.metodoAutenticacionAttribute)).charAt(0);
    	
    	// Obtenemos lista de roles
    	if (this.rolesAttribute.equals("INTERNAL")){
    		// Roles no est�n centralizados en CAS. Los obtenemos del autenticador.
    		roles = autenticador.obtenerRoles(props,ap.getName());
    		
    	}else{
    		// Roles centralizados en CAS
    		listaRoles = (String) ap.getAttributes().get(this.rolesAttribute);
        	if (listaRoles != null && listaRoles.length() > 0){
	        	String[] rs = listaRoles.split(":");        	
	        	for (int i=0;i<rs.length;i++){
	        		roles.add(rs[i]);
	        	}
        	}
    	}
    	
    	return new CasPrincipal(ap.getName(),apellidosNombre,nif,metodoAutenticacion,roles);
    	
    }
    
}
 
开发者ID:GovernIB,项目名称:sistra,代码行数:43,代码来源:CasAuthenticationFilter.java

示例2: get_CAS_userId

import org.jasig.cas.client.util.AbstractCasFilter; //导入依赖的package包/类
static String get_CAS_userId(HttpServletRequest request) {
    HttpSession session = request.getSession(false);
    Assertion assertion = (Assertion) (session == null ? request
                                       .getAttribute(AbstractCasFilter.CONST_CAS_ASSERTION) : session
                                       .getAttribute(AbstractCasFilter.CONST_CAS_ASSERTION));
    return assertion == null ? null : assertion.getPrincipal().getName();
}
 
开发者ID:EsupPortail,项目名称:EsupUserApps,代码行数:8,代码来源:Utils.java

示例3: doFilter

import org.jasig.cas.client.util.AbstractCasFilter; //导入依赖的package包/类
public void doFilter(ServletRequest request, ServletResponse response,FilterChain filterChain) throws IOException, ServletException {
	HttpSession session = ((HttpServletRequest) request).getSession();
	Boolean isSessionLoaded = (Boolean) session.getAttribute(WebSSOConstants.IS_SESSION_ATTRIBUTES_LOADED);
	if (null == isSessionLoaded || isSessionLoaded == Boolean.FALSE) {
		Assertion assertion = (Assertion) session.getAttribute(AbstractCasFilter.CONST_CAS_ASSERTION);
		AttributePrincipal attributePrincipal = assertion.getPrincipal();
		String attributesString = attributePrincipal.getName();
		log.debug("User Principal retrived from WebSSO-server:  "+attributesString);
		loadSessionAttributes(attributesString,session);
		session.setAttribute(WebSSOConstants.IS_SESSION_ATTRIBUTES_LOADED, Boolean.TRUE);			
	}
	filterChain.doFilter(request, response);
}
 
开发者ID:NCIP,项目名称:cagrid-core,代码行数:14,代码来源:CaGridWebSSOAttributeLoaderFilter.java

示例4: testAssertion

import org.jasig.cas.client.util.AbstractCasFilter; //导入依赖的package包/类
@Test
public void testAssertion() throws Exception {
    session.setAttribute(AbstractCasFilter.CONST_CAS_ASSERTION, new AssertionImpl("test"));
    this.filter.doFilter(request, response, filterChain);

    assertNull(response.getRedirectedUrl());
}
 
开发者ID:NCIP,项目名称:caarray,代码行数:8,代码来源:CasAuthenticationFilterTest.java

示例5: retrievePrincipalFromSessionOrRequest

import org.jasig.cas.client.util.AbstractCasFilter; //导入依赖的package包/类
protected Principal retrievePrincipalFromSessionOrRequest(ServletRequest servletRequest) {
	final HttpServletRequest request = (HttpServletRequest) servletRequest;
       final HttpSession session = request.getSession(false);
       final Assertion assertion = (Assertion) (session == null ? request.getAttribute(AbstractCasFilter.CONST_CAS_ASSERTION) : session.getAttribute(AbstractCasFilter.CONST_CAS_ASSERTION));
       return assertion == null ? null : assertion.getPrincipal();
}
 
开发者ID:GovernIB,项目名称:helium,代码行数:7,代码来源:HttpServletRequestWrapperFilter.java


注:本文中的org.jasig.cas.client.util.AbstractCasFilter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。