本文整理汇总了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);
}
}
示例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();
}
示例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);
}
示例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());
}
示例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();
}