Skip to content

Commit eb73606

Browse files
Rename data structure for CredentialProvider
Signed-off-by: gabriel-farache <[email protected]>
1 parent d52de6a commit eb73606

File tree

7 files changed

+27
-27
lines changed

7 files changed

+27
-27
lines changed

client/integration-tests/auth-provider/src/main/java/io/quarkiverse/openapi/generator/it/auth/provider/CustomCredentialsProvider.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ public CustomCredentialsProvider() {
1616
}
1717

1818
@Override
19-
public String getBearerToken(DataInput input) {
19+
public String getBearerToken(CredentialsContext input) {
2020
return super.getBearerToken(input) + "_TEST";
2121
}
2222

2323
@Override
24-
public String getOauth2BearerToken(DataInput input) {
24+
public String getOauth2BearerToken(CredentialsContext input) {
2525
return super.getOauth2BearerToken(input) + "_TEST";
2626
}
2727
}

client/oidc/src/main/java/io/quarkiverse/openapi/generator/oidc/providers/OAuth2AuthenticationProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public void filter(ClientRequestContext requestContext) throws IOException {
4444
bearerToken = this.getTokenForPropagation(requestContext.getHeaders());
4545
} else {
4646
delegate.filter(requestContext);
47-
bearerToken = this.getCredentialsProvider().getOauth2BearerToken(CredentialsProvider.DataInput.builder()
47+
bearerToken = this.getCredentialsProvider().getOauth2BearerToken(CredentialsProvider.CredentialsContext.builder()
4848
.requestContext(requestContext)
4949
.openApiSpecId(getOpenApiSpecId())
5050
.authName(getName())

client/runtime/src/main/java/io/quarkiverse/openapi/generator/providers/ApiKeyAuthenticationProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ && isUseAuthorizationHeaderValue()) {
5959
}
6060

6161
private String getApiKey(ClientRequestContext requestContext) {
62-
return credentialsProvider.getApiKey(CredentialsProvider.DataInput.builder()
62+
return credentialsProvider.getApiKey(CredentialsProvider.CredentialsContext.builder()
6363
.requestContext(requestContext)
6464
.openApiSpecId(getOpenApiSpecId())
6565
.authName(getName())

client/runtime/src/main/java/io/quarkiverse/openapi/generator/providers/BasicAuthenticationProvider.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@ public BasicAuthenticationProvider(final String openApiSpecId, String name, List
2727
}
2828

2929
private String getUsername(ClientRequestContext requestContext) {
30-
return credentialsProvider.getBasicUsername(CredentialsProvider.DataInput.builder()
30+
return credentialsProvider.getBasicUsername(CredentialsProvider.CredentialsContext.builder()
3131
.requestContext(requestContext)
3232
.openApiSpecId(getOpenApiSpecId())
3333
.authName(getName())
3434
.build());
3535
}
3636

3737
private String getPassword(ClientRequestContext requestContext) {
38-
return credentialsProvider.getBasicPassword(CredentialsProvider.DataInput.builder()
38+
return credentialsProvider.getBasicPassword(CredentialsProvider.CredentialsContext.builder()
3939
.requestContext(requestContext)
4040
.openApiSpecId(getOpenApiSpecId())
4141
.authName(getName())

client/runtime/src/main/java/io/quarkiverse/openapi/generator/providers/BearerAuthenticationProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public void filter(ClientRequestContext requestContext) throws IOException {
4040
}
4141

4242
private String getBearerToken(ClientRequestContext requestContext) {
43-
return credentialsProvider.getBearerToken(CredentialsProvider.DataInput.builder()
43+
return credentialsProvider.getBearerToken(CredentialsProvider.CredentialsContext.builder()
4444
.requestContext(requestContext)
4545
.openApiSpecId(getOpenApiSpecId())
4646
.authName(getName())

client/runtime/src/main/java/io/quarkiverse/openapi/generator/providers/ConfigCredentialsProvider.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public ConfigCredentialsProvider() {
2626
}
2727

2828
@Override
29-
public String getApiKey(DataInput input) {
29+
public String getApiKey(CredentialsContext input) {
3030
final String key = ConfigProvider.getConfig()
3131
.getOptionalValue(
3232
AbstractAuthProvider.getCanonicalAuthConfigPropertyName(API_KEY, input.getOpenApiSpecId(),
@@ -42,7 +42,7 @@ public String getApiKey(DataInput input) {
4242
}
4343

4444
@Override
45-
public String getBasicUsername(DataInput input) {
45+
public String getBasicUsername(CredentialsContext input) {
4646
return ConfigProvider.getConfig()
4747
.getOptionalValue(
4848
AbstractAuthProvider.getCanonicalAuthConfigPropertyName(USER_NAME, input.getOpenApiSpecId(),
@@ -52,7 +52,7 @@ public String getBasicUsername(DataInput input) {
5252
}
5353

5454
@Override
55-
public String getBasicPassword(DataInput input) {
55+
public String getBasicPassword(CredentialsContext input) {
5656
return ConfigProvider.getConfig()
5757
.getOptionalValue(
5858
AbstractAuthProvider.getCanonicalAuthConfigPropertyName(PASSWORD, input.getOpenApiSpecId(),
@@ -62,7 +62,7 @@ public String getBasicPassword(DataInput input) {
6262
}
6363

6464
@Override
65-
public String getBearerToken(DataInput input) {
65+
public String getBearerToken(CredentialsContext input) {
6666
return ConfigProvider.getConfig()
6767
.getOptionalValue(
6868
AbstractAuthProvider.getCanonicalAuthConfigPropertyName(BEARER_TOKEN, input.getOpenApiSpecId(),
@@ -72,7 +72,7 @@ public String getBearerToken(DataInput input) {
7272
}
7373

7474
@Override
75-
public String getOauth2BearerToken(DataInput input) {
75+
public String getOauth2BearerToken(CredentialsContext input) {
7676
return input.getRequestContext().getHeaderString(HttpHeaders.AUTHORIZATION);
7777
}
7878
}

client/runtime/src/main/java/io/quarkiverse/openapi/generator/providers/CredentialsProvider.java

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,49 +15,49 @@ public interface CredentialsProvider {
1515
* @param input the input data available to the method
1616
* @return the API Key to use when filtering the request
1717
*/
18-
String getApiKey(DataInput input);
18+
String getApiKey(CredentialsContext input);
1919

2020
/**
2121
* Gets the username given the OpenAPI definition and security schema
2222
*
2323
* @param input the input data available to the method
2424
* @return the username to use when filtering the request
2525
*/
26-
String getBasicUsername(DataInput input);
26+
String getBasicUsername(CredentialsContext input);
2727

2828
/**
2929
* Gets the password given the OpenAPI definition and security schema
3030
*
3131
* @param input the input data available to the method
3232
* @return the password to use when filtering the request
3333
*/
34-
String getBasicPassword(DataInput input);
34+
String getBasicPassword(CredentialsContext input);
3535

3636
/**
3737
* Gets the Bearer Token given the OpenAPI definition and security schema
3838
*
3939
* @param input the input data available to the method
4040
* @return the Bearer Token to use when filtering the request
4141
*/
42-
String getBearerToken(DataInput input);
42+
String getBearerToken(CredentialsContext input);
4343

4444
/**
4545
* Gets the OAuth2 Bearer Token given the OpenAPI definition and security schema
4646
*
4747
* @param input the input data available to the method
4848
* @return the Bearer Token to use when filtering the request
4949
*/
50-
String getOauth2BearerToken(DataInput input);
50+
String getOauth2BearerToken(CredentialsContext input);
5151

52-
class DataInput {
52+
class CredentialsContext {
5353
// requestContext The current request context in which set the authorization header token
5454
private ClientRequestContext requestContext;
5555
// openApiSpecId the OpenAPI Spec identification as defined by the OpenAPI Extension
5656
private String openApiSpecId;
5757
// authName The security schema for this Bearer Token definition
5858
private String authName;
5959

60-
public DataInput(ClientRequestContext requestContext, String openApiSpecId, String authName) {
60+
public CredentialsContext(ClientRequestContext requestContext, String openApiSpecId, String authName) {
6161
this.requestContext = requestContext;
6262
this.openApiSpecId = openApiSpecId;
6363
this.authName = authName;
@@ -75,32 +75,32 @@ public String getAuthName() {
7575
return authName;
7676
}
7777

78-
public static DataInputBuilder builder() {
79-
return new DataInputBuilder();
78+
public static CredentialsContextBuilder builder() {
79+
return new CredentialsContextBuilder();
8080
}
8181

82-
public static class DataInputBuilder {
82+
public static class CredentialsContextBuilder {
8383
private ClientRequestContext requestContext;
8484
private String openApiSpecId;
8585
private String authName;
8686

87-
public DataInputBuilder requestContext(ClientRequestContext requestContext) {
87+
public CredentialsContextBuilder requestContext(ClientRequestContext requestContext) {
8888
this.requestContext = requestContext;
8989
return this;
9090
}
9191

92-
public DataInputBuilder openApiSpecId(String openApiSpecId) {
92+
public CredentialsContextBuilder openApiSpecId(String openApiSpecId) {
9393
this.openApiSpecId = openApiSpecId;
9494
return this;
9595
}
9696

97-
public DataInputBuilder authName(String authName) {
97+
public CredentialsContextBuilder authName(String authName) {
9898
this.authName = authName;
9999
return this;
100100
}
101101

102-
public CredentialsProvider.DataInput build() {
103-
return new CredentialsProvider.DataInput(requestContext, openApiSpecId, authName);
102+
public CredentialsContext build() {
103+
return new CredentialsContext(requestContext, openApiSpecId, authName);
104104
}
105105
}
106106
}

0 commit comments

Comments
 (0)