Class SubjectDomainCombiner
- java.lang.Object
-
- javax.security.auth.SubjectDomainCombiner
-
- All Implemented Interfaces:
- DomainCombiner
public class SubjectDomainCombiner extends Object implements 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 ProtectionDomain[]
combine(ProtectionDomain[] currentDomains, 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:
-
SecurityException
- if the caller does not have permission to get theSubject
associated with thisSubjectDomainCombiner
.
combine
public ProtectionDomain[] combine(ProtectionDomain[] currentDomains, 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 interfaceDomainCombiner
- 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
.
-
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2022, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.