Package com.dtolabs.rundeck.core.authentication

Examples of com.dtolabs.rundeck.core.authentication.Username


        List<AclContext> contexts;


        formalSubject = new Subject();
        formalSubject.getPrincipals().add(new Username("yml_usr_1"));
        contexts = policies.narrowContext(formalSubject, environment);
        assertNotNull("Context is null.", contexts);
        assertEquals("Incorrect number of contexts returned when matching on group.", 1, contexts.size());
       
        formalSubject = new Subject();
        formalSubject.getPrincipals().add(new Username("test_1"));
        formalSubject.getPrincipals().add(new Group("admin")); // <-- will match on group membership.
        contexts = policies.narrowContext(formalSubject, environment);
        assertNotNull("Context is null.", contexts);
        assertEquals("Incorrect number of contexts returned when matching on group.", 1, contexts.size());
       
View Full Code Here


        if(username == null) throw new IllegalArgumentException("Username cannot be null.");
        if(groups == null) {
            groups = new String[0];
        }
        Subject subject = new Subject();
        subject.getPrincipals().add(new Username(username));
        for(String group : groups) {
            if(group == null || group.length() <= 0) throw new IllegalArgumentException("Group null or zero length.");
            subject.getPrincipals().add(new Group(group));
        }
        subject.setReadOnly();
View Full Code Here

        assertEquals(1, aclContexts.size());
    }

    private Subject makeSubject(String username, String... groups) {
        Subject subject = new Subject();
        subject.getPrincipals().add(new Username(username));
        for (int i = 0; i < groups.length; i++) {
            String group = groups[i];
            subject.getPrincipals().add(new Group(group));
        }
        return subject;
View Full Code Here

TOP

Related Classes of com.dtolabs.rundeck.core.authentication.Username

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.