Package org.jboss.soa.esb.services.security.principals

Examples of org.jboss.soa.esb.services.security.principals.Role


  {
    Builder builder = new SecurityConfig.Builder("SuccessfulLogin");
    builder.runAs("adminRole");
    SecurityConfig configInfo = builder.build();
    Group group = new Group("Roles");
    group.addMember(new Role("adminRole1"));

    subject.getPrincipals().add(group);

    SecurityContext context = new SecurityContext(subject, SecurityContext.getConfigurationTimeout());
    service.authenticate(configInfo, context, null);
View Full Code Here


    Builder builder = new SecurityConfig.Builder("SuccessfulLogin");
    builder.runAs(roleName);
    SecurityConfig configInfo = builder.build();
    SecurityContext context = new SecurityContext(subject, SecurityContext.getConfigurationTimeout());
    service.authenticate(configInfo, context, null);
    assertTrue( service.isCallerInRole(subject, new Role(roleName)));
  }
View Full Code Here

    private void addRole(final String roleName, final Subject subject )
    {
        if (roleName != null)
        {
            final Role role = new Role(roleName);
            final Set<Group> principals = subject.getPrincipals(Group.class);
            if ( principals.isEmpty() )
            {
                final Group group = new Group("Roles");
                group.addMember(role);
View Full Code Here

        final Principal principal = subject.getPrincipals().iterator().next();
        assertTrue(principal instanceof User);
        assertEquals(principal.getName(), "Daniel Bevenius");

        final Set<Group> principals = subject.getPrincipals(Group.class);
        assertTrue(principals.iterator().next().isMember(new Role("worker")));
        assertTrue(principals.iterator().next().isMember(new Role("esbrole")));
    }
View Full Code Here

        //  call add roles
        module.addRoles(subject, principal, null, options);

        final Set<Group> principals = subject.getPrincipals(Group.class);
        assertTrue(principals.iterator().next().isMember(new Role("worker")));
        assertTrue(principals.iterator().next().isMember(new Role("esbrole")));
    }
View Full Code Here

  public void isCallerInRole()
  {
    Subject subject = new Subject();
    subject.getPrincipals().add( new User("AustinPowerwich") );
    Group roles = new Group("Roles");
    roles.addMember( new Role("Admin"));
    subject.getPrincipals().add(roles);

    SecurityContext securityContext = new SecurityContext(subject, 30000);
    boolean callerInRole = securityContext.isCallerInRole("Admin");
    assertTrue( callerInRole );
View Full Code Here

  private void addRunAs( final String runAs, final Subject subject )
  {
    if ( runAs != null )
    {
      final Role runAsRole = new Role(runAs);
      final Set<Group> principals = subject.getPrincipals(Group.class);
      if ( principals.isEmpty() )
      {
            final Group group = new Group("Roles");
          group.addMember(runAsRole);
View Full Code Here

TOP

Related Classes of org.jboss.soa.esb.services.security.principals.Role

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.