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