|
|
@@ -1,5 +1,6 @@
|
|
|
package com.inspur.customer;
|
|
|
|
|
|
+import com.inspur.customer.service.client.keycloak.KeycloakService;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
import org.keycloak.admin.client.Keycloak;
|
|
|
@@ -24,14 +25,11 @@ public class KeycloakTest {
|
|
|
@Value("${keycloak.realm}")
|
|
|
private String realm;
|
|
|
|
|
|
+ @Resource
|
|
|
+ KeycloakService keycloakService;
|
|
|
+
|
|
|
@Test
|
|
|
void test() {
|
|
|
- List<UserRepresentation> userRepresentations = keycloak.realm(realm).users().searchByAttributes("wechat-applet-openid:oLBkj42qubLayXZWmFlGnKh5X");
|
|
|
- for (UserRepresentation userRepresentation : userRepresentations) {
|
|
|
- log.info(userRepresentation.toString());
|
|
|
- log.info(userRepresentation.getUsername());
|
|
|
- Optional.ofNullable(userRepresentation.getAttributes()).ifPresent(t -> log.info(t.toString()));
|
|
|
- log.info("_______________________________");
|
|
|
- }
|
|
|
+ log.info(keycloakService.getUserTenant("9d0bcc7c-7fc3-492a-954d-c3f86246bbcd"));
|
|
|
}
|
|
|
}
|