Skip to content

Commit c815565

Browse files
authored
Add configuration properties metadata (#56)
## Description Add JavaDoc to configuration properties and generate metadata during builds. ## Review Checklist - [x] I have clicked on ["allow edits by maintainers"](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork). - [x] I have added documentation for new/changed functionality in this PR or in a PR to [openfga.dev](https://github.com/openfga/openfga.dev) [Provide a link to any relevant PRs in the references section above] - [x] The correct base branch is being used, if not `main` - [ ] I have added tests to validate that the change in functionality is working as expected
2 parents 2ba1379 + b0ef599 commit c815565

File tree

2 files changed

+47
-1
lines changed

2 files changed

+47
-1
lines changed

build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ dependencyManagement {
3737
}
3838

3939
dependencies {
40+
annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
41+
4042
implementation 'org.springframework.boot:spring-boot'
4143
implementation 'org.springframework.boot:spring-boot-autoconfigure'
4244
implementation 'org.springframework.boot:spring-boot-starter-security'

src/main/java/dev/openfga/autoconfigure/OpenFgaProperties.java

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,24 @@
99
@ConfigurationProperties(prefix = "openfga")
1010
public class OpenFgaProperties implements InitializingBean {
1111

12+
/**
13+
* URL to OpenFGA instance.
14+
* If configured, beans will be initialized.
15+
*/
1216
private String apiUrl;
17+
/**
18+
* The ID of the store to use.
19+
*/
1320
private String storeId;
21+
22+
/**
23+
* The ID of the authorization model to use.
24+
*/
1425
private String authorizationModelId;
1526

27+
/**
28+
* The credentials for the OpenFGA client.
29+
*/
1630
private Credentials credentials;
1731

1832
public String getApiUrl() {
@@ -88,7 +102,13 @@ public void validate() {
88102
*/
89103
public static class Credentials {
90104

105+
/**
106+
* The authentication method to use for the OpenFGA client.
107+
*/
91108
private CredentialsMethod method;
109+
/**
110+
* Authentication config for the OpenFGA client.
111+
*/
92112
private CredentialsConfiguration config;
93113

94114
public CredentialsMethod getMethod() {
@@ -136,12 +156,36 @@ public enum CredentialsMethod {
136156
* {@link dev.openfga.sdk.api.client.OpenFgaClient} credentials configuration properties
137157
*/
138158
public static class CredentialsConfiguration {
159+
/**
160+
* The API token used to authenticate the client at OpenFGA.
161+
* Required, if {@code API_TOKEN} method should be used.
162+
*/
139163
private String apiToken;
164+
/**
165+
* The API token issuer, used as an additional check.
166+
* Required, if {@code CLIENT_CREDENTIALS} method should be used.
167+
*/
140168
private String apiTokenIssuer;
169+
/**
170+
* The API audience.
171+
* If configured and if {@code CLIENT_CREDENTIALS} is used,
172+
* the client will use this audience to obtain an access token.
173+
*/
141174
private String apiAudience;
175+
/**
176+
* The OAuth2 client ID.
177+
* Required, if {@code CLIENT_CREDENTIALS} method should be used.
178+
*/
142179
private String clientId;
180+
/**
181+
* The OAuth2 client secret.
182+
* Required, if {@code CLIENT_CREDENTIALS} method should be used.
183+
*/
143184
private String clientSecret;
144-
185+
/**
186+
* Space seperated list of OAuth2 scopes used to
187+
* obtain an access token.
188+
*/
145189
private String scopes;
146190

147191
public String getApiTokenIssuer() {

0 commit comments

Comments
 (0)