@Test public void testSuccessfulDisableOauthTokenOverAttempts() { final OAuthDomainEntry entry = new OAuthDomainEntry(); entry.setCallbackTokenAttempts(5); entry.setCallbackUrlSigned(true); entry.setType(OAuthEntry.Type.ACCESS.toString()); context.checking(new Expectations() { { oneOf(actionContext).getParams(); will(returnValue(TEST_ENTRY_TOKEN)); oneOf(entryMapper).execute(TEST_ENTRY_TOKEN); will(returnValue(entry)); } }); sut.execute(actionContext); assertEquals(entry.getCallbackTokenAttempts(), 6); assertEquals(entry.getType(), OAuthEntry.Type.DISABLED.toString()); context.assertIsSatisfied(); }
@Override public Serializable execute(final PrincipalActionContext inActionContext) throws ExecutionException { String entryToken = (String) inActionContext.getParams(); OAuthDomainEntry dto = entryMapper.execute(entryToken); dto.setCallbackTokenAttempts(dto.getCallbackTokenAttempts() + 1); if (!dto.isCallbackUrlSigned() || dto.getCallbackTokenAttempts() >= CALLBACK_TOKEN_ATTEMPTS) { dto.setType(OAuthEntry.Type.DISABLED.toString()); } return null; }
DisableOAuthTokenExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final PrincipalActionContext inActionContext) throws ExecutionException { String entryToken = (String) inActionContext.getParams(); OAuthDomainEntry dto = entryMapper.execute(entryToken); dto.setCallbackTokenAttempts(dto.getCallbackTokenAttempts() + 1); if (!dto.isCallbackUrlSigned() || dto.getCallbackTokenAttempts() >= CALLBACK_TOKEN_ATTEMPTS) { dto.setType(OAuthEntry.Type.DISABLED.toString()); } return null; } }
DisableOAuthTokenExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final PrincipalActionContext inActionContext) throws ExecutionException { String entryToken = (String) inActionContext.getParams(); OAuthDomainEntry dto = entryMapper.execute(entryToken); dto.setCallbackTokenAttempts(dto.getCallbackTokenAttempts() + 1); if (!dto.isCallbackUrlSigned() || dto.getCallbackTokenAttempts() >= CALLBACK_TOKEN_ATTEMPTS) { dto.setType(OAuthEntry.Type.DISABLED.toString()); } return null; } DisableOAuthTokenExecution(final DomainMapper<String, OAuthDomainEntry> inEntryMapper); }
DisableOAuthTokenExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final PrincipalActionContext inActionContext) throws ExecutionException { String entryToken = (String) inActionContext.getParams(); OAuthDomainEntry dto = entryMapper.execute(entryToken); dto.setCallbackTokenAttempts(dto.getCallbackTokenAttempts() + 1); if (!dto.isCallbackUrlSigned() || dto.getCallbackTokenAttempts() >= CALLBACK_TOKEN_ATTEMPTS) { dto.setType(OAuthEntry.Type.DISABLED.toString()); } return null; } DisableOAuthTokenExecution(final DomainMapper<String, OAuthDomainEntry> inEntryMapper); @Override Serializable execute(final PrincipalActionContext inActionContext); }
DisableOAuthTokenExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final PrincipalActionContext inActionContext) throws ExecutionException { String entryToken = (String) inActionContext.getParams(); OAuthDomainEntry dto = entryMapper.execute(entryToken); dto.setCallbackTokenAttempts(dto.getCallbackTokenAttempts() + 1); if (!dto.isCallbackUrlSigned() || dto.getCallbackTokenAttempts() >= CALLBACK_TOKEN_ATTEMPTS) { dto.setType(OAuthEntry.Type.DISABLED.toString()); } return null; } DisableOAuthTokenExecution(final DomainMapper<String, OAuthDomainEntry> inEntryMapper); @Override Serializable execute(final PrincipalActionContext inActionContext);  }