use of org.apereo.cas.authentication.UsernamePasswordCredential in project cas by apereo.
the class RegisteredServiceTestUtils method getCredentialsWithDifferentUsernameAndPassword.
public static UsernamePasswordCredential getCredentialsWithDifferentUsernameAndPassword(final String username, final String password) {
final UsernamePasswordCredential usernamePasswordCredentials = new UsernamePasswordCredential();
usernamePasswordCredentials.setUsername(username);
usernamePasswordCredentials.setPassword(password);
return usernamePasswordCredentials;
}
use of org.apereo.cas.authentication.UsernamePasswordCredential in project cas by apereo.
the class RegisteredServiceTestUtils method getCredentialsWithSameUsernameAndPassword.
public static UsernamePasswordCredential getCredentialsWithSameUsernameAndPassword(final String username) {
final UsernamePasswordCredential usernamePasswordCredentials = new UsernamePasswordCredential();
usernamePasswordCredentials.setUsername(username);
usernamePasswordCredentials.setPassword(username);
return usernamePasswordCredentials;
}
use of org.apereo.cas.authentication.UsernamePasswordCredential in project cas by apereo.
the class ECPProfileHandlerController method extractBasicAuthenticationCredential.
private Credential extractBasicAuthenticationCredential(final HttpServletRequest request, final HttpServletResponse response) {
try {
final BasicAuthExtractor extractor = new BasicAuthExtractor(this.getClass().getSimpleName());
final WebContext webContext = WebUtils.getPac4jJ2EContext(request, response);
final UsernamePasswordCredentials credentials = extractor.extract(webContext);
if (credentials != null) {
LOGGER.debug("Received basic authentication ECP request from credentials [{}]", credentials);
return new UsernamePasswordCredential(credentials.getUsername(), credentials.getPassword());
}
} catch (final Exception e) {
LOGGER.warn(e.getMessage(), e);
}
return null;
}
use of org.apereo.cas.authentication.UsernamePasswordCredential in project cas by apereo.
the class SearchModeSearchDatabaseAuthenticationHandlerTests method verifyMultipleUsersFound.
@Test
public void verifyMultipleUsersFound() throws Exception {
final UsernamePasswordCredential c = CoreAuthenticationTestUtils.getCredentialsWithDifferentUsernameAndPassword("user0", "psw0");
assertNotNull(this.handler.authenticate(c));
}
use of org.apereo.cas.authentication.UsernamePasswordCredential in project cas by apereo.
the class FileAuthenticationHandlerTests method verifyFailsNullUserName.
@Test
public void verifyFailsNullUserName() throws Exception {
final UsernamePasswordCredential c = new UsernamePasswordCredential();
c.setUsername(null);
c.setPassword("user");
this.thrown.expect(AccountNotFoundException.class);
this.authenticationHandler.authenticate(c);
}
Aggregations