Created
September 29, 2016 19:35
-
-
Save dilnei/9f39daf6015ef995b6aca587c02fbcca to your computer and use it in GitHub Desktop.
workaround to Principals
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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