use of org.apereo.cas.configuration.model.support.mfa.gauth.GoogleAuthenticatorMultifactorProperties in project cas by apereo.
the class RestGoogleAuthenticatorTokenCredentialRepositoryTests method verifyFailOps.
@Test
public void verifyFailOps() throws Exception {
val props = new GoogleAuthenticatorMultifactorProperties();
props.getRest().setUrl("http://localhost:8551");
val repo = new RestGoogleAuthenticatorTokenCredentialRepository(googleAuthenticatorInstance, props, CipherExecutor.noOpOfStringToString());
val entity = MAPPER.writeValueAsString(List.of("----"));
try (val webServer = new MockWebServer(8551, new ByteArrayResource(entity.getBytes(UTF_8), "Output"), OK)) {
webServer.start();
assertNull(repo.get("casuser", 1));
assertNull(repo.get(1));
assertNull(repo.get("casuser"));
assertEquals(0, repo.count());
assertEquals(0, repo.count("casuser"));
assertNull(repo.update(null));
}
}
use of org.apereo.cas.configuration.model.support.mfa.gauth.GoogleAuthenticatorMultifactorProperties in project cas by apereo.
the class RestGoogleAuthenticatorTokenCredentialRepositoryTests method verifyLoad.
@Test
public void verifyLoad() throws Exception {
val props = new GoogleAuthenticatorMultifactorProperties();
props.getRest().setUrl("http://localhost:8551");
val repo = new RestGoogleAuthenticatorTokenCredentialRepository(googleAuthenticatorInstance, props, CipherExecutor.noOpOfStringToString());
val account = repo.create(UUID.randomUUID().toString());
val entity = MAPPER.writeValueAsString(CollectionUtils.wrapArrayList(account));
try (val webServer = new MockWebServer(8551, new ByteArrayResource(entity.getBytes(UTF_8), "Output"), OK)) {
webServer.start();
assertFalse(repo.load().isEmpty());
}
}
use of org.apereo.cas.configuration.model.support.mfa.gauth.GoogleAuthenticatorMultifactorProperties in project cas by apereo.
the class RestGoogleAuthenticatorTokenCredentialRepositoryTests method verifyGetById.
@Test
public void verifyGetById() throws Exception {
val props = new GoogleAuthenticatorMultifactorProperties();
props.getRest().setUrl("http://localhost:8552");
val repo = new RestGoogleAuthenticatorTokenCredentialRepository(googleAuthenticatorInstance, props, CipherExecutor.noOpOfStringToString());
val account = repo.create(UUID.randomUUID().toString());
val entity = MAPPER.writeValueAsString(account);
try (val webServer = new MockWebServer(8552, new ByteArrayResource(entity.getBytes(UTF_8), "Results"), OK)) {
webServer.start();
assertNotNull(repo.get(account.getId()));
}
}
use of org.apereo.cas.configuration.model.support.mfa.gauth.GoogleAuthenticatorMultifactorProperties in project cas by apereo.
the class RestGoogleAuthenticatorTokenCredentialRepositoryTests method verifyGet.
@Test
public void verifyGet() throws Exception {
val props = new GoogleAuthenticatorMultifactorProperties();
props.getRest().setUrl("http://localhost:8552");
val repo = new RestGoogleAuthenticatorTokenCredentialRepository(googleAuthenticatorInstance, props, CipherExecutor.noOpOfStringToString());
val account = repo.create(UUID.randomUUID().toString());
val entity = MAPPER.writeValueAsString(CollectionUtils.wrapList(account));
try (val webServer = new MockWebServer(8552, new ByteArrayResource(entity.getBytes(UTF_8), "Results"), OK)) {
webServer.start();
assertFalse(repo.get(account.getUsername()).isEmpty());
}
}
use of org.apereo.cas.configuration.model.support.mfa.gauth.GoogleAuthenticatorMultifactorProperties in project cas by apereo.
the class RestGoogleAuthenticatorTokenCredentialRepositoryTests method verifyCount.
@Test
public void verifyCount() {
val props = new GoogleAuthenticatorMultifactorProperties();
props.getRest().setUrl("http://localhost:8552");
val repo = new RestGoogleAuthenticatorTokenCredentialRepository(googleAuthenticatorInstance, props, CipherExecutor.noOpOfStringToString());
try (val webServer = new MockWebServer(8552, new ByteArrayResource("1".getBytes(UTF_8), "Output"), OK)) {
webServer.start();
assertEquals(1, repo.count());
}
}
Aggregations