Skip to content

Instantly share code, notes, and snippets.

@dilnei
Created September 29, 2016 19:35
Show Gist options
  • Save dilnei/9f39daf6015ef995b6aca587c02fbcca to your computer and use it in GitHub Desktop.
Save dilnei/9f39daf6015ef995b6aca587c02fbcca to your computer and use it in GitHub Desktop.
workaround to Principals
import java.security.Principal;
public class PlainRolePrincipal implements Principal {
String roleName;
public PlainRolePrincipal(String name) {
roleName = name;
}
public String getName() {
return roleName;
}
public String toString() {
return ("RolePrincipal: " + roleName);
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof PlainRolePrincipal) {
PlainRolePrincipal other = (PlainRolePrincipal) obj;
return roleName.equals(other.roleName);
}
return false;
}
public int hashCode() {
return roleName.hashCode();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment