/**
*
*/
package com.wondersgroup.extjs.interceptor;
import java.util.Map;
import com.opensymphony.xwork.ActionInvocation;
import com.opensymphony.xwork.interceptor.Interceptor;
/**
* @author liudd
*
*/
public class AuthInterceptor extends AbstractAuthInterceptor {
private static final long serialVersionUID = 2297582260061457542L;
// 定义 result type : 无权限
private static final String UNAUTHORIZED = "unauthorized";
/* (non-Javadoc)
* @see com.wondersgroup.extjs.interceptor.AbstractAuthInterceptor#isAuthorized(com.opensymphony.xwork.ActionInvocation)
*/
@Override
public boolean isAuthorized(ActionInvocation invocation) throws Exception {
boolean isAuthorized = true;
Map session = invocation.getInvocationContext().getSession();
if ((String) session.get("chatName") == null)
isAuthorized = false;
return isAuthorized;
}
/* (non-Javadoc)
* @see com.wondersgroup.extjs.interceptor.AbstractAuthInterceptor#unauthorizedHandler(com.opensymphony.xwork.ActionInvocation)
*/
@Override
public String unauthorizedHandler(ActionInvocation invocation)
throws Exception {
return UNAUTHORIZED;
}
}