Przeglądaj źródła

Updating package-lock.json

jalbr74 7 lat temu
rodzic
commit
383dbbaa88

+ 3 - 6
client/package-lock.json

@@ -7,20 +7,17 @@
     "@microfocus/ias-icons": {
       "version": "1.0.0-alpha",
       "resolved": "https://registry.npmjs.org/@microfocus/ias-icons/-/ias-icons-1.0.0-alpha.tgz",
-      "integrity": "sha1-2gCMwmbf/xr1CacQN3eNGxEM0wM=",
-      "dev": true
+      "integrity": "sha1-2gCMwmbf/xr1CacQN3eNGxEM0wM="
     },
     "@microfocus/ng-ias": {
       "version": "1.0.0-alpha.2",
       "resolved": "https://registry.npmjs.org/@microfocus/ng-ias/-/ng-ias-1.0.0-alpha.2.tgz",
-      "integrity": "sha1-Nres61cnb4thTT4S6sU/cNvXrmM=",
-      "dev": true
+      "integrity": "sha1-Nres61cnb4thTT4S6sU/cNvXrmM="
     },
     "@microfocus/ux-ias": {
       "version": "1.0.0-alpha.1",
       "resolved": "https://registry.npmjs.org/@microfocus/ux-ias/-/ux-ias-1.0.0-alpha.1.tgz",
-      "integrity": "sha1-7ygUnVgpAH5xKFwysdnGeNytpKA=",
-      "dev": true
+      "integrity": "sha1-7ygUnVgpAH5xKFwysdnGeNytpKA="
     },
     "@sindresorhus/is": {
       "version": "0.7.0",

+ 1 - 1
server/pom.xml

@@ -629,7 +629,7 @@
         <dependency>
             <groupId>com.github.ldapchai</groupId>
             <artifactId>ldapchai</artifactId>
-            <version>0.7.1</version>
+            <version>0.7.2</version>
         </dependency>
         <dependency>
             <groupId>commons-net</groupId>

+ 1 - 0
server/src/main/java/password/pwm/AppProperty.java

@@ -196,6 +196,7 @@ public enum AppProperty
     LDAP_CHAI_SETTINGS                              ( "ldap.chaiSettings" ),
     LDAP_PROXY_CONNECTION_PER_PROFILE               ( "ldap.proxy.connectionsPerProfile" ),
     LDAP_PROXY_MAX_CONNECTIONS                      ( "ldap.proxy.maxConnections" ),
+    LDAP_PROXY_USE_THREAD_LOCAL                     ( "ldap.proxy.useThreadLocal" ),
     LDAP_EXTENSIONS_NMAS_ENABLE                     ( "ldap.extensions.nmas.enable" ),
     LDAP_CONNECTION_TIMEOUT                         ( "ldap.connection.timeoutMS" ),
     LDAP_PROFILE_RETRY_DELAY                        ( "ldap.profile.retryDelayMS" ),

+ 22 - 0
server/src/main/java/password/pwm/http/PwmURL.java

@@ -331,6 +331,28 @@ public class PwmURL
         return output.toString();
     }
 
