Package org.apache.karaf.jaas.boot.principal

Examples of org.apache.karaf.jaas.boot.principal.RolePrincipal


                principals.add(new GroupPrincipal(infos[i].substring(PropertiesBackingEngine.GROUP_PREFIX.length())));
                String groupInfo = (String) users.get(infos[i]);
                if (groupInfo != null) {
                    String[] roles = groupInfo.split(",");
                    for (int j = 1; j < roles.length; j++) {
                        principals.add(new RolePrincipal(roles[j]));
                    }
                }
            } else {
                // it's an user reference
                principals.add(new RolePrincipal(infos[i]));
            }
        }

        users.clear();
View Full Code Here


            ";jaas:group-role-add " + managerGroup + " manager" +
            ";jaas:user-add " + viewerUser + " " + viewerUser +
            ";jaas:role-add " + viewerUser + " viewer" +
            ";jaas:update" +
            ";jaas:realm-manage --realm karaf" +
            ";jaas:user-list", new RolePrincipal("admin")));

        JMXConnector connector = getJMXConnector(viewerUser, viewerUser);
        MBeanServerConnection connection = connector.getMBeanServerConnection();
        ObjectName systemMBean = new ObjectName("org.apache.karaf:type=system,name=root");
View Full Code Here

            ";jaas:group-role-add " + managerGroup + " manager" +
            ";jaas:user-add " + viewerUser + " " + viewerUser +
            ";jaas:role-add " + viewerUser + " viewer" +
            ";jaas:update" +
            ";jaas:realm-manage --realm karaf" +
            ";jaas:user-list", new RolePrincipal("admin")));

        JMXConnector connector = getJMXConnector(managerUser, managerUser);
        MBeanServerConnection connection = connector.getMBeanServerConnection();
        ObjectName systemMBean = new ObjectName("org.apache.karaf:type=system,name=root");
View Full Code Here

            ";jaas:group-role-add " + managerGroup + " manager" +
            ";jaas:user-add " + viewerUser + " " + viewerUser +
            ";jaas:role-add " + viewerUser + " viewer" +
            ";jaas:update" +
            ";jaas:realm-manage --realm karaf" +
            ";jaas:user-list", new RolePrincipal("admin")));

        try {
            getJMXConnector("admingroup", "group");
            fail("Login with a group name should have failed");
        } catch (SecurityException se) {
View Full Code Here

        expectServiceTracker(bc, "(objectClass=" + Converter.class.getName() + ")", listeners);
        expectServiceTracker(bc, "(objectClass=" + CommandSessionListener.class.getName() + ")", listeners);
        EasyMock.replay(bc);

        Subject subject = new Subject();
        subject.getPrincipals().add(new RolePrincipal("aaabbbccc"));

        Subject.doAs(subject, new PrivilegedAction<Object>() {
            @Override
            public Object run() {
                MySecuredCommandProcessorImpl scp = new MySecuredCommandProcessorImpl(bc) {};
View Full Code Here

        final DelegateSession ds = (DelegateSession) console.session;
        assertNull("Precondition", ds.delegate);

        Subject subject = new Subject();
        subject.getPrincipals().add(new RolePrincipal("myrole"));

        Subject.doAs(subject, new PrivilegedAction<Object>() {
            @Override
            public Object run() {
                SecuredCommandProcessorImpl secCP = console.createSecuredCommandProcessor();
View Full Code Here

    }

    @Test
    public void startLevelCommand() throws Exception {
        assertContains("100", executeCommand("system:start-level",
                new RolePrincipal("admin"), new RolePrincipal("manager"), new RolePrincipal("viewer")));
    }
View Full Code Here

 
  @Test
  public void createNewFactoryConfig() throws Exception {
    executeCommand("config:edit --factory myconfig2\n"
        + "config:property-set test1 data1\n"
        + "config:update", new RolePrincipal("manager"));
    Configuration config = configAdmin.listConfigurations("(service.factorypid=myconfig2)")[0];
    assertEquals("data1", config.getProperties().get("test1"));
  }
View Full Code Here

  private void checkEditByFactoryPid() throws IOException,
      InvalidSyntaxException {
    executeCommand("config:edit '(service.factorypid=myconfig)'\n"
        + "config:property-set test1 data1new\n" + "config:update",
        new RolePrincipal("manager"));
    Configuration config = readConfig();
    assertEquals("data1new", config.getProperties().get("test1"));
    assertEquals("data2", config.getProperties().get("test2"));
  }
View Full Code Here

  private void CheckEditByArbitraryAttribute() throws IOException,
      InvalidSyntaxException {
    executeCommand("config:edit '(test2=data2)'\n"
        + "config:property-set test1 data1new2\n" + "config:update",
        new RolePrincipal("manager"));
    Configuration config = readConfig();
    assertEquals("data1new2", config.getProperties().get("test1"));
    assertEquals("data2", config.getProperties().get("test2"));
  }
View Full Code Here

TOP

Related Classes of org.apache.karaf.jaas.boot.principal.RolePrincipal

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.