<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-admin-client</artifactId>
<version>${keycloak.version}</version>
</dependency>
키클락 버전에 맞춰 의존성을 추가해준다.
Keycloak kc = KeycloakBuilder.builder()
.serverUrl("http://your.keycloak.domain/auth")
.realm("master")
.username("admin")
.password("secret")
.clientId("admin-cli")
.resteasyClient(
new ResteasyClientBuilder()
.connectionPoolSize(10).build()
).build();
인증서버 url, 렐름, 클라이언트 id, 사용자 계정과 비밀번호를 입력한다.
UserRepresentation user = new UserRepresentation();
user.setUsername("johndoe");
user.set... // all the user attributes to set
kc.realm("demo").users().create(user);
키클락에서 렐름을 설정하고 유저를 생성해주면 완료된다. (201)
'ETC' 카테고리의 다른 글
[크롬] 자주 사용하는 단축키 (0) | 2022.09.15 |
---|---|
[HTML] head vs header (0) | 2022.03.29 |
[Firebase] 실시간 데이터베이스 문자열 검색 기능 (0) | 2021.11.06 |
[용어] 프록시 서버 (0) | 2021.06.15 |
[GitHub] 저장소(repository) 이름 정하기 (0) | 2021.04.06 |