+    public static String encodeParametersToFormBody( final Map<String, String> parameters )
+    {
+        final StringBuilder output = new StringBuilder( );
+
+        for ( final Map.Entry<String, String> entry : parameters.entrySet() )
+        {
+            final String paramName = entry.getKey();
+            final String value = entry.getValue();
+            final String encodedValue = value == null
+                    ? ""
+                    : StringUtil.urlEncode( value );
+
+            output.append( output.length() > 0 ? "&" : "" );
+            output.append( paramName );
+            output.append( "=" );
+            output.append( encodedValue );
+        }
+
+        return output.toString();
+    }
+
+
     public static int portForUriSchema( final URI uri )
     {
         final int port = uri.getPort();

+ 1 - 1
server/src/main/java/password/pwm/http/servlet/admin/AppDashboardData.java

@@ -450,7 +450,7 @@ public class AppDashboardData implements Serializable
             final PwmNumberFormat numberFormat = PwmNumberFormat.forLocale( locale );
 
             final String display = numberFormat.format( pwmApplication.getResourceServletService().itemsInCache() )
-                    + "items (" + numberFormat.format( pwmApplication.getResourceServletService().bytesInCache() ) + " bytes)";
+                    + " items (" + numberFormat.format( pwmApplication.getResourceServletService().bytesInCache() ) + " bytes)";
 
             javaInfo.add( new DisplayElement(
                     "resourceFileServletCacheSize",

+ 1 - 1
server/src/main/java/password/pwm/http/servlet/oauth/OAuthMachine.java

@@ -245,7 +245,7 @@ public class OAuthMachine
     )
             throws PwmUnrecoverableException
     {
-        final String requestBody = PwmURL.appendAndEncodeUrlParameters( "", requestParams );
+        final String requestBody = PwmURL.encodeParametersToFormBody( requestParams );
         final List<X509Certificate> certs = settings.getCertificates();
 
         final PwmHttpClientRequest pwmHttpClientRequest;

+ 16 - 10
server/src/main/java/password/pwm/ldap/LdapConnectionService.java

@@ -53,10 +53,12 @@ public class LdapConnectionService implements PwmService
 
     private final Map<LdapProfile, Map<Integer, ChaiProvider>> proxyChaiProviders = new ConcurrentHashMap<>();
     private final Map<LdapProfile, ErrorInformation> lastLdapErrors = new ConcurrentHashMap<>();
+
+    private boolean useThreadLocal;
     private PwmApplication pwmApplication;
     private STATUS status = STATUS.NEW;
     private AtomicLoopIntIncrementer slotIncrementer;
-    //private final ThreadLocal<Map<LdapProfile, ChaiProvider>> threadLocalProvider = new ThreadLocal<>();
+    private final ThreadLocal<Map<LdapProfile, ChaiProvider>> threadLocalProvider = new ThreadLocal<>();
     private ChaiProviderFactory chaiProviderFactory;
 
     public STATUS status( )
@@ -71,6 +73,8 @@ public class LdapConnectionService implements PwmService
 
         chaiProviderFactory = ChaiProviderFactory.newProviderFactory();
 
+        useThreadLocal = Boolean.parseBoolean( pwmApplication.getConfig().readAppProperty( AppProperty.LDAP_PROXY_USE_THREAD_LOCAL ) );
+
         // read the lastLoginTime
         this.lastLdapErrors.putAll( readLastLdapFailure( pwmApplication ) );
 
@@ -135,22 +139,24 @@ public class LdapConnectionService implements PwmService
                 ? pwmApplication.getConfig().getDefaultLdapProfile()
                 : ldapProfile;
 
-        /*
-        if ( threadLocalProvider.get() != null && threadLocalProvider.get().containsKey( effectiveProfile ) )
+        if ( useThreadLocal )
         {
-            return threadLocalProvider.get().get( effectiveProfile );
+            if ( threadLocalProvider.get() != null && threadLocalProvider.get().containsKey( effectiveProfile ) )
+            {
+                return threadLocalProvider.get().get( effectiveProfile );
+            }
         }
-        */
 
         final ChaiProvider chaiProvider = getNewProxyChaiProvider( effectiveProfile );
 
-        /*
-        if ( threadLocalProvider.get() == null )
+        if ( useThreadLocal )
         {
-            threadLocalProvider.set( new ConcurrentHashMap<>() );
+            if ( threadLocalProvider.get() == null )
+            {
+                threadLocalProvider.set( new ConcurrentHashMap<>() );
+            }
+            threadLocalProvider.get().put( effectiveProfile, chaiProvider );
         }
-        threadLocalProvider.get().put( effectiveProfile, chaiProvider );
-        */
 
         return chaiProvider;
     }

+ 1 - 0
server/src/main/resources/password/pwm/AppProperty.properties

@@ -173,6 +173,7 @@ ldap.cache.userGuid.seconds=3600
 ldap.chaiSettings=
 ldap.proxy.connectionsPerProfile=10
 ldap.proxy.maxConnections=50
+ldap.proxy.useThreadLocal=true
 ldap.extensions.nmas.enable=true
 ldap.connection.timeoutMS=30000
 ldap.profile.retryDelayMS=30000