예제 #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
 @Override
 public UserModel getUserByServiceAccountClient(ClientModel client) {
   UserModel user = session.userStorage().getUserByServiceAccountClient(client);
   if (user != null) {
     user = validateAndProxyUser(client.getRealm(), user);
   }
   return user;
 }
예제 #6
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;
 }
예제 #7
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;
  }
예제 #8
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;
  }
예제 #9
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;
  }
예제 #10
0
 @Override
 public ClientTemplateModel getClientTemplate() {
   if (updated != null) return updated.getClientTemplate();
   if (cached.getClientTemplate() == null) return null;
   return cacheSession.getClientTemplateById(cached.getClientTemplate(), cachedRealm);
 }
예제 #11
0
 @Override
 public void setServiceAccountsEnabled(boolean serviceAccountsEnabled) {
   getDelegateForUpdate();
   updated.setServiceAccountsEnabled(serviceAccountsEnabled);
 }
예제 #12
0
 public void removeRedirectUri(String redirectUri) {
   getDelegateForUpdate();
   updated.removeRedirectUri(redirectUri);
 }
예제 #13
0
 public void setRedirectUris(Set<String> redirectUris) {
   getDelegateForUpdate();
   updated.setRedirectUris(redirectUris);
 }
예제 #14
0
 public void removeWebOrigin(String webOrigin) {
   getDelegateForUpdate();
   updated.removeWebOrigin(webOrigin);
 }
예제 #15
0
 @Override
 public void setNodeReRegistrationTimeout(int timeout) {
   getDelegateForUpdate();
   updated.setNodeReRegistrationTimeout(timeout);
 }
예제 #16
0
 @Override
 public int getNodeReRegistrationTimeout() {
   if (updated != null) return updated.getNodeReRegistrationTimeout();
   return cached.getNodeReRegistrationTimeout();
 }
예제 #17
0
 @Override
 public boolean removeRole(RoleModel role) {
   cacheSession.registerRoleInvalidation(role.getId());
   getDelegateForUpdate();
   return updated.removeRole(role);
 }
예제 #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 void setClientTemplate(ClientTemplateModel template) {
   getDelegateForUpdate();
   updated.setClientTemplate(template);
 }
예제 #22
0
 @Override
 public void setImplicitFlowEnabled(boolean implicitFlowEnabled) {
   getDelegateForUpdate();
   updated.setImplicitFlowEnabled(implicitFlowEnabled);
 }
예제 #23
0
 public void addWebOrigin(String webOrigin) {
   getDelegateForUpdate();
   updated.addWebOrigin(webOrigin);
 }
예제 #24
0
 public void setWebOrigins(Set<String> webOrigins) {
   getDelegateForUpdate();
   updated.setWebOrigins(webOrigins);
 }
예제 #25
0
 public Set<String> getRedirectUris() {
   if (updated != null) return updated.getRedirectUris();
   return cached.getRedirectUris();
 }
예제 #26
0
 @Override
 public void registerNode(String nodeHost, int registrationTime) {
   getDelegateForUpdate();
   updated.registerNode(nodeHost, registrationTime);
 }
예제 #27
0
 public void addRedirectUri(String redirectUri) {
   getDelegateForUpdate();
   updated.addRedirectUri(redirectUri);
 }
예제 #28
0
 @Override
 public void unregisterNode(String nodeHost) {
   getDelegateForUpdate();
   updated.unregisterNode(nodeHost);
 }
예제 #29
0
 @Override
 public Map<String, Integer> getRegisteredNodes() {
   if (updated != null) return updated.getRegisteredNodes();
   return cached.getRegisteredNodes();
 }
예제 #30
0
 @Override
 public boolean isServiceAccountsEnabled() {
   if (updated != null) return updated.isServiceAccountsEnabled();
   return cached.isServiceAccountsEnabled();
 }