1. Sebastian Sdorra
  2. scm-manager

Commits

Sebastian Sdorra  committed 087114f

improve logging

  • Participants
  • Parent commits 3ee3745
  • Branches apache-shiro

Comments (0)

Files changed (1)

File scm-webapp/src/main/java/sonia/scm/web/security/ChainAuthenticatonManager.java

View file
    */
   @Inject
   public ChainAuthenticatonManager(
-          Set<AuthenticationHandler> authenticationHandlerSet,
-          EncryptionHandler encryptionHandler, CacheManager cacheManager,
-          Provider<Set<AuthenticationListener>> authenticationListenerProvider)
+    Set<AuthenticationHandler> authenticationHandlerSet,
+    EncryptionHandler encryptionHandler, CacheManager cacheManager,
+    Provider<Set<AuthenticationListener>> authenticationListenerProvider)
   {
     AssertUtil.assertIsNotEmpty(authenticationHandlerSet);
     AssertUtil.assertIsNotNull(cacheManager);
     this.encryptionHandler = encryptionHandler;
     this.authenticationListenerProvider = authenticationListenerProvider;
     this.cache = cacheManager.getCache(String.class,
-                                       AuthenticationCacheValue.class,
-                                       CACHE_NAME);
+      AuthenticationCacheValue.class, CACHE_NAME);
 
     // addListeners(authenticationListeners);
   }
    */
   @Override
   public AuthenticationResult authenticate(HttpServletRequest request,
-          HttpServletResponse response, String username, String password)
+    HttpServletResponse response, String username, String password)
   {
     AssertUtil.assertIsNotEmpty(username);
     AssertUtil.assertIsNotEmpty(password);
       if (logger.isTraceEnabled())
       {
         logger.trace("no authentication result for user {} found in cache",
-                     username);
+          username);
       }
 
       ar = doAuthentication(request, response, username, password);
       if ((ar != null) && ar.isCacheable())
       {
         cache.put(username,
-                  new AuthenticationCacheValue(ar, encryptedPassword));
+          new AuthenticationCacheValue(ar, encryptedPassword));
       }
     }
     else if (logger.isDebugEnabled())
    * @return
    */
   private AuthenticationResult doAuthentication(HttpServletRequest request,
-          HttpServletResponse response, String username, String password)
+    HttpServletResponse response, String username, String password)
   {
     AuthenticationResult ar = null;
 
       if (logger.isTraceEnabled())
       {
         logger.trace("check authenticator {} for user {}",
-                     authenticator.getClass(), username);
+          authenticator.getClass(), username);
       }
 
       try
         if (logger.isDebugEnabled())
         {
           logger.debug("authenticator {} ends with result, {}",
-                       authenticator.getClass().getName(), result);
+            authenticator.getClass().getName(), result);
         }
 
         if ((result != null) && (result.getState() != null)
-            && (result.getState().isSuccessfully()
-                || (result.getState() == AuthenticationState.FAILED)))
+          && (result.getState().isSuccessfully()
+            || (result.getState() == AuthenticationState.FAILED)))
         {
           if (result.getState().isSuccessfully() && (result.getUser() != null))
           {
       }
       catch (Exception ex)
       {
-        logger.error(ex.getMessage(), ex);
+        logger.error(
+          "error durring authentication process of ".concat(
+            authenticator.getClass().getName()), ex);
       }
     }
 
    * @return
    */
   private AuthenticationResult getCached(String username,
-          String encryptedPassword)
+    String encryptedPassword)
   {
     AuthenticationResult result = null;
     AuthenticationCacheValue value = cache.get(username);
     {
       this.authenticationResult =
         new AuthenticationResult(ar.getUser().clone(), ar.getGroups(),
-                                 ar.getState());
+          ar.getState());
       this.password = password;
     }