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

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


        private Subject subject;

        private static Principal[] getPrincipals(String... roles) {
            List<Principal> principals = new ArrayList<Principal>();
            for (String role : roles) {
                principals.add(new RolePrincipal(role));
            }
            return principals.toArray(new Principal[]{});
        }
View Full Code Here


            final String user = userName;
            subject.getPrincipals().add(new UserPrincipal(user));
            String roles = System.getProperty("karaf.local.roles");
            if (roles != null) {
                for (String role : roles.split("[,]")) {
                    subject.getPrincipals().add(new RolePrincipal(role.trim()));
                }
            }
           
            JaasHelper.doAs(subject, new PrivilegedExceptionAction<Object>() {
                public Object run() throws Exception {
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

        private Subject subject;

        private static Principal[] getPrincipals(String... roles) {
            List<Principal> principals = new ArrayList<Principal>();
            for (String role : roles) {
                principals.add(new RolePrincipal(role));
            }
            return principals.toArray(new Principal[]{});
        }
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

                    if (end == -1) {
                        index = -1;
                        break;
                    }
                    String role = responseTO.substring(0, end);
                    roles.add(new RolePrincipal(role));
                    responseTO = responseTO.substring(end + "</roleName>".length());
                    index = responseTO.indexOf("<roleName>");
                }
            }
        } catch (Exception e) {
View Full Code Here

                        }
                    }
                }
            });
            for (String role : roles) {
                principals.add(new RolePrincipal(role));
            }
        } catch (Exception e) {
            throw new LoginException("Can't get user " + user + " roles: " + e.getMessage());
        }
        return true;
View Full Code Here

        }
    }

    @Test
    public void installUninstallCommand() throws Exception {
        String featureInstallOutput = executeCommand("features:install -v eventadmin", new RolePrincipal("admin"));
        System.out.println(featureInstallOutput);
        assertFalse(featureInstallOutput.isEmpty());
        String featureListOutput = executeCommand("features:list -i | grep eventadmin");
        System.out.println(featureListOutput);
        assertFalse(featureListOutput.isEmpty());
        System.out.println(executeCommand("features:uninstall eventadmin", new RolePrincipal("admin")));
        featureListOutput = executeCommand("features:list -i | grep eventadmin");
        System.out.println(featureListOutput);
        assertTrue(featureListOutput.isEmpty());
    }
View Full Code Here

@ExamReactorStrategy(PerMethod.class)
public class WrapperTest extends KarafTestSupport {

    @Before
    public void installObrFeature() throws Exception {
        System.out.println(executeCommand("features:install wrapper", new RolePrincipal("admin")));
        // give it time on faster machines to complete
        Thread.sleep(500);
    }
View Full Code Here

@ExamReactorStrategy(PerMethod.class)
public class ObrTest extends KarafTestSupport {

    @Before
    public void installObrFeature() throws Exception {
        System.out.println(executeCommand("features:install obr", new RolePrincipal("admin") ));
        // give it time on faster machines to complete
        Thread.sleep(500);
    }
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.