UnresolvedPrincipalpublic final class UnresolvedPrincipal extends Object implements PrincipalDescriptive implementation of Principal, which holds a name and a classname
of unresolved principal. It is used to define an arbitrary Principal which
may be not yet instantiated and authenticated.
This concept is somewhat similar to UnresolvedPermission. A principal-based
policy may grant permissions depending on what Principals own the current
execution thread. So the policy refers to this model definition of
acceptable principal and compares it with the actual principal. |
Fields Summary |
---|
public static final String | WILDCARDWildcard value denotes any class and/or any name. | private final String | klass | private final String | name |
Constructors Summary |
---|
public UnresolvedPrincipal(String klass, String name)Constructs a a new definition of a Principal with specified
parameters.
if (klass == null || klass.length() == 0) {
throw new IllegalArgumentException(Messages.getString("security.91")); //$NON-NLS-1$
}
this.klass = klass;
this.name = name;
|
Methods Summary |
---|
public boolean | equals(java.lang.Object that)Returns true if compared object is a Principal
matching this definition, or if it is an UnresolvedPrincipal,
which defines the same Principal; false otherwise.
if (that instanceof UnresolvedPrincipal) {
UnresolvedPrincipal up = (UnresolvedPrincipal) that;
return klass.equals(up.klass)
&& (name == null ? up.name == null : name.equals(up.name));
}
if (that instanceof Principal) {
return implies((Principal) that);
}
return false;
| public java.lang.String | getClassName()Returns fully qualified class name of a modeled Principal,
or wildcard if any class is acceptable.
return klass;
| public java.lang.String | getName()Returns name of a modeled Principal, or wildcard
if any name is acceptable.
return name;
| public int | hashCode()Returns the hash code value for this object.
int hash = 0;
if (name != null) {
hash ^= name.hashCode();
}
if (klass != null) {
hash ^= klass.hashCode();
}
return hash;
| public boolean | implies(java.security.Principal another)Returns true if compared object is a Principal
exactly matching this definition. Namely, if the fully qualified name
of class of passed Principal is equal to the class name value
of this definition and the name of passed Principal is equal to
the name value of this definition, or if this definition allows
any class or name, respectively.
Otherwise returns false .
return (another != null)
&& (WILDCARD.equals(klass)
|| klass.equals(another.getClass().getName())
&& (WILDCARD.equals(name)
|| (name == null ? another.getName() == null
: name.equals(another.getName()))));
| public java.lang.String | toString()Returns a string describing this model of Principal.
The format is 'Principal classname "name"'.
return "Principal " + klass + " \"" + name + "\""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
|