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

The following examples show how to use org.jasig.cas.authentication.UsernamePasswordCredential#setUsername() . 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 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 2
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 testFailsNullUserName() throws Exception {
    final UsernamePasswordCredential c = new UsernamePasswordCredential();

    c.setUsername(null);
    c.setPassword("user");
    this.authenticationHandler.authenticate(c);
}
 
Example 3
Source File: FileAuthenticationHandlerTests.java    From springboot-shiro-cas-mybatis with MIT License 5 votes vote down vote up
@Test(expected = PreventedException.class)
public void verifyAuthenticateNoFileName() throws Exception {
    final UsernamePasswordCredential c = new UsernamePasswordCredential();
    this.authenticationHandler.setFileName(new ClassPathResource("fff"));

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

    this.authenticationHandler.authenticate(c);
}
 
Example 4
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 testFailsUserNotInFileWithCommaSeparator() throws Exception {
    final UsernamePasswordCredential c = new UsernamePasswordCredential();

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

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

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

    c.setUsername("fds");
    c.setPassword("rutgers");
    this.authenticationHandler.authenticate(c);
}
 
Example 6
Source File: FileAuthenticationHandlerTests.java    From springboot-shiro-cas-mybatis with MIT License 5 votes vote down vote up
@Test
public void verifyAuthenticatesUserInFileWithCommaSeparator() 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 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 verifyFailsNullUserNameAndPassword() throws Exception {
    final UsernamePasswordCredential c = new UsernamePasswordCredential();

    c.setUsername(null);
    c.setPassword(null);
    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 cas4.0.x-server-wechat with Apache License 2.0 5 votes vote down vote up
@Test(expected = AccountNotFoundException.class)
public void testFailsUserNotInFileWithDefaultSeparator() throws Exception {
    final UsernamePasswordCredential c = new UsernamePasswordCredential();

    c.setUsername("fds");
    c.setPassword("rutgers");
    this.authenticationHandler.authenticate(c);
}
 
Example 11
Source File: FileAuthenticationHandlerTests.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("scott");
    c.setPassword("rutgers");
    assertNotNull(this.authenticationHandler.authenticate(c));
}
 
Example 12
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 13
Source File: RejectUsersAuthenticationHandlerTests.java    From springboot-shiro-cas-mybatis with MIT License 5 votes vote down vote up
@Test
public void verifyPassesUserNotInMap() throws Exception {
    final UsernamePasswordCredential c = new UsernamePasswordCredential();

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

    assertNotNull(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(expected=FailedLoginException.class)
public void verifyFailsUserInMap() throws Exception {
    final UsernamePasswordCredential c = new UsernamePasswordCredential();

    c.setUsername("scott");
    c.setPassword("rutgers");
    this.authenticationHandler.authenticate(c);
}
 
Example 15
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 16
Source File: FileAuthenticationHandlerTests.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("scott");
    c.setPassword("rutgers");
    assertNotNull(this.authenticationHandler.authenticate(c));
}
 
Example 17
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 18
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 19
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 20
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;
}