Skip to content

Commit c4b358f

Browse files
committed
Enh 38188653 - [38068862->14.1.2.0.4] Do not log an unnecessary message when an access controller fails to verify a subject
(merge 14.1.2.0 -> ce/14.1.2.0 117376) [git-p4: depot-paths = "//dev/coherence-ce/release/coherence-ce-v14.1.2.0/": change = 117377]
1 parent b4583ed commit c4b358f

File tree

1 file changed

+18
-7
lines changed
  • prj/coherence-core-components/src/main/java/com/tangosol/coherence/component/net/security

1 file changed

+18
-7
lines changed

prj/coherence-core-components/src/main/java/com/tangosol/coherence/component/net/security/Standard.java

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ public void checkPermission(com.tangosol.net.Cluster cluster, com.tangosol.net.C
269269
{
270270
try
271271
{
272-
validateSubject(sService, subject);
272+
validateSubject(sService, subject, false);
273273
fValid = true;
274274
}
275275
catch (SecurityException ex)
@@ -289,7 +289,7 @@ public void checkPermission(com.tangosol.net.Cluster cluster, com.tangosol.net.C
289289

290290
if (!fValid)
291291
{
292-
validateSubject(sService, subject);
292+
validateSubject(sService, subject, true);
293293
}
294294

295295
// TODO: leave the audit trail?
@@ -680,10 +680,18 @@ private void setValidSubjects(java.util.Map cache)
680680
*/
681681
protected void validateSubject(String sService, javax.security.auth.Subject subject)
682682
{
683-
// import com.tangosol.net.security.AccessController as com.tangosol.net.security.AccessController;
684-
// import java.util.Map;
685-
// import javax.security.auth.Subject;
686-
683+
validateSubject(sService, subject, true);
684+
}
685+
686+
/**
687+
* Prevent a security hole when a caller would construct a Subject object
688+
* with a Principal object that have a high security clearance, but provide
689+
* a valid cerificate representing a low security clearance Principal. The
690+
* very first validated subject becomes assosiated with the specified
691+
* service.
692+
*/
693+
protected void validateSubject(String sService, javax.security.auth.Subject subject, boolean fLog)
694+
{
687695
Map mapValid = getValidSubjects();
688696

689697
if (!mapValid.containsKey(subject))
@@ -699,7 +707,10 @@ protected void validateSubject(String sService, javax.security.auth.Subject subj
699707
}
700708
catch (Exception e)
701709
{
702-
_trace("Failed to verify the subject: " + subject + " due to: " + e.getMessage(), 3);
710+
if (fLog)
711+
{
712+
_trace("Failed to verify the subject: " + subject + " due to: " + e.getMessage(), 3);
713+
}
703714
throw new SecurityException("Failed to verify the subject");
704715
}
705716
}

0 commit comments

Comments
 (0)