Package org.jasig.cas.authentication.principal

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


    }
   
    public void testSuccessfulServiceTicket() throws Exception {
        final MockRequestContext context = new MockRequestContext();
        final MockHttpServletRequest request = new MockHttpServletRequest();
        final Authentication authentication = new MutableAuthentication(new SimplePrincipal("scootman28"));
        final TicketGrantingTicket t = new TicketGrantingTicketImpl("TGT-11", authentication, new NeverExpiresExpirationPolicy());
       
        this.ticketRegistry.addTicket(t);
       
        request.setParameter("openid.identity", "http://openid.aol.com/scootman28");
View Full Code Here


       
        assertFalse(this.openIdCredentialsAuthenticationHandler.authenticate(c));
    }
   
    protected TicketGrantingTicket getTicketGrantingTicket() {
        final Authentication authentication = new MutableAuthentication(new SimplePrincipal("test"));
        return new TicketGrantingTicketImpl("test", authentication, new NeverExpiresExpirationPolicy());
    }
View Full Code Here

    public static Principal getPrincipal() {
        return getPrincipal(CONST_USERNAME);
    }

    public static Principal getPrincipal(final String name) {
        return new SimplePrincipal(name);
    }
View Full Code Here

        String myNtlmUser = "DOMAIN\\Username";
        String myNtlmUserWithNoDomain = "Username";
        String myKerberosUser = "Username@DOMAIN.COM";

        this.authenticationHandler.setPrincipalWithDomainName(true);
        assertEquals(new SimplePrincipal(myNtlmUser), this.authenticationHandler
                .getSimplePrincipal(myNtlmUser, true));
        assertEquals(new SimplePrincipal(myNtlmUserWithNoDomain), this.authenticationHandler
                .getSimplePrincipal(myNtlmUserWithNoDomain, false));
        assertEquals(new SimplePrincipal(myKerberosUser), this.authenticationHandler
                .getSimplePrincipal(myKerberosUser, false));

        this.authenticationHandler.setPrincipalWithDomainName(false);
        assertEquals(new SimplePrincipal("Username"), this.authenticationHandler
                .getSimplePrincipal(myNtlmUser, true));
        assertEquals(new SimplePrincipal("Username"), this.authenticationHandler
                .getSimplePrincipal(myNtlmUserWithNoDomain, true));
        assertEquals(new SimplePrincipal("Username"), this.authenticationHandler
                .getSimplePrincipal(myKerberosUser, false));
    }
View Full Code Here

                    if (value != null) {
                        attributes.put(attribute, value);
                    }
                }

                final Principal modifiedPrincipal = new SimplePrincipal(
                    principalId, attributes);
                final MutableAuthentication mutableAuthentication = new MutableAuthentication(
                    modifiedPrincipal, authentication.getAuthenticatedDate());
                mutableAuthentication.getAttributes().putAll(
                    authentication.getAttributes());
View Full Code Here

  }

  private TicketGrantingTicketImpl generateRandomTicket() {
    String id = this.generator.getNewTicketId("TGT");
        final SimplePrincipal principal = new SimplePrincipal(id);
    TicketGrantingTicketImpl ticket = new TicketGrantingTicketImpl(id,
        new ImmutableAuthentication(principal),
        new TimeoutExpirationPolicy(500));

    return ticket;
View Full Code Here

        TicketGrantingTicket ticket = getTicket();
    this.reg.addTicket(ticket);
  }

  TicketGrantingTicket getTicket(String id) {
        final SimplePrincipal principal = new SimplePrincipal(id);
        TicketGrantingTicket ticket = new TicketGrantingTicketImpl(id, new ImmutableAuthentication(principal), new TimeoutExpirationPolicy(500));

    return ticket;
  }
View Full Code Here

    }

    private TicketGrantingTicketImpl generateRandomTicket() {
        final String id = this.generator.getNewTicketId("TGT");
        final SimplePrincipal principal = new SimplePrincipal(id);

        TicketGrantingTicketImpl ticket = new TicketGrantingTicketImpl(id,
            new ImmutableAuthentication(principal),
            new TimeoutExpirationPolicy(500));
View Full Code Here

       
        final Map<String, Object> attributes = new HashMap<String, Object>();
        attributes.put("testAttribute", "testValue");
        attributes.put("testEmptyCollection", Collections.emptyList());
        attributes.put("testAttributeCollection", Arrays.asList(new String[] {"tac1", "tac2"}));
        final SimplePrincipal principal = new SimplePrincipal("testPrincipal", attributes);
       
        final MutableAuthentication authentication = new MutableAuthentication(principal);
        authentication.getAttributes().put(SamlAuthenticationMetaDataPopulator.ATTRIBUTE_AUTHENTICATION_METHOD, SAMLAuthenticationStatement.AuthenticationMethod_SSL_TLS_Client);
        authentication.getAttributes().put("testSamlAttribute", "value");
       
View Full Code Here

    }
   
    public void testResponseWithNoAttributes() throws Exception {
        final Map<String, Object> model = new HashMap<String, Object>();
       
        final SimplePrincipal principal = new SimplePrincipal("testPrincipal");
       
        final MutableAuthentication authentication = new MutableAuthentication(principal);
        authentication.getAttributes().put(SamlAuthenticationMetaDataPopulator.ATTRIBUTE_AUTHENTICATION_METHOD, SAMLAuthenticationStatement.AuthenticationMethod_SSL_TLS_Client);
        authentication.getAttributes().put("testSamlAttribute", "value");
       
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.