Beispiel #1
0
  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || !(o instanceof ClientModel)) return false;

    ClientModel that = (ClientModel) o;
    return that.getId().equals(getId());
  }
Beispiel #2
0
 @Override
 public RoleModel addRole(String id, String name) {
   getDelegateForUpdate();
   RoleModel role = updated.addRole(id, name);
   cacheSession.registerRoleInvalidation(role.getId());
   return role;
 }
Beispiel #3
0
 @Override
 public Map<String, String> getAttributes() {
   if (updated != null) return updated.getAttributes();
   Map<String, String> copy = new HashMap<String, String>();
   copy.putAll(cached.getAttributes());
   return copy;
 }
Beispiel #4
0
 @Override
 public RoleModel getRole(String name) {
   if (updated != null) return updated.getRole(name);
   String id = cached.getRoles().get(name);
   if (id == null) return null;
   return cacheSession.getRoleById(id, cachedRealm);
 }
Beispiel #5
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;
 }
Beispiel #6
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;
  }
Beispiel #7
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;
  }
Beispiel #8
0
  @Override
  public boolean hasScope(RoleModel role) {
    if (updated != null) return updated.hasScope(role);
    if (cached.isFullScopeAllowed() || cached.getScope().contains(role.getId())) return true;

    Set<RoleModel> roles = getScopeMappings();

    for (RoleModel mapping : roles) {
      if (mapping.hasRole(role)) return true;
    }

    roles = getRoles();
    if (roles.contains(role)) return true;

    for (RoleModel mapping : roles) {
      if (mapping.hasRole(role)) return true;
    }
    return false;
  }
Beispiel #9
0
 @Override
 public boolean isImplicitFlowEnabled() {
   if (updated != null) return updated.isImplicitFlowEnabled();
   return cached.isImplicitFlowEnabled();
 }
Beispiel #10
0
 @Override
 public void registerNode(String nodeHost, int registrationTime) {
   getDelegateForUpdate();
   updated.registerNode(nodeHost, registrationTime);
 }
Beispiel #11
0
 @Override
 public void unregisterNode(String nodeHost) {
   getDelegateForUpdate();
   updated.unregisterNode(nodeHost);
 }
Beispiel #12
0
 @Override
 public void setServiceAccountsEnabled(boolean serviceAccountsEnabled) {
   getDelegateForUpdate();
   updated.setServiceAccountsEnabled(serviceAccountsEnabled);
 }
Beispiel #13
0
 public void setWebOrigins(Set<String> webOrigins) {
   getDelegateForUpdate();
   updated.setWebOrigins(webOrigins);
 }
Beispiel #14
0
 public void addRedirectUri(String redirectUri) {
   getDelegateForUpdate();
   updated.addRedirectUri(redirectUri);
 }
Beispiel #15
0
 public void addWebOrigin(String webOrigin) {
   getDelegateForUpdate();
   updated.addWebOrigin(webOrigin);
 }
Beispiel #16
0
 @Override
 public boolean removeRole(RoleModel role) {
   cacheSession.registerRoleInvalidation(role.getId());
   getDelegateForUpdate();
   return updated.removeRole(role);
 }
Beispiel #17
0
 public Set<String> getRedirectUris() {
   if (updated != null) return updated.getRedirectUris();
   return cached.getRedirectUris();
 }
Beispiel #18
0
 @Override
 public boolean isDirectAccessGrantsEnabled() {
   if (updated != null) return updated.isDirectAccessGrantsEnabled();
   return cached.isDirectAccessGrantsEnabled();
 }
Beispiel #19
0
 public Set<String> getWebOrigins() {
   if (updated != null) return updated.getWebOrigins();
   return cached.getWebOrigins();
 }
Beispiel #20
0
 @Override
 public void setDirectAccessGrantsEnabled(boolean directAccessGrantsEnabled) {
   getDelegateForUpdate();
   updated.setDirectAccessGrantsEnabled(directAccessGrantsEnabled);
 }
Beispiel #21
0
 @Override
 public ClientTemplateModel getClientTemplate() {
   if (updated != null) return updated.getClientTemplate();
   if (cached.getClientTemplate() == null) return null;
   return cacheSession.getClientTemplateById(cached.getClientTemplate(), cachedRealm);
 }
Beispiel #22
0
 @Override
 public void setImplicitFlowEnabled(boolean implicitFlowEnabled) {
   getDelegateForUpdate();
   updated.setImplicitFlowEnabled(implicitFlowEnabled);
 }
Beispiel #23
0
 @Override
 public void setClientTemplate(ClientTemplateModel template) {
   getDelegateForUpdate();
   updated.setClientTemplate(template);
 }
Beispiel #24
0
 @Override
 public Map<String, Integer> getRegisteredNodes() {
   if (updated != null) return updated.getRegisteredNodes();
   return cached.getRegisteredNodes();
 }
Beispiel #25
0
 public void removeWebOrigin(String webOrigin) {
   getDelegateForUpdate();
   updated.removeWebOrigin(webOrigin);
 }
Beispiel #26
0
 @Override
 public boolean isServiceAccountsEnabled() {
   if (updated != null) return updated.isServiceAccountsEnabled();
   return cached.isServiceAccountsEnabled();
 }
Beispiel #27
0
 public void setRedirectUris(Set<String> redirectUris) {
   getDelegateForUpdate();
   updated.setRedirectUris(redirectUris);
 }
Beispiel #28
0
 @Override
 public int getNodeReRegistrationTimeout() {
   if (updated != null) return updated.getNodeReRegistrationTimeout();
   return cached.getNodeReRegistrationTimeout();
 }
Beispiel #29
0
 public void removeRedirectUri(String redirectUri) {
   getDelegateForUpdate();
   updated.removeRedirectUri(redirectUri);
 }
Beispiel #30
0
 @Override
 public void setNodeReRegistrationTimeout(int timeout) {
   getDelegateForUpdate();
   updated.setNodeReRegistrationTimeout(timeout);
 }