SubjectDomainCombiner (Java SE 15 & JDK 15) (original) (raw)
All Implemented Interfaces:
[DomainCombiner](../../../java/security/DomainCombiner.html "interface in java.security")
public class SubjectDomainCombiner extends Object implements DomainCombiner
A SubjectDomainCombiner updates ProtectionDomains with Principals from the Subject associated with thisSubjectDomainCombiner.
Since:
1.4
Constructor Summary
Constructors
| Constructor | Description |
|---|---|
| SubjectDomainCombiner(Subject subject) | Associate the provided Subject with thisSubjectDomainCombiner. |
Method Summary
| Modifier and Type | Method | Description |
|---|---|---|
| ProtectionDomain[] | combine(ProtectionDomain[] currentDomains,ProtectionDomain[] assignedDomains) | Update the relevant ProtectionDomains with the Principals from the Subject associated with thisSubjectDomainCombiner. |
| Subject | getSubject() | Get the Subject associated with thisSubjectDomainCombiner. |
Methods declared in class java.lang.Object
[clone](../../../java/lang/Object.html#clone%28%29), [equals](../../../java/lang/Object.html#equals%28java.lang.Object%29), [finalize](../../../java/lang/Object.html#finalize%28%29), [getClass](../../../java/lang/Object.html#getClass%28%29), [hashCode](../../../java/lang/Object.html#hashCode%28%29), [notify](../../../java/lang/Object.html#notify%28%29), [notifyAll](../../../java/lang/Object.html#notifyAll%28%29), [toString](../../../java/lang/Object.html#toString%28%29), [wait](../../../java/lang/Object.html#wait%28%29), [wait](../../../java/lang/Object.html#wait%28long%29), [wait](../../../java/lang/Object.html#wait%28long,int%29)
Constructor Details
SubjectDomainCombiner
public SubjectDomainCombiner(Subject subject)
Associate the providedSubjectwith thisSubjectDomainCombiner.
Parameters:
subject- theSubjectto be associated with thisSubjectDomainCombiner.Method Details
getSubject
Get the
Subjectassociated with thisSubjectDomainCombiner.
Returns:
theSubjectassociated with thisSubjectDomainCombiner, ornullif noSubjectis associated with thisSubjectDomainCombiner.
Throws:
[SecurityException](../../../java/lang/SecurityException.html "class in java.lang")- if the caller does not have permission to get theSubjectassociated with thisSubjectDomainCombiner.combine
Update the relevant ProtectionDomains with the Principals from the
Subjectassociated with thisSubjectDomainCombiner.
A newProtectionDomaininstance is created for each non-staticProtectionDomain( (staticPermissionsOnly() == false) in thecurrentDomainsarray. Each newProtectionDomaininstance is created using theCodeSource,Permissions andClassLoaderfrom the correspondingProtectionDomainincurrentDomains, as well as with the Principals from theSubjectassociated with thisSubjectDomainCombiner. 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 theassignedDomainsarray 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](../../../java/security/DomainCombiner.html#combine%28java.security.ProtectionDomain%5B%5D,java.security.ProtectionDomain%5B%5D%29)in interface[DomainCombiner](../../../java/security/DomainCombiner.html "interface in java.security")
Parameters:
currentDomains- the ProtectionDomains associated with the current execution Thread, up to the most recent privilegedProtectionDomain. The ProtectionDomains are listed in order of execution, with the most recently executingProtectionDomainresiding at the beginning of the array. This parameter may benullif the current execution Thread has no associated ProtectionDomains.
assignedDomains- the ProtectionDomains inherited from the parent Thread, or the ProtectionDomains from the privilegedcontext, if a call toAccessController.doPrivileged(..., context)had occurred This parameter may benullif there were no ProtectionDomains inherited from the parent Thread, or from the privilegedcontext.
Returns:
a new array consisting of the updated ProtectionDomains, ornull.