Exemplo n.º 1
0
 private Session openSessionBypassEnable(String username)
     throws StorageClientException, AccessDeniedException {
   StorageClient client = null;
   try {
     client = clientPool.getClient();
     AuthenticatorImpl authenticatorImpl = new AuthenticatorImpl(client, configuration);
     User currentUser = authenticatorImpl.systemAuthenticateBypassEnable(username);
     if (currentUser == null) {
       throw new StorageClientException(
           "User " + username + " does not exist, cant login administratively as this user");
     }
     return new SessionImpl(
         this,
         currentUser,
         client,
         configuration,
         clientPool.getStorageCacheManager(),
         storeListener,
         principalValidatorResolver);
   } catch (ClientPoolException e) {
     clientPool.getClient();
     throw e;
   } catch (StorageClientException e) {
     clientPool.getClient();
     throw e;
   } catch (AccessDeniedException e) {
     clientPool.getClient();
     throw e;
   } catch (Throwable e) {
     clientPool.getClient();
     throw new StorageClientException(e.getMessage(), e);
   }
 }
Exemplo n.º 2
0
 private Session openSession(String username, String password)
     throws StorageClientException, AccessDeniedException {
   StorageClient client = null;
   try {
     client = clientPool.getClient();
     AuthenticatorImpl authenticatorImpl = new AuthenticatorImpl(client, configuration);
     User currentUser = authenticatorImpl.authenticate(username, password);
     if (currentUser == null) {
       throw new StorageClientException("User " + username + " cant login with password");
     }
     return new SessionImpl(
         this,
         currentUser,
         client,
         configuration,
         clientPool.getStorageCacheManager(),
         storeListener,
         principalValidatorResolver);
   } catch (ClientPoolException e) {
     clientPool.getClient();
     throw e;
   } catch (StorageClientException e) {
     clientPool.getClient();
     throw e;
   } catch (AccessDeniedException e) {
     clientPool.getClient();
     throw e;
   } catch (Throwable e) {
     clientPool.getClient();
     throw new StorageClientException(e.getMessage(), e);
   }
 }