Package org.jasig.cas.authentication.principal

Examples of org.jasig.cas.authentication.principal.UsernamePasswordCredentials


        EasyMock.expect(userPasswordDao.getPasswordHash("admin")).andReturn("(MD5)OP2Z89LDMIY6gHAwfoFPRSQWDl5Z16Vt");
       
        final PersonDirAuthenticationHandler authenticationHandler = new PersonDirAuthenticationHandler();
        authenticationHandler.setUserPasswordDao(userPasswordDao);
       
        final UsernamePasswordCredentials credentials = new UsernamePasswordCredentials();
        credentials.setUsername("admin");
        credentials.setPassword("admin");
       
        EasyMock.replay(userPasswordDao);
       
        final boolean auth = authenticationHandler.authenticateUsernamePasswordInternal(credentials);
       
View Full Code Here


        EasyMock.expect(userPasswordDao.getPasswordHash("admin")).andReturn("(MD5)OP2Z89LDMIY5gHAwfoFPRSQWDl5Z16Vt");
       
        final PersonDirAuthenticationHandler authenticationHandler = new PersonDirAuthenticationHandler();
        authenticationHandler.setUserPasswordDao(userPasswordDao);
       
        final UsernamePasswordCredentials credentials = new UsernamePasswordCredentials();
        credentials.setUsername("admin");
        credentials.setPassword("admin");
       
        EasyMock.replay(userPasswordDao);
       
        final boolean auth = authenticationHandler.authenticateUsernamePasswordInternal(credentials);
       
View Full Code Here

        EasyMock.expect(userPasswordDao.getPasswordHash("admin")).andReturn(null);
       
        final PersonDirAuthenticationHandler authenticationHandler = new PersonDirAuthenticationHandler();
        authenticationHandler.setUserPasswordDao(userPasswordDao);
       
        final UsernamePasswordCredentials credentials = new UsernamePasswordCredentials();
        credentials.setUsername("admin");
        credentials.setPassword("admin");
       
        EasyMock.replay(userPasswordDao);
       
        final boolean auth = authenticationHandler.authenticateUsernamePasswordInternal(credentials);
       
View Full Code Here

            // this is okay because it means the test failed.
        }
    }

    public void testFailsNullPassword() {
        final UsernamePasswordCredentials c = new UsernamePasswordCredentials();

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

        try {
            assertFalse(this.authenticationHandler.authenticate(c));
        } catch (AuthenticationException e) {
            // this is okay because it means the test failed.
View Full Code Here

            // this is okay because it means the test failed.
        }
    }

    public void testAuthenticatesUserInFileWithCommaSeparator() {
        final UsernamePasswordCredentials c = new UsernamePasswordCredentials();

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

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

        try {
            assertTrue(this.authenticationHandler.authenticate(c));
        } catch (AuthenticationException e) {
            fail("AuthenticationException caught but it should not have been thrown.");
View Full Code Here

            fail("AuthenticationException caught but it should not have been thrown.");
        }
    }

    public void testFailsUserNotInFileWithCommaSeparator() {
        final UsernamePasswordCredentials c = new UsernamePasswordCredentials();

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

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

        try {
            assertFalse(this.authenticationHandler.authenticate(c));
        } catch (AuthenticationException e) {
            // this is okay because it means the test failed.
View Full Code Here

            // this is okay because it means the test failed.
        }
    }

    public void testFailsGoodUsernameBadPassword() {
        final UsernamePasswordCredentials c = new UsernamePasswordCredentials();

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

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

        try {
            assertFalse(this.authenticationHandler.authenticate(c));
        } catch (AuthenticationException e) {
            // this is okay because it means the test failed.
View Full Code Here

            // this is okay because it means the test failed.
        }
    }

    public void testAuthenticateNoFileName() {
        final UsernamePasswordCredentials c = new UsernamePasswordCredentials();
        this.authenticationHandler.setFileName(new ClassPathResource("fff"));

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

        try {
            assertFalse(this.authenticationHandler.authenticate(c));
        } catch (Exception e) {
            // this is good
View Full Code Here

  }

  public void testSupports() {
    assertFalse(this.resolver.supports(null));
    assertTrue(this.resolver.supports(this.spnegoCredentials));
    assertFalse(this.resolver.supports(new UsernamePasswordCredentials()));
  }
View Full Code Here

        this.resolver = new PrincipalBearingCredentialsToPrincipalResolver();
    }
   
    public void testSupports() {
        assertTrue(this.resolver.supports(new PrincipalBearingCredentials(new SimplePrincipal("test"))));
        assertFalse(this.resolver.supports(new UsernamePasswordCredentials()));
        assertFalse(this.resolver.supports(null));
    }
View Full Code Here

TOP

Related Classes of org.jasig.cas.authentication.principal.UsernamePasswordCredentials

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.