org.keycloak.admin.client.Keycloak.realms()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(2.5k)|赞(0)|评价(0)|浏览(105)

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

Keycloak.realms介绍

暂无

代码示例

代码示例来源:origin: org.keycloak/keycloak-admin-client

public RealmResource realm(String realmName) {
  return realms().realm(realmName);
}

代码示例来源:origin: EnMasseProject/enmasse

@Override
public Set<String> getRealmNames() {
  return withKeycloak(kc -> kc.realms().findAll().stream()
      .map(RealmRepresentation::getRealm)
      .collect(Collectors.toSet()));
}

代码示例来源:origin: EnMasseProject/enmasse

private RealmResource getRealmResource(Keycloak keycloak, String realmName) {
  List<RealmRepresentation> realms = keycloak.realms().findAll();
  for (RealmRepresentation realm : realms) {
    if (realm.getRealm().equals(realmName)) {
      return keycloak.realm(realmName);
    }
  }
  return null;
}

代码示例来源:origin: org.activiti.cloud/activiti-cloud-services-identity-keycloak

protected RealmResource getRealm(){
  return getKeycloakInstance().realms().realm(keycloakProperties.getRealm());
}

代码示例来源:origin: EnMasseProject/enmasse

private UserList queryUsers(final Predicate<RealmRepresentation> realmPredicate, final Predicate<UserRepresentation> userPredicate) {
  return withKeycloak(keycloak -> {
    List<RealmRepresentation> realmReps = keycloak.realms().findAll();
    UserList userList = new UserList();
    for (RealmRepresentation realmRep : realmReps) {
      if (realmPredicate.test(realmRep)) {
        String realm = realmRep.getRealm();
        keycloak.realm(realm).users().list()
                .stream()
                .filter(userPredicate)
                .forEachOrdered(userRep -> {
                  List<GroupRepresentation> groupReps = keycloak.realm(realm).users().get(userRep.getId()).groups();
                  userList.getItems().add(buildUser(userRep, groupReps));
                });
      }
    }
    return userList;
  });
}

代码示例来源:origin: EnMasseProject/enmasse

@Override
public void deleteUsers(String namespace) {
  withKeycloak(keycloak -> {
    List<RealmRepresentation> realmReps = keycloak.realms().findAll();
    for (RealmRepresentation realmRep : realmReps) {
      String realmNs = realmRep.getAttributes().get("namespace");
      if (realmNs != null && realmNs.equals(namespace)) {
        String realm = realmRep.getRealm();
        List<UserRepresentation> userReps = keycloak.realm(realm).users().list(0, 100);
        while (!userReps.isEmpty()) {
          for (UserRepresentation userRep : userReps) {
            keycloak.realm(realm).users().delete(userRep.getId());
          }
          userReps = keycloak.realm(realm).users().list(0, 100);
        }
      }
    }
    return null;
  });
}

代码示例来源:origin: EnMasseProject/enmasse

kc.realms().create(newRealm);
realmState.put(realmName, params);
return true;

相关文章