@Async public Future<Uid> authenticate( final ConnectorFacade connector, final String username, final GuardedString password, final OperationOptions options) { return new AsyncResult<>(connector.authenticate(ObjectClass.ACCOUNT, username, password, options)); }
private boolean authenticateExpectingRuntimeException(String name, GuardedString password) { boolean authenticateFailed = false; for(int i=0;i<getLongTestParam(MAX_ITERATIONS, 1);i++) { try { getConnectorFacade().authenticate(ObjectClass.ACCOUNT, name,password, getOperationOptionsByOp(AuthenticationApiOp.class)); } catch (RuntimeException e) { // it failed as it should have authenticateFailed = true; break; } LOG.info(String.format("Retrying authentication - iteration %d", i)); sleepIngoringInterruption(getLongTestParam(SLEEP_MILLISECONDS, 0)); } return authenticateFailed; }
private boolean authenticateExpectingInvalidCredentials(String name, GuardedString password) { boolean authenticateFailed = false; for(int i=0;i<getLongTestParam(MAX_ITERATIONS, 1);i++) { try { getConnectorFacade().authenticate(ObjectClass.ACCOUNT, name, password, getOperationOptionsByOp(AuthenticationApiOp.class)); } catch (InvalidCredentialException e) { // it failed as it should have authenticateFailed = true; break; } LOG.info(String.format("Retrying authentication - iteration %d", i)); sleepIngoringInterruption(getLongTestParam(SLEEP_MILLISECONDS, 0)); } return authenticateFailed; }
private boolean authenticateExpectingRuntimeException(String name, GuardedString password) { boolean authenticateFailed = false; for(int i=0;i<getLongTestParam(MAX_ITERATIONS, 1);i++) { try { getConnectorFacade().authenticate(ObjectClass.ACCOUNT, name,password, getOperationOptionsByOp(AuthenticationApiOp.class)); } catch (RuntimeException e) { // it failed as it should have authenticateFailed = true; break; } LOG.info(String.format("Retrying authentication - iteration %d", i)); sleepIngoringInterruption(getLongTestParam(SLEEP_MILLISECONDS, 0)); } return authenticateFailed; }
private boolean authenticateExpectingInvalidCredentials(String name, GuardedString password) { boolean authenticateFailed = false; for(int i=0;i<getLongTestParam(MAX_ITERATIONS, 1);i++) { try { getConnectorFacade().authenticate(ObjectClass.ACCOUNT, name, password, getOperationOptionsByOp(AuthenticationApiOp.class)); } catch (InvalidCredentialException e) { // it failed as it should have authenticateFailed = true; break; } LOG.info(String.format("Retrying authentication - iteration %d", i)); sleepIngoringInterruption(getLongTestParam(SLEEP_MILLISECONDS, 0)); } return authenticateFailed; }
private boolean authenticateExpectingRuntimeException( ObjectClass objectClass, String name, GuardedString password) { boolean authenticateFailed = false; for (int i = 0; i < getLongTestParam(MAX_ITERATIONS, 1); i++) { try { getConnectorFacade().authenticate(ObjectClass.ACCOUNT, name, password, getOperationOptionsByOp(objectClass, AuthenticationApiOp.class)); } catch (RuntimeException e) { // it failed as it should have authenticateFailed = true; break; } LOG.info(String.format("Retrying authentication - iteration %d", i)); sleepIngoringInterruption(getLongTestParam(SLEEP_MILLISECONDS, 0)); } return authenticateFailed; }
private boolean authenticateExpectingInvalidCredentials( ObjectClass objectClass, String name, GuardedString password) { boolean authenticateFailed = false; for (int i = 0; i < getLongTestParam(MAX_ITERATIONS, 1); i++) { try { getConnectorFacade().authenticate(ObjectClass.ACCOUNT, name, password, getOperationOptionsByOp(objectClass, AuthenticationApiOp.class)); } catch (InvalidCredentialException e) { // it failed as it should have authenticateFailed = true; break; } LOG.info(String.format("Retrying authentication - iteration %d", i)); sleepIngoringInterruption(getLongTestParam(SLEEP_MILLISECONDS, 0)); } return authenticateFailed; }
private Uid authenticateExpectingSuccess(String name, GuardedString password) { Uid authenticatedUid = null; RuntimeException lastException = null; for(int i=0;i<getLongTestParam(MAX_ITERATIONS, 1);i++) { try { authenticatedUid = getConnectorFacade().authenticate(ObjectClass.ACCOUNT, name,password, getOperationOptionsByOp(AuthenticationApiOp.class)); lastException = null; break; } catch (RuntimeException e) { lastException = e; LOG.info(String.format("Retrying authentication - iteration %d", i)); sleepIngoringInterruption(getLongTestParam(SLEEP_MILLISECONDS, 0)); } } if(lastException != null) { throw lastException; } return authenticatedUid; }
private Uid authenticateExpectingSuccess(ObjectClass objectClass, String name, GuardedString password) { Uid authenticatedUid = null; RuntimeException lastException = null; for (int i = 0; i < getLongTestParam(MAX_ITERATIONS, 1); i++) { try { authenticatedUid = getConnectorFacade().authenticate(ObjectClass.ACCOUNT, name, password, getOperationOptionsByOp(objectClass, AuthenticationApiOp.class)); lastException = null; break; } catch (RuntimeException e) { lastException = e; LOG.info(String.format("Retrying authentication - iteration %d", i)); sleepIngoringInterruption(getLongTestParam(SLEEP_MILLISECONDS, 0)); } } if (lastException != null) { throw lastException; } return authenticatedUid; }
private Uid authenticateExpectingSuccess(String name, GuardedString password) { Uid authenticatedUid = null; RuntimeException lastException = null; for(int i=0;i<getLongTestParam(MAX_ITERATIONS, 1);i++) { try { authenticatedUid = getConnectorFacade().authenticate(ObjectClass.ACCOUNT, name,password, getOperationOptionsByOp(AuthenticationApiOp.class)); lastException = null; break; } catch (RuntimeException e) { lastException = e; LOG.info(String.format("Retrying authentication - iteration %d", i)); sleepIngoringInterruption(getLongTestParam(SLEEP_MILLISECONDS, 0)); } } if(lastException != null) { throw lastException; } return authenticatedUid; }
private PasswordExpiredException authenticateExpectingPasswordExpired(String name, GuardedString password) { PasswordExpiredException passwordExpiredException = null; RuntimeException lastException = null; for(int i=0;i<getLongTestParam(MAX_ITERATIONS, 1);i++) { try { getConnectorFacade().authenticate(ObjectClass.ACCOUNT, name,password, getOperationOptionsByOp(AuthenticationApiOp.class)); } catch (PasswordExpiredException e) { // it failed as it should have passwordExpiredException = e; lastException = null; break; } catch (RuntimeException e) { lastException = e; } LOG.info(String.format("Retrying authentication - iteration %d", i)); sleepIngoringInterruption(getLongTestParam(SLEEP_MILLISECONDS, 0)); } if(lastException != null) { throw lastException; } return passwordExpiredException; }
private PasswordExpiredException authenticateExpectingPasswordExpired(String name, GuardedString password) { PasswordExpiredException passwordExpiredException = null; RuntimeException lastException = null; for(int i=0;i<getLongTestParam(MAX_ITERATIONS, 1);i++) { try { getConnectorFacade().authenticate(ObjectClass.ACCOUNT, name,password, getOperationOptionsByOp(AuthenticationApiOp.class)); } catch (PasswordExpiredException e) { // it failed as it should have passwordExpiredException = e; lastException = null; break; } catch (RuntimeException e) { lastException = e; } LOG.info(String.format("Retrying authentication - iteration %d", i)); sleepIngoringInterruption(getLongTestParam(SLEEP_MILLISECONDS, 0)); } if(lastException != null) { throw lastException; } return passwordExpiredException; }
private PasswordExpiredException authenticateExpectingPasswordExpired( ObjectClass objectClass, String name, GuardedString password) { PasswordExpiredException passwordExpiredException = null; RuntimeException lastException = null; for (int i = 0; i < getLongTestParam(MAX_ITERATIONS, 1); i++) { try { getConnectorFacade().authenticate(ObjectClass.ACCOUNT, name, password, getOperationOptionsByOp(objectClass, AuthenticationApiOp.class)); } catch (PasswordExpiredException e) { // it failed as it should have passwordExpiredException = e; lastException = null; break; } catch (RuntimeException e) { lastException = e; } LOG.info(String.format("Retrying authentication - iteration %d", i)); sleepIngoringInterruption(getLongTestParam(SLEEP_MILLISECONDS, 0)); } if (lastException != null) { throw lastException; } return passwordExpiredException; } }