Package org.jasig.cas.authentication.principal

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


        assertTrue(credentials.toString().contains("unknown"));
    }
   
    public void testToStringWithPrincipal() {
        final SpnegoCredentials credentials = new SpnegoCredentials(new byte[] {});
        final Principal principal = new SimplePrincipal("test");
        credentials.setPrincipal(principal);
        assertEquals("test", credentials.toString());
    }
View Full Code Here


    this.resolver = new SpnegoCredentialsToPrincipalResolver();
    this.spnegoCredentials = new SpnegoCredentials(new byte[] { 0, 1, 2 });
  }

  public void testValidCredentials() {
    this.spnegoCredentials.setPrincipal(new SimplePrincipal("test"));
    assertEquals("test", this.resolver.resolvePrincipal(this.spnegoCredentials)
        .getId());
  }
View Full Code Here

    public void setUp() throws Exception {
        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

        assertFalse(this.resolver.supports(new UsernamePasswordCredentials()));
        assertFalse(this.resolver.supports(null));
    }
   
    public void testReturnedPrincipal() {
        assertEquals("test", this.resolver.resolvePrincipal(new PrincipalBearingCredentials(new SimplePrincipal("test"))).getId());
    }
View Full Code Here

        if (StringUtils.hasText(remoteUser)) {
            if (logger.isDebugEnabled()) {
                logger.debug("Remote  User [" + remoteUser
                    + "] found in HttpServletRequest");
            }
            return new PrincipalBearingCredentials(new SimplePrincipal(
                remoteUser));
        }

        if (logger.isDebugEnabled()) {
            logger.debug("Remote User not found in HttpServletRequest.");
View Full Code Here

public class PrincipalBearingCredentialsTests extends TestCase {

        private PrincipalBearingCredentials principalBearingCredentials;
       
        public void setUp() throws Exception {
            this.principalBearingCredentials = new PrincipalBearingCredentials(new SimplePrincipal("test"));
        }
View Full Code Here

        if (principal != null) {
            if (logger.isDebugEnabled()) {
                logger.debug("UserPrincipal [" + principal.getName()
                    + "] found in HttpServletRequest");
            }
            return new PrincipalBearingCredentials(new SimplePrincipal(
                principal.getName()));
        }

        if (logger.isDebugEnabled()) {
            logger.debug("UserPrincipal not found in HttpServletRequest.");
View Full Code Here

        = new PrincipalBearingCredentialsAuthenticationHandler();   
    /**
     * When the credentials bear a Principal, succeed the authentication.
     */
    public void testNonNullPrincipal() {
        PrincipalBearingCredentials credentials = new PrincipalBearingCredentials(new SimplePrincipal("scott"));
        assertTrue(this.handler.authenticate(credentials));
    }   
View Full Code Here

        PrincipalBearingCredentials credentials = new PrincipalBearingCredentials(new SimplePrincipal("scott"));
        assertTrue(this.handler.authenticate(credentials));
    }   
   
    public void testSupports() {
        PrincipalBearingCredentials credentials = new PrincipalBearingCredentials(new SimplePrincipal("scott"));
        assertTrue(this.handler.supports(credentials));
        assertFalse(this.handler.supports(new UsernamePasswordCredentials()));
    }
View Full Code Here

    protected void tearDown() throws Exception {
        super.tearDown();
    }

    protected Authentication getAuthentication() {
        return new ImmutableAuthentication(new SimplePrincipal("test"));
    }
View Full Code Here

TOP

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

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.