Package org.jasig.cas.support.openid.authentication.principal

Examples of org.jasig.cas.support.openid.authentication.principal.OpenIdCredentials


       
        if (ticketGrantingTicketId == null || userName == null) {
            return null;
        }
       
        return new OpenIdCredentials(
            ticketGrantingTicketId, userName);
    }
View Full Code Here


        this.ticketRegistry = new DefaultTicketRegistry();
        this.openIdCredentialsAuthenticationHandler.setTicketRegistry(this.ticketRegistry);
    }
   
    public void testSupports() {
        assertTrue(this.openIdCredentialsAuthenticationHandler.supports(new OpenIdCredentials("test", "test")));
        assertFalse(this.openIdCredentialsAuthenticationHandler.supports(new UsernamePasswordCredentials()));
    }
View Full Code Here

        assertTrue(this.openIdCredentialsAuthenticationHandler.supports(new OpenIdCredentials("test", "test")));
        assertFalse(this.openIdCredentialsAuthenticationHandler.supports(new UsernamePasswordCredentials()));
    }
   
    public void testTGTWithSameId() throws Exception {
        final OpenIdCredentials c = new OpenIdCredentials("test", "test");
        final TicketGrantingTicket t = getTicketGrantingTicket();
        this.ticketRegistry.addTicket(t);
       
        assertTrue(this.openIdCredentialsAuthenticationHandler.authenticate(c));
    }
View Full Code Here

       
        assertTrue(this.openIdCredentialsAuthenticationHandler.authenticate(c));
    }
   
    public void testTGTThatIsExpired() throws Exception {
        final OpenIdCredentials c = new OpenIdCredentials("test", "test");
        final TicketGrantingTicket t = getTicketGrantingTicket();
        this.ticketRegistry.addTicket(t);
       
        t.expire();
        assertFalse(this.openIdCredentialsAuthenticationHandler.authenticate(c));
View Full Code Here

        t.expire();
        assertFalse(this.openIdCredentialsAuthenticationHandler.authenticate(c));
    }
   
    public void testTGTWithDifferentId() throws Exception {
        final OpenIdCredentials c = new OpenIdCredentials("test", "test1");
        final TicketGrantingTicket t = getTicketGrantingTicket();
        this.ticketRegistry.addTicket(t);
       
        assertFalse(this.openIdCredentialsAuthenticationHandler.authenticate(c));
    }
View Full Code Here

    @NotNull
    private TicketRegistry ticketRegistry;

    public boolean authenticate(final Credentials credentials)
        throws AuthenticationException {
        final OpenIdCredentials c = (OpenIdCredentials) credentials;

        final TicketGrantingTicket t = (TicketGrantingTicket) this.ticketRegistry
            .getTicket(c.getTicketGrantingTicketId(),
                TicketGrantingTicket.class);

        if (t.isExpired()) {
            return false;
        }

        return t.getAuthentication().getPrincipal().getId().equals(
            c.getUsername());
    }
View Full Code Here

TOP

Related Classes of org.jasig.cas.support.openid.authentication.principal.OpenIdCredentials

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.