use of org.nhindirect.common.rest.auth.BasicAuthValidator in project nhin-d by DirectProject.
the class HashableBasicAuthValidator_authenticateTest method testAuthenticate_invalidCreds_assertAssertException.
@Test
public void testAuthenticate_invalidCreds_assertAssertException() throws Exception {
BasicAuthValidator validator = buildValidator();
boolean exceptionOccured = false;
try {
validator.authenticate("gm2552", "Password");
} catch (BasicAuthException e) {
exceptionOccured = true;
}
assertTrue(exceptionOccured);
}
use of org.nhindirect.common.rest.auth.BasicAuthValidator in project nhin-d by DirectProject.
the class HashableBasicAuthValidator_authenticateTest method testAuthenticate_validCredentials_assertPrinciple.
@Test
public void testAuthenticate_validCredentials_assertPrinciple() throws Exception {
BasicAuthValidator validator = buildValidator();
NHINDPrincipal prin = validator.authenticate("gm2552", "password");
assertEquals("gm2552", prin.getName());
assertEquals("admin", prin.getRole());
}
Aggregations