1
|
package eu.dnetlib.validator.admin.actions.login;
|
2
|
|
3
|
import java.util.Map;
|
4
|
|
5
|
import com.opensymphony.xwork2.Action;
|
6
|
import com.opensymphony.xwork2.ActionInvocation;
|
7
|
import com.opensymphony.xwork2.interceptor.Interceptor;
|
8
|
|
9
|
import eu.dnetlib.validator.admin.configs.Constants;
|
10
|
|
11
|
public class AuthenticationInterceptor implements Interceptor {
|
12
|
|
13
|
private static final long serialVersionUID = 977098762082596481L;
|
14
|
|
15
|
@Override
|
16
|
public void destroy() {
|
17
|
|
18
|
}
|
19
|
|
20
|
@Override
|
21
|
public void init() {
|
22
|
|
23
|
}
|
24
|
|
25
|
@Override
|
26
|
public String intercept(ActionInvocation actionInvocation) throws Exception {
|
27
|
Map<String, Object> session = actionInvocation.getInvocationContext().getSession();
|
28
|
String auth = (String) session.get(Constants.loggedInField);
|
29
|
|
30
|
if (auth == null) {
|
31
|
return Action.LOGIN;
|
32
|
}
|
33
|
return actionInvocation.invoke();
|
34
|
}
|
35
|
}
|