Пример #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);
   }
 }
Пример #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);
   }
 }
Пример #3
0
 @Activate
 public void activate(Map<String, Object> properties)
     throws ClientPoolException, StorageClientException, AccessDeniedException {
   StorageClient client = null;
   try {
     client = clientPool.getClient();
     AuthorizableActivator authorizableActivator =
         new AuthorizableActivator(client, configuration);
     authorizableActivator.setup();
   } finally {
     if (client != null) {
       client.close();
     } else {
       LOGGER.error("Failed to actvate repository, probably failed to create default users");
     }
   }
 }