public final class BasicUntrustedObjectSecurityContext extends Object implements UntrustedObjectSecurityContext
Modifier and Type | Class and Description |
---|---|
private class |
BasicUntrustedObjectSecurityContext.Combiner
DomainCombiner that uses specified combiner (if any) to combine in
restrictedPD.
|
Modifier and Type | Field and Description |
---|---|
private static CodeSource |
emptyCS
Empty codesource.
|
private static ProtectionDomain |
emptyPD
ProtectionDomain containing the empty codesource.
|
private Permission[] |
permissions
Permissions.
|
private ProtectionDomain |
restrictedPD
EmptyPD plus specified permissions.
|
Constructor and Description |
---|
BasicUntrustedObjectSecurityContext(Permission[] permissions)
Constructs an instance with the specified permissions.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj)
Returns
true if the specified object and this object
are both instances of this class that were constructed with equivalent
permissions. |
SecurityContext |
getContext()
Returns a security context to use to restrict privileges when
invoking methods on untrusted objects.
|
int |
hashCode()
Returns a hash code value for this object.
|
String |
toString()
Returns a string representation of this object.
|
private static final CodeSource emptyCS
private static final ProtectionDomain emptyPD
private final Permission[] permissions
private final ProtectionDomain restrictedPD
public BasicUntrustedObjectSecurityContext(Permission[] permissions)
getContext
will be restricted
to the permissions granted by default to all code plus the additional
specified permissions. The argument passed to the constructor is
neither modified nor retained; subsequent changes to that argument
have no effect on the instance created.permissions
- additional permissions to allow, or
null
if no additional permissions should be allowedNullPointerException
- if any element of the argument is
null
public SecurityContext getContext()
Security.getContext
) with an additional
protection domain combined into the access control context that
contains an empty CodeSource
(null
location and
certificates), a permission collection containing the permissions
used to construct this instance, null
class loader, and
null
principals.getContext
in interface UntrustedObjectSecurityContext
public String toString()
public boolean equals(Object obj)
true
if the specified object and this object
are both instances of this class that were constructed with equivalent
permissions. The order of permissions in the array that was passed to
the constructor is not significant.Copyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.