Top Description Inners Fields Constructors Methods
javax.security.auth

public Class SubjectDomainCombiner

extends Object
implements DomainCombiner
Class Inheritance
All Implemented Interfaces
java.security.DomainCombiner
Annotations
@SuppressWarnings:removal
@Deprecated
since:17
forRemoval:true
Imports
java.security.AccessController, .Principal, .PrivilegedAction, .ProtectionDomain, java.util.Set, .WeakHashMap, java.lang.ref.WeakReference

Deprecated

for removal since 17.

This class is only useful in conjunction with the Security Manager, which is deprecated and subject to removal in a future release. Consequently, this class is also deprecated and subject to removal. There is no replacement for the Security Manager or this class.

A SubjectDomainCombiner updates ProtectionDomains with Principals from the Subject associated with this SubjectDomainCombiner.
Since
1.4

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
SubjectDomainCombiner.WeakKeyValueMap<K, V>

A HashMap that has weak keys and values.

Field Summary

Modifier and TypeField and Description
private SubjectDomainCombiner.WeakKeyValueMap<ProtectionDomain, ProtectionDomain>
private static final Debug
private Principal[]
private Set<Principal>
private Subject

Constructor Summary

AccessConstructor and Description
public
SubjectDomainCombiner(Subject
the Subject to be associated with this SubjectDomainCombiner.
subject
)

Associate the provided Subject with this SubjectDomainCombiner.

Method Summary

Modifier and TypeMethod and Description
public ProtectionDomain[]

Returns:

a new array consisting of the updated ProtectionDomains, or null.
combine
(ProtectionDomain[]
the ProtectionDomains associated with the current execution Thread, up to the most recent privileged ProtectionDomain. The ProtectionDomains are listed in order of execution, with the most recently executing ProtectionDomain residing at the beginning of the array. This parameter may be null if the current execution Thread has no associated ProtectionDomains.
currentDomains
,
ProtectionDomain[]
the ProtectionDomains inherited from the parent Thread, or the ProtectionDomains from the privileged context, if a call to AccessController.doPrivileged(..., context) had occurred This parameter may be null if there were no ProtectionDomains inherited from the parent Thread, or from the privileged context.
assignedDomains
)

Implements java.security.DomainCombiner.combine.

Update the relevant ProtectionDomains with the Principals from the Subject associated with this SubjectDomainCombiner.

public Subject

Returns:

the Subject associated with this SubjectDomainCombiner, or null if no Subject is associated with this SubjectDomainCombiner.
getSubject
()

Get the Subject associated with this SubjectDomainCombiner.

private static ProtectionDomain[]
private static String
private static void
printInputDomains(ProtectionDomain[] currentDomains, ProtectionDomain[] assignedDomains)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cachedPDsback to summary
private SubjectDomainCombiner.WeakKeyValueMap<ProtectionDomain, ProtectionDomain> cachedPDs
debugback to summary
private static final Debug debug
principalsback to summary
private Principal[] principals
principalSetback to summary
private Set<Principal> principalSet
subjectback to summary
private Subject subject

Constructor Detail

SubjectDomainCombinerback to summary
public SubjectDomainCombiner(Subject subject)

Associate the provided Subject with this SubjectDomainCombiner.

Parameters
subject:Subject

the Subject to be associated with this SubjectDomainCombiner.

Method Detail

combineback to summary
public ProtectionDomain[] combine(ProtectionDomain[] currentDomains, ProtectionDomain[] assignedDomains)

Implements java.security.DomainCombiner.combine.

Update the relevant ProtectionDomains with the Principals from the Subject associated with this SubjectDomainCombiner.

A new ProtectionDomain instance is created for each non-static ProtectionDomain ( (staticPermissionsOnly() == false) in the currentDomains array. Each new ProtectionDomain instance is created using the CodeSource, Permissions and ClassLoader from the corresponding ProtectionDomain in currentDomains, as well as with the Principals from the Subject associated with this SubjectDomainCombiner. Static ProtectionDomains are combined as-is and no new instance is created.

All of the ProtectionDomains (static and newly instantiated) are combined into a new array. The ProtectionDomains from the assignedDomains array are appended to this new array, and the result is returned.

Note that optimizations such as the removal of duplicate ProtectionDomains may have occurred. In addition, caching of ProtectionDomains may be permitted.

Parameters
currentDomains:ProtectionDomain[]

the ProtectionDomains associated with the current execution Thread, up to the most recent privileged ProtectionDomain. The ProtectionDomains are listed in order of execution, with the most recently executing ProtectionDomain residing at the beginning of the array. This parameter may be null if the current execution Thread has no associated ProtectionDomains.

assignedDomains:ProtectionDomain[]

the ProtectionDomains inherited from the parent Thread, or the ProtectionDomains from the privileged context, if a call to AccessController.doPrivileged(..., context) had occurred This parameter may be null if there were no ProtectionDomains inherited from the parent Thread, or from the privileged context.

Returns:ProtectionDomain[]

a new array consisting of the updated ProtectionDomains, or null.

getSubjectback to summary
public Subject getSubject()

Get the Subject associated with this SubjectDomainCombiner.

Returns:Subject

the Subject associated with this SubjectDomainCombiner, or null if no Subject is associated with this SubjectDomainCombiner.

Exceptions
SecurityException:
if the caller does not have permission to get the Subject associated with this SubjectDomainCombiner.
optimizeback to summary
private static ProtectionDomain[] optimize(ProtectionDomain[] domains)
printDomainback to summary
private static String printDomain(final ProtectionDomain pd)
printInputDomainsback to summary
private static void printInputDomains(ProtectionDomain[] currentDomains, ProtectionDomain[] assignedDomains)
javax.security.auth back to summary

private Class SubjectDomainCombiner.WeakKeyValueMap<K, V>

extends WeakHashMap<K, WeakReference<V>>
Class Inheritance

A HashMap that has weak keys and values. Key objects in this map are the "current" ProtectionDomain instances received via the combine method. Each "current" PD is mapped to a new PD instance that holds both the contents of the "current" PD, as well as the principals from the Subject associated with this combiner. The newly created "principal-based" PD values must be stored as WeakReferences since they contain strong references to the corresponding key object (the "current" non-principal-based PD), which will prevent the key from being GC'd. Specifically, a "principal-based" PD contains strong references to the CodeSource, signer certs, PermissionCollection and ClassLoader objects in the "current PD".

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public V
getValue(K key)

public V
putValue(K key, V value)

Inherited from java.util.WeakHashMap:
clearcontainsKeycontainsValueentrySetforEachgetisEmptykeySetnewWeakHashMapputputAllremovereplaceAllsizevalues

Constructor Detail

WeakKeyValueMapback to summary
private WeakKeyValueMap()

Method Detail

getValueback to summary
public V getValue(K key)
putValueback to summary
public V putValue(K key, V value)