Package org.jasig.cas.client.validation

Examples of org.jasig.cas.client.validation.AssertionImpl


    public MockTicketValidator(boolean returnTicket) {
      this.returnTicket = returnTicket;
    }

    public Assertion validate(final String ticket, final String service) throws TicketValidationException {
      if (returnTicket) { return new AssertionImpl("rod"); }
      throw new BadCredentialsException("As requested from mock");
    }
View Full Code Here


    if (authenticationSuccess) {
      if (null != pgtIou) {
        pgtIou = null == proxyGrantingTicketStorage ? null : proxyGrantingTicketStorage
            .retrieve(pgtIou);
      }
      AssertionImpl assertion = new AssertionImpl(new AttributePrincipalImpl(user, userMap, pgtIou,
          proxyRetriever));
      if (null != caKey) assertion.getAttributes().put("caKey", caKey);
      return assertion;
    } else {
      throw new TicketValidationException(errorCode + ":" + errorMessage);
    }
  }
View Full Code Here

    public void authenticateAllNullService() throws Exception {
        String serviceUrl = "https://service/context";
        ServiceAuthenticationDetails details = mock(ServiceAuthenticationDetails.class);
        when(details.getServiceUrl()).thenReturn(serviceUrl);
        TicketValidator validator = mock(TicketValidator.class);
        when(validator.validate(any(String.class),any(String.class))).thenReturn(new AssertionImpl("rod"));

        ServiceProperties serviceProperties = makeServiceProperties();
        serviceProperties.setAuthenticateAllArtifacts(true);

        CasAuthenticationProvider cap = new CasAuthenticationProvider();
View Full Code Here

    public void authenticateAllAuthenticationIsSuccessful() throws Exception {
        String serviceUrl = "https://service/context";
        ServiceAuthenticationDetails details = mock(ServiceAuthenticationDetails.class);
        when(details.getServiceUrl()).thenReturn(serviceUrl);
        TicketValidator validator = mock(TicketValidator.class);
        when(validator.validate(any(String.class),any(String.class))).thenReturn(new AssertionImpl("rod"));

        ServiceProperties serviceProperties = makeServiceProperties();
        serviceProperties.setAuthenticateAllArtifacts(true);

        CasAuthenticationProvider cap = new CasAuthenticationProvider();
View Full Code Here

        cap.authenticate(token);
    }

    @Test(expected = BadCredentialsException.class)
    public void invalidKeyIsDetected() throws Exception {
        final Assertion assertion = new AssertionImpl("test");
        CasAuthenticationProvider cap = new CasAuthenticationProvider();
        cap.setAuthenticationUserDetailsService(new MockAuthoritiesPopulator());
        cap.setKey("qwerty");

        StatelessTicketCache cache = new MockStatelessTicketCache();
View Full Code Here

        }

        public Assertion validate(final String ticket, final String service)
                throws TicketValidationException {
            if (returnTicket) {
                return new AssertionImpl("rod");
            }
            throw new BadCredentialsException("As requested from mock");
        }
View Full Code Here

    public final void setUp() throws Exception {
        super.setUp();
    }

    public void testConstructorRejectsNulls() {
        final Assertion assertion = new AssertionImpl("test");
        try {
            new CasAuthenticationToken(null, makeUserDetails(), "Password", ROLES, makeUserDetails(), assertion);
            fail("Should have thrown IllegalArgumentException");
        } catch (IllegalArgumentException expected) {
        }
View Full Code Here

            assertTrue(true);
        }
    }

    public void testEqualsWhenEqual() {
        final Assertion assertion = new AssertionImpl("test");

        CasAuthenticationToken token1 = new CasAuthenticationToken("key", makeUserDetails(), "Password", ROLES,
                makeUserDetails(), assertion);

        CasAuthenticationToken token2 = new CasAuthenticationToken("key", makeUserDetails(), "Password", ROLES,
View Full Code Here

        assertEquals(token1, token2);
    }

    public void testGetters() {
        // Build the proxy list returned in the ticket from CAS
        final Assertion assertion = new AssertionImpl("test");
        CasAuthenticationToken token = new CasAuthenticationToken("key", makeUserDetails(), "Password", ROLES,
                makeUserDetails(), assertion);
        assertEquals("key".hashCode(), token.getKeyHash());
        assertEquals(makeUserDetails(), token.getPrincipal());
        assertEquals("Password", token.getCredentials());
View Full Code Here

            assertTrue(true);
        }
    }

    public void testNotEqualsDueToAbstractParentEqualsCheck() {
        final Assertion assertion = new AssertionImpl("test");

        CasAuthenticationToken token1 = new CasAuthenticationToken("key", makeUserDetails(), "Password", ROLES,
                makeUserDetails(), assertion);

        CasAuthenticationToken token2 = new CasAuthenticationToken("key", makeUserDetails("OTHER_NAME"), "Password",
View Full Code Here

TOP

Related Classes of org.jasig.cas.client.validation.AssertionImpl

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.