JAX-RS SecurityContext returns ODLPrincipal when method getPrincipal() is called on SecurityContext.
Method getPrincipal() is returning object of type Principal.
Now we currently cannot cast this object to ODLPrincipal as ClassCastException is thrown,
that makes this completely unusable when using SecurityContext.
Principal.getName() is not providing enough information as it just returns toString() by default.
Signed-off-by: Peter Puškár <ppuskar@frinx.io>
Change-Id: Id17d3b6859732a61de9be48a7b46775c13de6f27
package org.opendaylight.aaa.api.shiro.principal;
+import java.security.Principal;
import java.util.Set;
/**
* Principal for authentication.
*/
-public interface ODLPrincipal {
+public interface ODLPrincipal extends Principal {
/**
* Extract username that is making the request.
public Set<String> getRoles() {
return this.roles;
}
+
+ @Override
+ public String getName() {
+ return getUserId();
+ }
}