@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()); }
@Override public RoleModel addRole(String id, String name) { getDelegateForUpdate(); RoleModel role = updated.addRole(id, name); cacheSession.registerRoleInvalidation(role.getId()); return role; }
@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; }
@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); }
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; }
@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; }
@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; }
@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; }
@Override public boolean isImplicitFlowEnabled() { if (updated != null) return updated.isImplicitFlowEnabled(); return cached.isImplicitFlowEnabled(); }
@Override public void registerNode(String nodeHost, int registrationTime) { getDelegateForUpdate(); updated.registerNode(nodeHost, registrationTime); }
@Override public void unregisterNode(String nodeHost) { getDelegateForUpdate(); updated.unregisterNode(nodeHost); }
@Override public void setServiceAccountsEnabled(boolean serviceAccountsEnabled) { getDelegateForUpdate(); updated.setServiceAccountsEnabled(serviceAccountsEnabled); }
public void setWebOrigins(Set<String> webOrigins) { getDelegateForUpdate(); updated.setWebOrigins(webOrigins); }
public void addRedirectUri(String redirectUri) { getDelegateForUpdate(); updated.addRedirectUri(redirectUri); }
public void addWebOrigin(String webOrigin) { getDelegateForUpdate(); updated.addWebOrigin(webOrigin); }
@Override public boolean removeRole(RoleModel role) { cacheSession.registerRoleInvalidation(role.getId()); getDelegateForUpdate(); return updated.removeRole(role); }
public Set<String> getRedirectUris() { if (updated != null) return updated.getRedirectUris(); return cached.getRedirectUris(); }
@Override public boolean isDirectAccessGrantsEnabled() { if (updated != null) return updated.isDirectAccessGrantsEnabled(); return cached.isDirectAccessGrantsEnabled(); }
public Set<String> getWebOrigins() { if (updated != null) return updated.getWebOrigins(); return cached.getWebOrigins(); }
@Override public void setDirectAccessGrantsEnabled(boolean directAccessGrantsEnabled) { getDelegateForUpdate(); updated.setDirectAccessGrantsEnabled(directAccessGrantsEnabled); }
@Override public ClientTemplateModel getClientTemplate() { if (updated != null) return updated.getClientTemplate(); if (cached.getClientTemplate() == null) return null; return cacheSession.getClientTemplateById(cached.getClientTemplate(), cachedRealm); }
@Override public void setImplicitFlowEnabled(boolean implicitFlowEnabled) { getDelegateForUpdate(); updated.setImplicitFlowEnabled(implicitFlowEnabled); }
@Override public void setClientTemplate(ClientTemplateModel template) { getDelegateForUpdate(); updated.setClientTemplate(template); }
@Override public Map<String, Integer> getRegisteredNodes() { if (updated != null) return updated.getRegisteredNodes(); return cached.getRegisteredNodes(); }
public void removeWebOrigin(String webOrigin) { getDelegateForUpdate(); updated.removeWebOrigin(webOrigin); }
@Override public boolean isServiceAccountsEnabled() { if (updated != null) return updated.isServiceAccountsEnabled(); return cached.isServiceAccountsEnabled(); }
public void setRedirectUris(Set<String> redirectUris) { getDelegateForUpdate(); updated.setRedirectUris(redirectUris); }
@Override public int getNodeReRegistrationTimeout() { if (updated != null) return updated.getNodeReRegistrationTimeout(); return cached.getNodeReRegistrationTimeout(); }
public void removeRedirectUri(String redirectUri) { getDelegateForUpdate(); updated.removeRedirectUri(redirectUri); }
@Override public void setNodeReRegistrationTimeout(int timeout) { getDelegateForUpdate(); updated.setNodeReRegistrationTimeout(timeout); }