Java Code Examples for org.jasig.cas.authentication.UsernamePasswordCredential#setPassword()

The following examples show how to use org.jasig.cas.authentication.UsernamePasswordCredential#setPassword() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FileAuthenticationHandlerTests.java    From springboot-shiro-cas-mybatis with MIT License 5 votes vote down vote up
@Test(expected = AccountNotFoundException.class)
public void verifyFailsNullUserNameAndPassword() throws Exception {
    final UsernamePasswordCredential c = new UsernamePasswordCredential();

    c.setUsername(null);
    c.setPassword(null);
    this.authenticationHandler.authenticate(c);
}
 
Example 2
Source File: RejectUsersAuthenticationHandlerTests.java    From cas4.0.x-server-wechat with Apache License 2.0 5 votes vote down vote up
@Test
public void testSupportsProperUserCredentials() throws Exception {
    UsernamePasswordCredential c = new UsernamePasswordCredential();

    c.setUsername("fff");
    c.setPassword("rutgers");
    assertNotNull(this.authenticationHandler.authenticate(c));
}
 
Example 3
Source File: TestUtils.java    From cas4.0.x-server-wechat with Apache License 2.0 5 votes vote down vote up
public static UsernamePasswordCredential getCredentialsWithDifferentUsernameAndPassword(
    final String username, final String password) {
    // noinspection LocalVariableOfConcreteClass
    final UsernamePasswordCredential usernamePasswordCredentials = new UsernamePasswordCredential();
    usernamePasswordCredentials.setUsername(username);
    usernamePasswordCredentials.setPassword(password);

    return usernamePasswordCredentials;
}
 
Example 4
Source File: FileAuthenticationHandlerTests.java    From cas4.0.x-server-wechat with Apache License 2.0 5 votes vote down vote up
@Test
public void testAuthenticatesUserInFileWithCommaSeparator() throws Exception {
    final UsernamePasswordCredential c = new UsernamePasswordCredential();

    this.authenticationHandler.setFileName(
            new ClassPathResource("org/jasig/cas/adaptors/generic/authentication2.txt"));
    this.authenticationHandler.setSeparator(",");

    c.setUsername("scott");
    c.setPassword("rutgers");

    assertNotNull(this.authenticationHandler.authenticate(c));
}
 
Example 5
Source File: FileAuthenticationHandlerTests.java    From cas4.0.x-server-wechat with Apache License 2.0 5 votes vote down vote up
@Test(expected = FailedLoginException.class)
public void testFailsNullPassword() throws Exception {
    final UsernamePasswordCredential c = new UsernamePasswordCredential();

    c.setUsername("scott");
    c.setPassword(null);

    this.authenticationHandler.authenticate(c);
}
 
Example 6
Source File: RejectUsersAuthenticationHandlerTests.java    From cas4.0.x-server-wechat with Apache License 2.0 5 votes vote down vote up
@Test(expected=FailedLoginException.class)
public void testFailsUserInMap() throws Exception {
    final UsernamePasswordCredential c = new UsernamePasswordCredential();

    c.setUsername("scott");
    c.setPassword("rutgers");
    this.authenticationHandler.authenticate(c);
}
 
Example 7
Source File: FileAuthenticationHandlerTests.java    From springboot-shiro-cas-mybatis with MIT License 5 votes vote down vote up
@Test(expected = FailedLoginException.class)
public void verifyFailsNullPassword() throws Exception {
    final UsernamePasswordCredential c = new UsernamePasswordCredential();

    c.setUsername("scott");
    c.setPassword(null);

    this.authenticationHandler.authenticate(c);
}
 
Example 8
Source File: FileAuthenticationHandlerTests.java    From springboot-shiro-cas-mybatis with MIT License 5 votes vote down vote up
@Test(expected = AccountNotFoundException.class)
public void verifyFailsNullUserName() throws Exception {
    final UsernamePasswordCredential c = new UsernamePasswordCredential();

    c.setUsername(null);
    c.setPassword("user");
    this.authenticationHandler.authenticate(c);
}
 
Example 9
Source File: FileAuthenticationHandlerTests.java    From cas4.0.x-server-wechat with Apache License 2.0 5 votes vote down vote up
@Test
public void testAuthenticatesUserInFileWithDefaultSeparator() throws Exception {
    final UsernamePasswordCredential c = new UsernamePasswordCredential();

    c.setUsername("scott");
    c.setPassword("rutgers");

    assertNotNull(this.authenticationHandler.authenticate(c));
}
 
