feat: finish bilingual session auth learning lab
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
package com.demo.action.interceptor;
|
||||
|
||||
import com.demo.action.LoginAction;
|
||||
import com.opensymphony.xwork2.ActionInvocation;
|
||||
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class AuthInterceptor extends AbstractInterceptor {
|
||||
|
||||
@Override
|
||||
public String intercept(ActionInvocation invocation) throws Exception {
|
||||
Map<String, Object> session = invocation.getInvocationContext().getSession();
|
||||
if (session != null && session.get(LoginAction.SESSION_USER) != null) {
|
||||
return invocation.invoke();
|
||||
}
|
||||
return "login";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user