javax.security.auth
Class SubjectDomainCombiner
- java.lang.Object
-
- javax.security.auth.SubjectDomainCombiner
-
- All Implemented Interfaces:
- java.security.DomainCombiner
public class SubjectDomainCombiner extends java.lang.Object implements java.security.DomainCombiner
ASubjectDomainCombiner
updates ProtectionDomains with Principals from theSubject
associated with thisSubjectDomainCombiner
.
-
-
Constructor Summary
Constructors Constructor and Description SubjectDomainCombiner(Subject subject)
Associate the providedSubject
with thisSubjectDomainCombiner
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description java.security.ProtectionDomain[]
combine(java.security.ProtectionDomain[] currentDomains, java.security.ProtectionDomain[] assignedDomains)
Update the relevant ProtectionDomains with the Principals from theSubject
associated with thisSubjectDomainCombiner
.Subject
getSubject()
Get theSubject
associated with thisSubjectDomainCombiner
.
-
-
-
Constructor Detail
-
SubjectDomainCombiner
public SubjectDomainCombiner(Subject subject)
Associate the providedSubject
with thisSubjectDomainCombiner
.- Parameters:
subject
- theSubject
to be associated with with thisSubjectDomainCombiner
.
-
-
Method Detail
-
getSubject
public Subject getSubject()
Get theSubject
associated with thisSubjectDomainCombiner
.- Returns:
- the
Subject
associated with thisSubjectDomainCombiner
, ornull
if noSubject
is associated with thisSubjectDomainCombiner
. - Throws:
java.lang.SecurityException
- if the caller does not have permission to get theSubject
associated with thisSubjectDomainCombiner
.
-
combine
public java.security.ProtectionDomain[] combine(java.security.ProtectionDomain[] currentDomains, java.security.ProtectionDomain[] assignedDomains)
Update the relevant ProtectionDomains with the Principals from theSubject
associated with thisSubjectDomainCombiner
.A new
ProtectionDomain
instance is created for eachProtectionDomain
in the currentDomains array. Each newProtectionDomain
instance is created using theCodeSource
,Permission
s andClassLoader
from the correspondingProtectionDomain
in currentDomains, as well as with the Principals from theSubject
associated with thisSubjectDomainCombiner
.All of the newly instantiated ProtectionDomains 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.
- Specified by:
combine
in interfacejava.security.DomainCombiner
- Parameters:
currentDomains
- the ProtectionDomains associated with the current execution Thread, up to the most recent privilegedProtectionDomain
. The ProtectionDomains are are listed in order of execution, with the most recently executingProtectionDomain
residing at the beginning of the array. This parameter may benull
if the current execution Thread has no associated ProtectionDomains.assignedDomains
- 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 benull
if there were no ProtectionDomains inherited from the parent Thread, or from the privileged context.- Returns:
- a new array consisting of the updated ProtectionDomains,
or
null
.
-
-