org.keycloak.models.RealmModel.getClientScopeById()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(2.4k)|赞(0)|评价(0)|浏览(98)

本文整理了Java中org.keycloak.models.RealmModel.getClientScopeById方法的一些代码示例,展示了RealmModel.getClientScopeById的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RealmModel.getClientScopeById方法的具体详情如下:
包路径:org.keycloak.models.RealmModel
类名称:RealmModel
方法名:getClientScopeById

RealmModel.getClientScopeById介绍

暂无

代码示例

代码示例来源:origin: org.keycloak/keycloak-model-infinispan

@Override
public ClientScopeModel getClientScopeById(String id) {
  if (isUpdated()) return updated.getClientScopeById(id);
  return cacheSession.getClientScopeById(id, this);
}

代码示例来源:origin: org.keycloak/keycloak-model-jpa

@Override
public Map<String, ClientScopeModel> getClientScopes(boolean defaultScope, boolean filterByProtocol) {
  TypedQuery<String> query = em.createNamedQuery("clientScopeClientMappingIdsByClient", String.class);
  query.setParameter("client", getEntity());
  query.setParameter("defaultScope", defaultScope);
  List<String> ids = query.getResultList();
  // Defaults to openid-connect
  String clientProtocol = getProtocol() == null ? OIDCLoginProtocol.LOGIN_PROTOCOL : getProtocol();
  Map<String, ClientScopeModel> clientScopes = new HashMap<>();
  for (String clientScopeId : ids) {
    ClientScopeModel clientScope = realm.getClientScopeById(clientScopeId);
    if (clientScope == null) continue;
    if (!filterByProtocol || clientScope.getProtocol().equals(clientProtocol)) {
      clientScopes.put(clientScope.getName(), clientScope);
    }
  }
  return clientScopes;
}

代码示例来源:origin: org.keycloak/keycloak-model-jpa

private UserConsentModel toConsentModel(RealmModel realm, FederatedUserConsentEntity entity) {
  if (entity == null) {
    return null;
  }
  StorageId clientStorageId = null;
  if ( entity.getClientId() == null) {
    clientStorageId = new StorageId(entity.getClientStorageProvider(), entity.getExternalClientId());
  } else {
    clientStorageId = new StorageId(entity.getClientId());
  }
  ClientModel client = realm.getClientById(clientStorageId.getId());
  UserConsentModel model = new UserConsentModel(client);
  model.setCreatedDate(entity.getCreatedDate());
  model.setLastUpdatedDate(entity.getLastUpdatedDate());
  Collection<FederatedUserConsentClientScopeEntity> grantedClientScopeEntities = entity.getGrantedClientScopes();
  if (grantedClientScopeEntities != null) {
    for (FederatedUserConsentClientScopeEntity grantedClientScope : grantedClientScopeEntities) {
      ClientScopeModel grantedClientScopeModel = realm.getClientScopeById(grantedClientScope.getScopeId());
      if (grantedClientScopeModel != null) {
        model.addGrantedClientScope(grantedClientScopeModel);
      }
    }
  }
  return model;
}

相关文章

微信公众号

最新文章

更多

RealmModel类方法