Пример #1
0
 @Override
 public List<String> getDefaultRoles() {
   if (applicationData.getDefaultRoles() != null) {
     return Arrays.asList(applicationData.getDefaultRoles());
   } else {
     return Collections.emptyList();
   }
 }
Пример #2
0
  @Override
  public void addDefaultRole(String name) {
    if (getRole(name) == null) {
      addRole(name);
    }

    String[] defaultRoles = applicationData.getDefaultRoles();
    if (defaultRoles == null) {
      defaultRoles = new String[1];
    } else {
      defaultRoles = Arrays.copyOf(defaultRoles, defaultRoles.length + 1);
    }
    defaultRoles[defaultRoles.length - 1] = name;

    applicationData.setDefaultRoles(defaultRoles);
    updateApplication();
  }
Пример #3
0
  @Override
  public void updateDefaultRoles(String[] defaultRoles) {
    for (String name : defaultRoles) {
      if (getRole(name) == null) {
        addRole(name);
      }
    }

    applicationData.setDefaultRoles(defaultRoles);
    updateApplication();
  }
Пример #4
0
 @Override
 public List<RoleModel> getRoleMappings(UserModel user) {
   RelationshipQuery<Grant> query = getRelationshipManager().createRelationshipQuery(Grant.class);
   query.setParameter(Grant.ASSIGNEE, ((UserAdapter) user).getUser());
   List<Grant> grants = query.getResultList();
   List<RoleModel> set = new ArrayList<RoleModel>();
   for (Grant grant : grants) {
     if (grant.getRole().getPartition().getId().equals(applicationData.getId()))
       set.add(new RoleAdapter(grant.getRole(), getIdm()));
   }
   return set;
 }
Пример #5
0
 @Override
 public Set<String> getRoleMappingValues(UserModel user) {
   RelationshipQuery<Grant> query = getRelationshipManager().createRelationshipQuery(Grant.class);
   query.setParameter(Grant.ASSIGNEE, ((UserAdapter) user).getUser());
   List<Grant> grants = query.getResultList();
   HashSet<String> set = new HashSet<String>();
   for (Grant grant : grants) {
     if (grant.getRole().getPartition().getId().equals(applicationData.getId()))
       set.add(grant.getRole().getName());
   }
   return set;
 }
Пример #6
0
 @Override
 public List<RoleModel> getScopeMappings(UserModel agent) {
   RelationshipQuery<ScopeRelationship> query =
       getRelationshipManager().createRelationshipQuery(ScopeRelationship.class);
   query.setParameter(ScopeRelationship.CLIENT, ((UserAdapter) agent).getUser());
   List<ScopeRelationship> scope = query.getResultList();
   List<RoleModel> roles = new ArrayList<RoleModel>();
   for (ScopeRelationship rel : scope) {
     if (rel.getScope().getPartition().getId().equals(applicationData.getId()))
       roles.add(new RoleAdapter(rel.getScope(), getIdm()));
   }
   return roles;
 }
Пример #7
0
 @Override
 public Set<String> getScopeMappingValues(UserModel agent) {
   RelationshipQuery<ScopeRelationship> query =
       getRelationshipManager().createRelationshipQuery(ScopeRelationship.class);
   query.setParameter(ScopeRelationship.CLIENT, ((UserAdapter) agent).getUser());
   List<ScopeRelationship> scope = query.getResultList();
   HashSet<String> set = new HashSet<String>();
   for (ScopeRelationship rel : scope) {
     if (rel.getScope().getPartition().getId().equals(applicationData.getId()))
       set.add(rel.getScope().getName());
   }
   return set;
 }
Пример #8
0
 @Override
 public boolean isSurrogateAuthRequired() {
   return applicationData.isSurrogateAuthRequired();
 }
Пример #9
0
 @Override
 public void setEnabled(boolean enabled) {
   applicationData.setEnabled(enabled);
   updateApplication();
 }
Пример #10
0
 @Override
 public boolean isEnabled() {
   return applicationData.isEnabled();
 }
Пример #11
0
 @Override
 public void setName(String name) {
   applicationData.setResourceName(name);
   updateApplication();
 }
Пример #12
0
 @Override
 public String getName() {
   return applicationData.getResourceName();
 }
Пример #13
0
 @Override
 public String getId() {
   // for some reason picketlink queries by name when finding partition, don't know what ID is used
   // for now
   return applicationData.getName();
 }
Пример #14
0
 @Override
 public UserAdapter getApplicationUser() {
   return new UserAdapter(applicationData.getResourceUser(), realm.getIdm());
 }
Пример #15
0
 @Override
 public String getBaseUrl() {
   return applicationData.getBaseUrl();
 }
Пример #16
0
 @Override
 public void setSurrogateAuthRequired(boolean surrogateAuthRequired) {
   applicationData.setSurrogateAuthRequired(surrogateAuthRequired);
   updateApplication();
 }
Пример #17
0
 @Override
 public void setBaseUrl(String url) {
   applicationData.setBaseUrl(url);
   updateApplication();
 }
Пример #18
0
 @Override
 public String getManagementUrl() {
   return applicationData.getManagementUrl();
 }
Пример #19
0
 @Override
 public void setManagementUrl(String url) {
   applicationData.setManagementUrl(url);
   updateApplication();
 }