View Javadoc
1   /*
2    * Copyright 2026 the original author or authors.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.bremersee.spring.boot.autoconfigure.keycloak;
18  
19  import lombok.Data;
20  import lombok.EqualsAndHashCode;
21  import lombok.Getter;
22  import lombok.Setter;
23  import lombok.ToString;
24  import org.springframework.boot.context.properties.ConfigurationProperties;
25  
26  /**
27   * The keycloak client properties.
28   *
29   * @author Christian Bremer
30   */
31  @ConfigurationProperties(prefix = "bremersee.keycloak")
32  @Data
33  public class KeycloakProperties {
34  
35    /**
36     * The keycloak base uri. For example {@code https://keycloak.example.org}.
37     */
38    private String baseUri;
39  
40    /**
41     * The default keycloak realm.
42     */
43    private String realm;
44  
45    /**
46     * The admin client properties.
47     */
48    private KeycloakAdminClientProperties adminClient = new KeycloakAdminClientProperties();
49  
50    /**
51     * Instantiates new keycloak client properties.
52     */
53    public KeycloakProperties() {
54      super();
55    }
56  
57    /**
58     * The keycloak admin client properties.
59     *
60     * @author Christian Bremer
61     */
62    @Getter
63    @Setter
64    @EqualsAndHashCode
65    @ToString(exclude = {"password"})
66    public static class KeycloakAdminClientProperties {
67  
68      /**
69       * Specifies whether the admin client should be created or not.
70       */
71      private boolean enabled;
72  
73      /**
74       * The login realm. Default is {@code master}.
75       */
76      private String loginRealm = "master";
77  
78      /**
79       * The client id. Default is {@code admin-cli}.
80       */
81      private String clientId = "admin-cli";
82  
83      /**
84       * The usersame.
85       */
86      private String username;
87  
88      /**
89       * The password.
90       */
91      private String password;
92  
93      /**
94       * Instantiates a keycloak admin client properties.
95       */
96      public KeycloakAdminClientProperties() {
97        super();
98      }
99    }
100 
101 }