Package org.jboss.dna.graph

Examples of org.jboss.dna.graph.SecurityContext


            }
        };

        repository = new JcrRepository(context, connectionFactory, "unused");

        SecurityContext mockSecurityContext = new MockSecurityContext("testuser",
                                                                      Collections.singleton(JcrSession.DNA_WRITE_PERMISSION));
        session = (JcrSession)repository.login(new SecurityContextCredentials(mockSecurityContext));
    }
View Full Code Here


        // Set up the session attributes ...
        sessionAttributes = new HashMap<String, Object>();
        sessionAttributes.put("attribute1", "value1");

        // Now create the workspace ...
        SecurityContext mockSecurityContext = new MockSecurityContext(null,
                                                                      Collections.singleton(JcrSession.DNA_WRITE_PERMISSION));
        workspace = new JcrWorkspace(repository, workspaceName, context.with(mockSecurityContext), sessionAttributes);

        // Create the session and log in ...
        session = (JcrSession)workspace.getSession();
View Full Code Here

            }
        };

        repository = new JcrRepository(context, connectionFactory, "unused");

        SecurityContext mockSecurityContext = new MockSecurityContext("testuser",
                                                                      Collections.singleton(JcrSession.DNA_WRITE_PERMISSION));
        session = (JcrSession)repository.login(new SecurityContextCredentials(mockSecurityContext));
    }
View Full Code Here

     *        workspace.
     * @return true if the user has the role and is logged in; false otherwise
     */
    final boolean hasRole( String roleName,
                           String workspaceName ) {
        SecurityContext context = getExecutionContext().getSecurityContext();

        return context.hasRole(roleName) || context.hasRole(roleName + "." + this.repository.getName())
               || context.hasRole(roleName + "." + this.repository.getName() + "." + workspaceName);
    }
View Full Code Here

        }

        /*
         * Set up the anonymous role, if appropriate
         */
        SecurityContext anonymousUserContext = null;
        String rawAnonRoles = options != null ? options.get(Option.ANONYMOUS_USER_ROLES) : null;
        if (rawAnonRoles != null) {
            String[] anonRoles = rawAnonRoles.split("\\s*,\\s*");
            final List<String> roles = Arrays.asList(anonRoles);
            if (anonRoles.length > 0) {
                anonymousUserContext = new SecurityContext() {

                    public String getUserName() {
                        return ANONYMOUS_USER_NAME;
                    }

View Full Code Here

            }
        };

        repository = new JcrRepository(context, connectionFactory, "unused", new MockObservable(), null, null, null);

        SecurityContext mockSecurityContext = new MockSecurityContext("testuser",
                                                                      Collections.singleton(JcrSession.DNA_WRITE_PERMISSION));
        session = (JcrSession)repository.login(new SecurityContextCredentials(mockSecurityContext));
    }
View Full Code Here

        // Set up the session attributes ...
        sessionAttributes = new HashMap<String, Object>();
        sessionAttributes.put("attribute1", "value1");

        // Now create the workspace ...
        SecurityContext mockSecurityContext = new MockSecurityContext(null,
                                                                      Collections.singleton(JcrSession.DNA_WRITE_PERMISSION));
        workspace = new JcrWorkspace(repository, workspaceName, context.with(mockSecurityContext), sessionAttributes);

        // Create the session and log in ...
        session = (JcrSession)workspace.getSession();
View Full Code Here

            }
        };

        repository = new JcrRepository(context, connectionFactory, "unused", new MockObservable(), null, null, null);

        SecurityContext mockSecurityContext = new MockSecurityContext("testuser",
                                                                      Collections.singleton(JcrSession.DNA_WRITE_PERMISSION));
        session = (JcrSession)repository.login(new SecurityContextCredentials(mockSecurityContext));
    }
View Full Code Here

     *        workspace.
     * @return true if the user has the role and is logged in; false otherwise
     */
    final boolean hasRole( String roleName,
                           String workspaceName ) {
        SecurityContext context = getExecutionContext().getSecurityContext();

        return context.hasRole(roleName) || context.hasRole(roleName + "." + this.repository.getRepositorySourceName())
               || context.hasRole(roleName + "." + this.repository.getRepositorySourceName() + "." + workspaceName);
    }
View Full Code Here

TOP

Related Classes of org.jboss.dna.graph.SecurityContext

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.