Commit bda62e5e authored by Spiros Koulouzis's avatar Spiros Koulouzis

Added PermissionEvaluator

parent 7b97e40b
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
package nl.uva.sne.drip.api.auth; package nl.uva.sne.drip.api.auth;
import java.io.Serializable; import java.io.Serializable;
import nl.uva.sne.drip.commons.v1.types.User;
import org.springframework.security.access.PermissionEvaluator; import org.springframework.security.access.PermissionEvaluator;
import org.springframework.security.core.Authentication; import org.springframework.security.core.Authentication;
...@@ -30,7 +31,15 @@ public class PermissionEvaluatorImp implements PermissionEvaluator { ...@@ -30,7 +31,15 @@ public class PermissionEvaluatorImp implements PermissionEvaluator {
if (!a.isAuthenticated()) { if (!a.isAuthenticated()) {
return false; return false;
} }
if (!(a.getPrincipal() instanceof User)) {
return false; return false;
} else {
User user = (User) a.getPrincipal();
return true;
}
// return false;
} }
@Override @Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment