[java-opensaml2 COMMIT] in /branches/REL_2: doc/RELEASE-NOTES.txt src/main/java/org/opensaml/ESAPISecurityConfig.java

noreply at shibboleth.net noreply at shibboleth.net
Wed Aug 15 19:29:12 EDT 2012


Author: putmanb
Date: Wed Aug 15 19:29:12 2012
New Revision: 1587

URL: http://svn.shibboleth.net/view/java-opensaml2?rev=1587&view=rev
Log:
JOST-194: org.opensaml.ESAPISecurityConfig should use singleton pattern like the default ESAPI reference class

Modified:
    branches/REL_2/doc/RELEASE-NOTES.txt
    branches/REL_2/src/main/java/org/opensaml/ESAPISecurityConfig.java

Modified: branches/REL_2/doc/RELEASE-NOTES.txt
URL: http://svn.shibboleth.net/view/java-opensaml2/branches/REL_2/doc/RELEASE-NOTES.txt?rev=1587&r1=1586&r2=1587&view=diff
==============================================================================
--- branches/REL_2/doc/RELEASE-NOTES.txt (original)
+++ branches/REL_2/doc/RELEASE-NOTES.txt Wed Aug 15 19:29:12 2012
@@ -6,6 +6,7 @@
 [JOST-190] - Backport some bugfixes from OpenSAML3
 [JOST-191] - Further Bugfixes to XACML\policy
 [JOST-193] - Make the implementation of custom bootstrap code easier, without relying on private data from DefaultBootstrap
+[JOST-194] - org.opensaml.ESAPISecurityConfig should use singleton pattern like the default ESAPI reference class
 
 Changes in Release 2.5.3
 =============================================

Modified: branches/REL_2/src/main/java/org/opensaml/ESAPISecurityConfig.java
URL: http://svn.shibboleth.net/view/java-opensaml2/branches/REL_2/src/main/java/org/opensaml/ESAPISecurityConfig.java?rev=1587&r1=1586&r2=1587&view=diff
==============================================================================
--- branches/REL_2/src/main/java/org/opensaml/ESAPISecurityConfig.java (original)
+++ branches/REL_2/src/main/java/org/opensaml/ESAPISecurityConfig.java Wed Aug 15 19:29:12 2012
@@ -18,7 +18,6 @@
 package org.opensaml;
 
 import java.io.File;
-
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.List;
@@ -30,10 +29,27 @@
  * Minimal implementation of OWASP ESAPI {@link SecurityConfiguration}, providing the support used within OpenSAML.
  */
 public class ESAPISecurityConfig implements SecurityConfiguration {
+    
+    /** The singleton instance of this class. */
+    private static volatile SecurityConfiguration instance;
 
     /** Constructor. */
     public ESAPISecurityConfig() {
     }
+    
+    /**
+     * Factory method which implements the singleton pattern per the ESAPI reference impl.
+     * 
+     * @return the singleton instance of this class
+     */
+    public static SecurityConfiguration getInstance() {
+        synchronized (ESAPISecurityConfig.class) {
+            if ( instance == null ) {
+                instance = new ESAPISecurityConfig();
+            }
+        }
+        return instance;
+    }
 
     /** {@inheritDoc} */
     public String getAccessControlImplementation() {



More information about the commits mailing list