Example 10
Source File: FileAuthenticationHandlerTests.java    From springboot-shiro-cas-mybatis with MIT License 5 votes vote down vote up
@Test
public void verifyAuthenticatesUserInFileWithDefaultSeparator() throws Exception {
    final UsernamePasswordCredential c = new UsernamePasswordCredential();

    c.setUsername("scott");
    c.setPassword("rutgers");

    assertNotNull(this.authenticationHandler.authenticate(c));
}
 
Example 11
Source File: RejectUsersAuthenticationHandlerTests.java    From springboot-shiro-cas-mybatis with MIT License 5 votes vote down vote up
@Test(expected = AccountNotFoundException.class)
public void verifyPassesNullUserName() throws Exception {
    final UsernamePasswordCredential c = new UsernamePasswordCredential();

    c.setUsername(null);
    c.setPassword("user");

    this.authenticationHandler.authenticate(c);
}
 
Example 12
Source File: FileAuthenticationHandlerTests.java    From cas4.0.x-server-wechat with Apache License 2.0 5 votes vote down vote up
@Test(expected = AccountNotFoundException.class)
public void testFailsNullUserNameAndPassword() throws Exception {
    final UsernamePasswordCredential c = new UsernamePasswordCredential();

    c.setUsername(null);
    c.setPassword(null);
    this.authenticationHandler.authenticate(c);
}
 
Example 13
Source File: RejectUsersAuthenticationHandlerTests.java    From springboot-shiro-cas-mybatis with MIT License 5 votes vote down vote up
@Test(expected=FailedLoginException.class)
public void verifyFailsUserInMap() throws Exception {
    final UsernamePasswordCredential c = new UsernamePasswordCredential();

    c.setUsername("scott");
    c.setPassword("rutgers");
    this.authenticationHandler.authenticate(c);
}
 
Example 14
Source File: RejectUsersAuthenticationHandlerTests.java    From springboot-shiro-cas-mybatis with MIT License 5 votes vote down vote up
@Test
public void verifySupportsProperUserCredentials() throws Exception {
    final UsernamePasswordCredential c = new UsernamePasswordCredential();

    c.setUsername("fff");
    c.setPassword("rutgers");
    assertNotNull(this.authenticationHandler.authenticate(c));
}
 
Example 15
Source File: GenerateMultiFactorCredentialsActionTests.java    From cas-mfa with Apache License 2.0 4 votes vote down vote up
private static Credential getCredentials() {
    final UsernamePasswordCredential c = new UsernamePasswordCredential();
    c.setUsername("user");
    c.setPassword("psw");
    return c;
}
 
Example 16
Source File: InitiatingMultiFactorAuthenticationViaFormActionTests.java    From cas-mfa with Apache License 2.0 4 votes vote down vote up
private static Credential getCredentials() {
    final UsernamePasswordCredential c = new UsernamePasswordCredential();
    c.setUsername("user");
    c.setPassword("psw");
    return c;
}
 
Example 17
Source File: InspektrThrottledSubmissionByIpAddressAndUsernameHandlerInterceptorAdapterTests.java    From cas4.0.x-server-wechat with Apache License 2.0 4 votes vote down vote up
private UsernamePasswordCredential badCredentials(final String username) {
    final UsernamePasswordCredential credentials = new UsernamePasswordCredential();
    credentials.setUsername(username);
    credentials.setPassword("badpassword");
    return credentials;
}
 
Example 18
Source File: InspektrThrottledSubmissionByIpAddressAndUsernameHandlerInterceptorAdapterTests.java    From springboot-shiro-cas-mybatis with MIT License 4 votes vote down vote up
private UsernamePasswordCredential badCredentials(final String username) {
    final UsernamePasswordCredential credentials = new UsernamePasswordCredential();
    credentials.setUsername(username);
    credentials.setPassword("badpassword");
    return credentials;
}
 
Example 19
Source File: MultifactorAuthenticationTests.java    From cas4.0.x-server-wechat with Apache License 2.0 4 votes vote down vote up
private static UsernamePasswordCredential newUserPassCredentials(final String user, final String pass) {
    final UsernamePasswordCredential userpass = new UsernamePasswordCredential();
    userpass.setUsername(user);
    userpass.setPassword(pass);
    return userpass;
}
 
Example 20
Source File: MultifactorAuthenticationTests.java    From springboot-shiro-cas-mybatis with MIT License 4 votes vote down vote up
private static UsernamePasswordCredential newUserPassCredentials(final String user, final String pass) {
    final UsernamePasswordCredential userpass = new UsernamePasswordCredential();
    userpass.setUsername(user);
    userpass.setPassword(pass);
    return userpass;
}