Package org.beangle.security.core.authority

Examples of org.beangle.security.core.authority.GrantedAuthorityBean


      fail("Should have returned a CasAuthentication");
    }
    CasAuthentication casResult = (CasAuthentication) result;
    assertEquals(makeUserDetailsFromAuthoritiesPopulator(), casResult.getPrincipal());
    assertEquals("ST-123", casResult.getCredentials());
    assertTrue(casResult.getAuthorities().contains(new GrantedAuthorityBean("ROLE_A")));
    assertTrue(casResult.getAuthorities().contains(new GrantedAuthorityBean("ROLE_B")));
    assertEquals(cap.getKey().hashCode(), casResult.getKeyHash());
    assertEquals("details", casResult.getDetails());

    // Now confirm the CasAuthentication is automatically re-accepted.
    // To ensure TicketValidator not called again, set it to deliver an
View Full Code Here


    for (final Menu m : mngMenus) {
      mngResources.addAll(m.getResources());
    }
    newResources.retainAll(mngResources);
    authorityService.authorize(mao, newResources);
    authorityManager.refreshGroupAuthorities(new GrantedAuthorityBean(mao.getName()));

    Action redirect = Action.to(this).method("edit");
    redirect.param("group.id", mao.getId()).param("menuProfileId", menuProfile.getId());
    String displayFreezen = get("displayFreezen");
    if (null != displayFreezen) {
View Full Code Here

    } else {
      User user = users.get(0);
      List<Group> groups = userService.getGroups(user, GroupMember.Ship.MEMBER);
      List<GrantedAuthorityBean> authorities = CollectUtils.newArrayList(groups.size());
      for (Group g : groups) {
        authorities.add(new GrantedAuthorityBean(g.getName()));
      }
      return new UserToken(user.getId(), user.getName(), user.getFullname(), user.getPassword(),
          entityDao.initialize(user.getDefaultCategory()).getTitle(), user.isEnabled(),
          user.isAccountExpired(), user.isPasswordExpired(), false, authorities);
    }
View Full Code Here

      authority.setResource(resource);
      mao.getAuthorities().add(authority);
    }

    entityDao.saveOrUpdate(mao);
    authorityManager.refreshGroupAuthorities(new GrantedAuthorityBean(mao.getName()));

    Action redirect = Action.to(this).method("edit");
    redirect.param("group.id", mao.getId()).param("menuProfileId", menuProfile.getId());
    String displayFreezen = get("displayFreezen");
    if (null != displayFreezen) {
View Full Code Here

      String hql = "select g.group.name from User u join u.groups as g where u.id=?";
      List<String> groupNames = entityDao.searchHQLQuery(hql, user.getId());
      GrantedAuthorityBean[] authorities = new GrantedAuthorityBean[groupNames.size()];
      int i = 0;
      for (String group : groupNames) {
        authorities[i] = new GrantedAuthorityBean(group);
        i++;
      }
      return new UserToken(user.getId(), user.getName(), user.getFullname(), user
          .getPassword(), entityDao.get(UserCategory.class, user.getDefaultCategory()
          .getId()), user.getStatus() > 0, false, false, false, authorities);
View Full Code Here

      mao.getAuthorities().add(authority);
    }

    entityDao.remove(removedAuthorities);
    entityDao.saveOrUpdate(mao);
    authorityManager.refreshGroupAuthorities(new GrantedAuthorityBean(mao.getName()));

    Action redirect = Action.to(this).method("edit");
    redirect.param("group.id", mao.getId()).param("menuProfileId", menuProfile.getId());
    String displayFreezen = get("displayFreezen");
    if (null != displayFreezen) {
View Full Code Here

      User user = users.get(0);
      List<Group> groups = user.getGroups();
      List<GrantedAuthorityBean> authorities = CollectUtils.newArrayList(groups.size());
      Group defaultGroup = null;
      for (Group g : groups) {
        authorities.add(new GrantedAuthorityBean(g.getName()));
        if (groupProfileService.hasProfile(g)) {
          defaultGroup = g;
        }
      }
      String categoryName = (null == defaultGroup) ? "default" : defaultGroup.getName();
View Full Code Here

      User user = users.get(0);
      List<Group> groups = user.getGroups();
      List<GrantedAuthorityBean> authorities = CollectUtils.newArrayList(groups.size());
      Group defaultGroup = null;
      for (Group g : groups) {
        authorities.add(new GrantedAuthorityBean(g.getId()));
        if (groupProfileService.hasProfile(g)) {
          defaultGroup = g;
        }
      }
      String categoryName = (null == defaultGroup) ? "default" : defaultGroup.getName();
View Full Code Here

    }
  }

  public void testGetters() {
    UsernamePasswordAuthentication token = new UsernamePasswordAuthentication("Test",
        "Password", new GrantedAuthority[] { new GrantedAuthorityBean("ROLE_ONE"),
            new GrantedAuthorityBean("ROLE_TWO") });
    assertEquals("Test", token.getPrincipal());
    assertEquals("Password", token.getCredentials());
    assertEquals("ROLE_ONE", token.getAuthorities()[0].getAuthority());
    assertEquals("ROLE_TWO", token.getAuthorities()[1].getAuthority());
  }
View Full Code Here

    for (final Menu m : mngMenus) {
      mngResources.addAll(m.getResources());
    }
    newResources.retainAll(mngResources);
    authorityService.authorize(mao, newResources);
    authorityManager.refreshGroupAuthorities(new GrantedAuthorityBean(mao.getName()));

    Action redirect = Action.to(this).method("edit");
    redirect.param("group.id", mao.getId()).param("menuProfileId", menuProfile.getId());
    String displayFreezen = get("displayFreezen");
    if (null != displayFreezen) {
View Full Code Here

TOP

Related Classes of org.beangle.security.core.authority.GrantedAuthorityBean

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.