Examples of AttributePrincipalImpl


Examples of org.jasig.cas.client.authentication.AttributePrincipalImpl

    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

Examples of org.jasig.cas.client.authentication.AttributePrincipalImpl

        final HttpServletRequestWrapperFilter filter = new HttpServletRequestWrapperFilter();
        filter.init(config);

        final Map<String, Object> attributes = new HashMap<String, Object>();
        attributes.put("memberOf", "administrators");
        final AttributePrincipal principal = new AttributePrincipalImpl("alice", attributes);
        session.setAttribute(AbstractCasFilter.CONST_CAS_ASSERTION, new AssertionImpl(principal));

        request.setSession(session);

        filter.doFilter(request, new MockHttpServletResponse(), createFilterChain());
View Full Code Here

Examples of org.jasig.cas.client.authentication.AttributePrincipalImpl

        final HttpServletRequestWrapperFilter filter = new HttpServletRequestWrapperFilter();
        filter.init(config);

        final Map<String, Object> attributes = new HashMap<String, Object>();
        attributes.put("groupMembership", Arrays.asList(new Object[] { "animals", "ducks" }));
        final AttributePrincipal principal = new AttributePrincipalImpl("daffy", attributes);
        session.setAttribute(AbstractCasFilter.CONST_CAS_ASSERTION, new AssertionImpl(principal));

        request.setSession(session);

        filter.doFilter(request, new MockHttpServletResponse(), createFilterChain());
View Full Code Here

Examples of org.jasig.cas.client.authentication.AttributePrincipalImpl

        }

        final Assertion assertion;
        final Map<String, Object> attributes = extractCustomAttributes(response);
        if (CommonUtils.isNotBlank(proxyGrantingTicket)) {
            final AttributePrincipal attributePrincipal = new AttributePrincipalImpl(principal, attributes,
                    proxyGrantingTicket, this.proxyRetriever);
            assertion = new AssertionImpl(attributePrincipal);
        } else {
            assertion = new AssertionImpl(new AttributePrincipalImpl(principal, attributes));
        }

        customParseResponse(response, assertion);

        return assertion;
View Full Code Here

Examples of org.jasig.cas.client.authentication.AttributePrincipalImpl

                    final List<?> values = getValuesFrom(samlAttribute);

                    personAttributes.put(samlAttribute.getAttributeName(), values.size() == 1 ? values.get(0) : values);
                }

                final AttributePrincipal principal = new AttributePrincipalImpl(subject.getNameIdentifier()
                        .getNameIdentifier(), personAttributes);

                final Map<String, Object> authenticationAttributes = new HashMap<String, Object>();
                authenticationAttributes.put("samlAuthenticationStatement::authMethod",
                        authenticationStatement.getAuthenticationMethod());
View Full Code Here

Examples of org.jasig.cas.client.authentication.AttributePrincipalImpl

    }

    private Object[] getTestSubjects() {
        final SimplePrincipal simplePrincipal = new SimplePrincipal("simple");
        final SimpleGroup simpleGroup = new SimpleGroup("group");
        final AttributePrincipalImpl attributePrincipal = new AttributePrincipalImpl("attr",
                Collections.<String, Object> singletonMap("LOA", "3"));
        final AssertionPrincipal assertionPrincipal = new AssertionPrincipal("assertion", new AssertionImpl(
                attributePrincipal, Collections.<String, Object> singletonMap("authenticationMethod", "username")));

        return new Object[] { simplePrincipal, simpleGroup, attributePrincipal, assertionPrincipal, };
View Full Code Here

Examples of org.jasig.cas.client.authentication.AttributePrincipalImpl

     * Constructs a new Assertion with a Principal of the supplied name, a valid from date of now, no valid until date, and no attributes.
     *
     * @param name the name of the principal for which this assertion is valid.
     */
    public AssertionImpl(final String name) {
        this(new AttributePrincipalImpl(name));
    }
View Full Code Here

Examples of org.jasig.cas.client.authentication.AttributePrincipalImpl

        realm.setPropertiesFilePath("src/test/resources/org/jasig/cas/client/tomcat/user-roles.properties");
        realm.readProperties();
    }

    public void testAuthenticate() {
        final Principal p = new AttributePrincipalImpl("rosencrantz");
        assertTrue(p == realm.authenticate(p));
    }
View Full Code Here

Examples of org.jasig.cas.client.authentication.AttributePrincipalImpl

        final Principal p = new AttributePrincipalImpl("rosencrantz");
        assertTrue(p == realm.authenticate(p));
    }

    public void testGetRoles() {
        final Principal p = new AttributePrincipalImpl("rosencrantz");
        final List<String> expected = Arrays.asList(new String[] { "admins", "users" });
        final List<String> actual = Arrays.asList(realm.getRoles(p));
        assertEquals(expected.size(), actual.size());

        for (final String item : expected) {
View Full Code Here

Examples of org.jasig.cas.client.authentication.AttributePrincipalImpl

            assertTrue(actual.contains(item));
        }
    }

    public void testHasRole() {
        assertTrue(realm.hasRole(new AttributePrincipalImpl("rosencrantz"), "admins"));
        assertTrue(realm.hasRole(new AttributePrincipalImpl("rosencrantz"), "users"));
        assertTrue(realm.hasRole(new AttributePrincipalImpl("guildenstern"), "users"));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.