예제 #1
0
 public Set<RoleModel> getScopeMappings() {
   if (updated != null) return updated.getScopeMappings();
   Set<RoleModel> roles = new HashSet<RoleModel>();
   for (String id : cached.getScope()) {
     roles.add(cacheSession.getRoleById(id, getRealm()));
   }
   return roles;
 }
예제 #2
0
  @Override
  public Set<RoleModel> getRoles() {
    if (updated != null) return updated.getRoles();

    Set<RoleModel> roles = new HashSet<RoleModel>();
    for (String id : cached.getRoles().values()) {
      RoleModel roleById = cacheSession.getRoleById(id, cachedRealm);
      if (roleById == null) continue;
      roles.add(roleById);
    }
    return roles;
  }
예제 #3
0
  public Set<RoleModel> getRealmScopeMappings() {
    Set<RoleModel> roleMappings = getScopeMappings();

    Set<RoleModel> appRoles = new HashSet<RoleModel>();
    for (RoleModel role : roleMappings) {
      RoleContainerModel container = role.getContainer();
      if (container instanceof RealmModel) {
        if (((RealmModel) container).getId().equals(cachedRealm.getId())) {
          appRoles.add(role);
        }
      }
    }

    return appRoles;
  }
예제 #4
0
  @Override
  public Set<RoleModel> getClientScopeMappings(ClientModel client) {
    Set<RoleModel> roleMappings = client.getScopeMappings();

    Set<RoleModel> appRoles = new HashSet<RoleModel>();
    for (RoleModel role : roleMappings) {
      RoleContainerModel container = role.getContainer();
      if (container instanceof RealmModel) {
      } else {
        ClientModel app = (ClientModel) container;
        if (app.getId().equals(getId())) {
          appRoles.add(role);
        }
      }
    }

    return appRoles;
  }