@ahmttyydn/java-integration 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +762 -0
- package/README.md +37 -0
- package/package.json +46 -0
- package/pom.xml +242 -0
- package/scalar-core/pom.xml +92 -0
- package/scalar-core/src/main/java/com/scalar/maven/core/ScalarConstants.java +26 -0
- package/scalar-core/src/main/java/com/scalar/maven/core/ScalarHtmlRenderer.java +135 -0
- package/scalar-core/src/main/java/com/scalar/maven/core/ScalarProperties.java +596 -0
- package/scalar-core/src/main/java/com/scalar/maven/core/authentication/ScalarAuthenticationOptions.java +235 -0
- package/scalar-core/src/main/java/com/scalar/maven/core/authentication/flows/AuthorizationCodeFlow.java +160 -0
- package/scalar-core/src/main/java/com/scalar/maven/core/authentication/flows/ClientCredentialsFlow.java +88 -0
- package/scalar-core/src/main/java/com/scalar/maven/core/authentication/flows/ImplicitFlow.java +64 -0
- package/scalar-core/src/main/java/com/scalar/maven/core/authentication/flows/OAuthFlow.java +185 -0
- package/scalar-core/src/main/java/com/scalar/maven/core/authentication/flows/PasswordFlow.java +134 -0
- package/scalar-core/src/main/java/com/scalar/maven/core/authentication/flows/ScalarFlows.java +113 -0
- package/scalar-core/src/main/java/com/scalar/maven/core/authentication/schemes/ScalarApiKeySecurityScheme.java +77 -0
- package/scalar-core/src/main/java/com/scalar/maven/core/authentication/schemes/ScalarHttpSecurityScheme.java +115 -0
- package/scalar-core/src/main/java/com/scalar/maven/core/authentication/schemes/ScalarOAuth2SecurityScheme.java +75 -0
- package/scalar-core/src/main/java/com/scalar/maven/core/authentication/schemes/ScalarSecurityScheme.java +45 -0
- package/scalar-core/src/main/java/com/scalar/maven/core/config/DefaultHttpClient.java +77 -0
- package/scalar-core/src/main/java/com/scalar/maven/core/config/ScalarAgentOptions.java +68 -0
- package/scalar-core/src/main/java/com/scalar/maven/core/config/ScalarServer.java +197 -0
- package/scalar-core/src/main/java/com/scalar/maven/core/config/ScalarSource.java +151 -0
- package/scalar-core/src/main/java/com/scalar/maven/core/enums/CredentialsLocation.java +52 -0
- package/scalar-core/src/main/java/com/scalar/maven/core/enums/DeveloperToolsVisibility.java +58 -0
- package/scalar-core/src/main/java/com/scalar/maven/core/enums/DocumentDownloadType.java +67 -0
- package/scalar-core/src/main/java/com/scalar/maven/core/enums/OperationSorter.java +52 -0
- package/scalar-core/src/main/java/com/scalar/maven/core/enums/OperationTitleSource.java +52 -0
- package/scalar-core/src/main/java/com/scalar/maven/core/enums/Pkce.java +57 -0
- package/scalar-core/src/main/java/com/scalar/maven/core/enums/PropertyOrder.java +53 -0
- package/scalar-core/src/main/java/com/scalar/maven/core/enums/ScalarClient.java +208 -0
- package/scalar-core/src/main/java/com/scalar/maven/core/enums/ScalarLayout.java +52 -0
- package/scalar-core/src/main/java/com/scalar/maven/core/enums/ScalarTarget.java +158 -0
- package/scalar-core/src/main/java/com/scalar/maven/core/enums/ScalarTheme.java +102 -0
- package/scalar-core/src/main/java/com/scalar/maven/core/enums/TagSorter.java +47 -0
- package/scalar-core/src/main/java/com/scalar/maven/core/enums/ThemeMode.java +52 -0
- package/scalar-core/src/main/java/com/scalar/maven/core/internal/ScalarConfiguration.java +425 -0
- package/scalar-core/src/main/java/com/scalar/maven/core/internal/ScalarConfigurationMapper.java +69 -0
- package/scalar-core/src/main/resources/META-INF/resources/webjars/scalar/index.html +22 -0
- package/scalar-core/src/test/java/com/scalar/maven/core/ScalarConfigurationTest.java +144 -0
- package/scalar-core/src/test/java/com/scalar/maven/core/ScalarHtmlRendererTest.java +104 -0
- package/scalar-core/src/test/java/com/scalar/maven/core/ScalarPropertiesTest.java +525 -0
- package/scalar-core/src/test/java/com/scalar/maven/core/config/DefaultHttpClientTest.java +61 -0
- package/scalar-core/src/test/java/com/scalar/maven/core/config/ScalarAgentOptionsTest.java +80 -0
- package/scalar-core/src/test/java/com/scalar/maven/core/config/ScalarServerTest.java +118 -0
- package/scalar-core/src/test/java/com/scalar/maven/core/config/ScalarSourceTest.java +105 -0
- package/scalar-playground-webflux/pom.xml +52 -0
- package/scalar-playground-webflux/src/main/java/com/scalar/maven/playground/CustomScalarWebFluxController.java +34 -0
- package/scalar-playground-webflux/src/main/java/com/scalar/maven/playground/PlaygroundApplication.java +27 -0
- package/scalar-playground-webflux/src/main/resources/application.properties +7 -0
- package/scalar-playground-webmvc/pom.xml +52 -0
- package/scalar-playground-webmvc/src/main/java/com/scalar/maven/playground/CustomScalarWebMvcController.java +34 -0
- package/scalar-playground-webmvc/src/main/java/com/scalar/maven/playground/PlaygroundApplication.java +27 -0
- package/scalar-playground-webmvc/src/main/resources/application.properties +7 -0
- package/scalar-webflux/pom.xml +110 -0
- package/scalar-webflux/src/main/java/com/scalar/maven/webflux/ScalarWebFluxActuatorEndpoint.java +103 -0
- package/scalar-webflux/src/main/java/com/scalar/maven/webflux/ScalarWebFluxAutoConfiguration.java +63 -0
- package/scalar-webflux/src/main/java/com/scalar/maven/webflux/ScalarWebFluxController.java +109 -0
- package/scalar-webflux/src/main/java/com/scalar/maven/webflux/SpringBootScalarProperties.java +43 -0
- package/scalar-webflux/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports +2 -0
- package/scalar-webflux/src/test/java/com/scalar/maven/webflux/ScalarWebFluxActuatorEndpointTest.java +136 -0
- package/scalar-webflux/src/test/java/com/scalar/maven/webflux/ScalarWebFluxControllerTest.java +162 -0
- package/scalar-webmvc/pom.xml +103 -0
- package/scalar-webmvc/src/main/java/com/scalar/maven/webmvc/ScalarWebMvcActuatorEndpoint.java +97 -0
- package/scalar-webmvc/src/main/java/com/scalar/maven/webmvc/ScalarWebMvcAutoConfiguration.java +63 -0
- package/scalar-webmvc/src/main/java/com/scalar/maven/webmvc/ScalarWebMvcController.java +103 -0
- package/scalar-webmvc/src/main/java/com/scalar/maven/webmvc/SpringBootScalarProperties.java +43 -0
- package/scalar-webmvc/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports +2 -0
- package/scalar-webmvc/src/test/java/com/scalar/maven/webmvc/ScalarWebMvcActuatorEndpointTest.java +128 -0
- package/scalar-webmvc/src/test/java/com/scalar/maven/webmvc/ScalarWebMvcControllerTest.java +154 -0
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
package com.scalar.maven.core.authentication;
|
|
2
|
+
|
|
3
|
+
import com.fasterxml.jackson.annotation.JsonIgnore;
|
|
4
|
+
import com.fasterxml.jackson.annotation.JsonInclude;
|
|
5
|
+
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
6
|
+
import com.fasterxml.jackson.annotation.JsonSetter;
|
|
7
|
+
import com.scalar.maven.core.authentication.schemes.ScalarApiKeySecurityScheme;
|
|
8
|
+
import com.scalar.maven.core.authentication.schemes.ScalarHttpSecurityScheme;
|
|
9
|
+
import com.scalar.maven.core.authentication.schemes.ScalarOAuth2SecurityScheme;
|
|
10
|
+
import com.scalar.maven.core.authentication.schemes.ScalarSecurityScheme;
|
|
11
|
+
|
|
12
|
+
import java.util.ArrayList;
|
|
13
|
+
import java.util.List;
|
|
14
|
+
import java.util.Map;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Represents the authentication options for Scalar.
|
|
18
|
+
*/
|
|
19
|
+
@JsonInclude(JsonInclude.Include.NON_NULL)
|
|
20
|
+
public class ScalarAuthenticationOptions {
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Gets or sets the preferred security schemes.
|
|
24
|
+
* Can be a single string, an array for OR relationship, or an array of arrays
|
|
25
|
+
* for AND/OR relationships.
|
|
26
|
+
*/
|
|
27
|
+
@JsonProperty("preferredSecurityScheme")
|
|
28
|
+
private List<String> preferredSecuritySchemes;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Gets or sets the security schemes dictionary.
|
|
32
|
+
* This dictionary allows configuring multiple security schemes by name,
|
|
33
|
+
* enabling more flexible authentication configuration for OpenAPI operations.
|
|
34
|
+
* The key represents the security scheme name as defined in the OpenAPI
|
|
35
|
+
* document,
|
|
36
|
+
* and the value contains the configuration for that specific security scheme.
|
|
37
|
+
*/
|
|
38
|
+
private Map<String, ScalarSecurityScheme> securitySchemes;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Gets or sets the API key security schemes dictionary.
|
|
42
|
+
* Used for Spring Boot property binding. These schemes are automatically
|
|
43
|
+
* merged into the main securitySchemes map.
|
|
44
|
+
* This field is not serialized to JSON.
|
|
45
|
+
*/
|
|
46
|
+
@JsonIgnore
|
|
47
|
+
private Map<String, ScalarApiKeySecurityScheme> apiKey;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Gets or sets the HTTP security schemes dictionary.
|
|
51
|
+
* Used for Spring Boot property binding. These schemes are automatically
|
|
52
|
+
* merged into the main securitySchemes map.
|
|
53
|
+
* This field is not serialized to JSON.
|
|
54
|
+
*/
|
|
55
|
+
@JsonIgnore
|
|
56
|
+
private Map<String, ScalarHttpSecurityScheme> http;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Gets or sets the OAuth2 security schemes dictionary.
|
|
60
|
+
* Used for Spring Boot property binding. These schemes are automatically
|
|
61
|
+
* merged into the main securitySchemes map.
|
|
62
|
+
* This field is not serialized to JSON.
|
|
63
|
+
*/
|
|
64
|
+
@JsonIgnore
|
|
65
|
+
private Map<String, ScalarOAuth2SecurityScheme> oauth2;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Creates a new ScalarAuthenticationOptions.
|
|
69
|
+
*/
|
|
70
|
+
public ScalarAuthenticationOptions() {
|
|
71
|
+
this.securitySchemes = new java.util.HashMap<>();
|
|
72
|
+
this.apiKey = new java.util.HashMap<>();
|
|
73
|
+
this.http = new java.util.HashMap<>();
|
|
74
|
+
this.oauth2 = new java.util.HashMap<>();
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Gets the preferred security schemes.
|
|
79
|
+
*
|
|
80
|
+
* @return the preferred security schemes
|
|
81
|
+
*/
|
|
82
|
+
public List<String> getPreferredSecuritySchemes() {
|
|
83
|
+
return preferredSecuritySchemes;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Sets the preferred security schemes.
|
|
88
|
+
*
|
|
89
|
+
* @param preferredSecuritySchemes the preferred security schemes
|
|
90
|
+
*/
|
|
91
|
+
public void setPreferredSecuritySchemes(List<String> preferredSecuritySchemes) {
|
|
92
|
+
this.preferredSecuritySchemes = preferredSecuritySchemes;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Sets a single preferred security scheme (convenience method).
|
|
97
|
+
* This is converted internally to a list for consistency.
|
|
98
|
+
*
|
|
99
|
+
* @param preferredSecurityScheme the preferred security scheme
|
|
100
|
+
*/
|
|
101
|
+
public void setPreferredSecurityScheme(String preferredSecurityScheme) {
|
|
102
|
+
if (preferredSecurityScheme != null) {
|
|
103
|
+
this.preferredSecuritySchemes = List.of(preferredSecurityScheme);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Custom setter for preferredSecurityScheme that handles both string and list
|
|
109
|
+
* values during JSON deserialization.
|
|
110
|
+
* This is used by Jackson to deserialize both single values and arrays.
|
|
111
|
+
*
|
|
112
|
+
* @param value the preferred security scheme(s) - can be String or List<String>
|
|
113
|
+
*/
|
|
114
|
+
@JsonSetter("preferredSecurityScheme")
|
|
115
|
+
public void setPreferredSecuritySchemeFromJson(Object value) {
|
|
116
|
+
if (value == null) {
|
|
117
|
+
this.preferredSecuritySchemes = null;
|
|
118
|
+
} else if (value instanceof String stringValue) {
|
|
119
|
+
this.preferredSecuritySchemes = List.of(stringValue);
|
|
120
|
+
} else if (value instanceof List rawList) {
|
|
121
|
+
List<String> stringList = new ArrayList<>();
|
|
122
|
+
for (Object item : rawList) {
|
|
123
|
+
if (item instanceof String stringValue) {
|
|
124
|
+
stringList.add(stringValue);
|
|
125
|
+
} else {
|
|
126
|
+
throw new IllegalArgumentException(
|
|
127
|
+
"preferredSecurityScheme list must contain only strings, found: " + item.getClass());
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
this.preferredSecuritySchemes = stringList;
|
|
131
|
+
} else {
|
|
132
|
+
throw new IllegalArgumentException(
|
|
133
|
+
"preferredSecurityScheme must be a String or List<String>, got: " + value.getClass());
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Gets the security schemes dictionary.
|
|
139
|
+
*
|
|
140
|
+
* @return the security schemes dictionary
|
|
141
|
+
*/
|
|
142
|
+
public Map<String, ScalarSecurityScheme> getSecuritySchemes() {
|
|
143
|
+
return securitySchemes;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Sets the security schemes dictionary.
|
|
148
|
+
*
|
|
149
|
+
* @param securitySchemes the security schemes dictionary
|
|
150
|
+
*/
|
|
151
|
+
public void setSecuritySchemes(Map<String, ScalarSecurityScheme> securitySchemes) {
|
|
152
|
+
this.securitySchemes = securitySchemes;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Gets the API key security schemes dictionary.
|
|
157
|
+
*
|
|
158
|
+
* @return the API key security schemes dictionary
|
|
159
|
+
*/
|
|
160
|
+
public Map<String, ScalarApiKeySecurityScheme> getApiKey() {
|
|
161
|
+
return apiKey;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Sets the API key security schemes dictionary.
|
|
166
|
+
*
|
|
167
|
+
* @param apiKey the API key security schemes dictionary
|
|
168
|
+
*/
|
|
169
|
+
public void setApiKey(Map<String, ScalarApiKeySecurityScheme> apiKey) {
|
|
170
|
+
this.apiKey = apiKey;
|
|
171
|
+
mergeSecuritySchemes();
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Gets the HTTP security schemes dictionary.
|
|
176
|
+
*
|
|
177
|
+
* @return the HTTP security schemes dictionary
|
|
178
|
+
*/
|
|
179
|
+
public Map<String, ScalarHttpSecurityScheme> getHttp() {
|
|
180
|
+
return http;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Sets the HTTP security schemes dictionary.
|
|
185
|
+
*
|
|
186
|
+
* @param http the HTTP security schemes dictionary
|
|
187
|
+
*/
|
|
188
|
+
public void setHttp(Map<String, ScalarHttpSecurityScheme> http) {
|
|
189
|
+
this.http = http;
|
|
190
|
+
mergeSecuritySchemes();
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Gets the OAuth2 security schemes dictionary.
|
|
195
|
+
*
|
|
196
|
+
* @return the OAuth2 security schemes dictionary
|
|
197
|
+
*/
|
|
198
|
+
public Map<String, ScalarOAuth2SecurityScheme> getOauth2() {
|
|
199
|
+
return oauth2;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Sets the OAuth2 security schemes dictionary.
|
|
204
|
+
*
|
|
205
|
+
* @param oauth2 the OAuth2 security schemes dictionary
|
|
206
|
+
*/
|
|
207
|
+
public void setOauth2(Map<String, ScalarOAuth2SecurityScheme> oauth2) {
|
|
208
|
+
this.oauth2 = oauth2;
|
|
209
|
+
mergeSecuritySchemes();
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Merges all typed security scheme maps into the main securitySchemes map.
|
|
214
|
+
* This method is called automatically when any of the typed maps are set.
|
|
215
|
+
*/
|
|
216
|
+
private void mergeSecuritySchemes() {
|
|
217
|
+
// Clear existing schemes
|
|
218
|
+
this.securitySchemes.clear();
|
|
219
|
+
|
|
220
|
+
// Add API key schemes
|
|
221
|
+
if (apiKey != null) {
|
|
222
|
+
this.securitySchemes.putAll(apiKey);
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// Add HTTP schemes
|
|
226
|
+
if (http != null) {
|
|
227
|
+
this.securitySchemes.putAll(http);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
// Add OAuth2 schemes
|
|
231
|
+
if (oauth2 != null) {
|
|
232
|
+
this.securitySchemes.putAll(oauth2);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
package com.scalar.maven.core.authentication.flows;
|
|
2
|
+
|
|
3
|
+
import com.fasterxml.jackson.annotation.JsonInclude;
|
|
4
|
+
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
5
|
+
import com.scalar.maven.core.enums.CredentialsLocation;
|
|
6
|
+
import com.scalar.maven.core.enums.Pkce;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Represents the OAuth2 Authorization Code flow configuration.
|
|
10
|
+
*/
|
|
11
|
+
@JsonInclude(JsonInclude.Include.NON_NULL)
|
|
12
|
+
public class AuthorizationCodeFlow extends OAuthFlow {
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Gets or sets the authorization URL to be used for this flow.
|
|
16
|
+
*/
|
|
17
|
+
private String authorizationUrl;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Gets or sets the token URL to be used for this flow.
|
|
21
|
+
*/
|
|
22
|
+
private String tokenUrl;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Gets or sets the client secret used for authentication.
|
|
26
|
+
*/
|
|
27
|
+
private String clientSecret;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Gets or sets whether to use PKCE (Proof Key for Code Exchange) for the authorization code flow.
|
|
31
|
+
*/
|
|
32
|
+
@JsonProperty("x-usePkce")
|
|
33
|
+
private Pkce pkce;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Gets or sets the redirect URI for the authorization code flow.
|
|
37
|
+
*/
|
|
38
|
+
@JsonProperty("x-scalar-redirect-uri")
|
|
39
|
+
private String redirectUri;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Gets or sets the location where authentication credentials should be placed in HTTP requests.
|
|
43
|
+
*/
|
|
44
|
+
@JsonProperty("x-scalar-credentials-location")
|
|
45
|
+
private CredentialsLocation credentialsLocation;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Creates a new AuthorizationCodeFlow.
|
|
49
|
+
*/
|
|
50
|
+
public AuthorizationCodeFlow() {
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Gets the authorization URL.
|
|
55
|
+
*
|
|
56
|
+
* @return the authorization URL
|
|
57
|
+
*/
|
|
58
|
+
public String getAuthorizationUrl() {
|
|
59
|
+
return authorizationUrl;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Sets the authorization URL.
|
|
64
|
+
*
|
|
65
|
+
* @param authorizationUrl the authorization URL
|
|
66
|
+
*/
|
|
67
|
+
public void setAuthorizationUrl(String authorizationUrl) {
|
|
68
|
+
this.authorizationUrl = authorizationUrl;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Gets the token URL.
|
|
73
|
+
*
|
|
74
|
+
* @return the token URL
|
|
75
|
+
*/
|
|
76
|
+
public String getTokenUrl() {
|
|
77
|
+
return tokenUrl;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Sets the token URL.
|
|
82
|
+
*
|
|
83
|
+
* @param tokenUrl the token URL
|
|
84
|
+
*/
|
|
85
|
+
public void setTokenUrl(String tokenUrl) {
|
|
86
|
+
this.tokenUrl = tokenUrl;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Gets the client secret.
|
|
91
|
+
*
|
|
92
|
+
* @return the client secret
|
|
93
|
+
*/
|
|
94
|
+
public String getClientSecret() {
|
|
95
|
+
return clientSecret;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Sets the client secret.
|
|
100
|
+
*
|
|
101
|
+
* @param clientSecret the client secret
|
|
102
|
+
*/
|
|
103
|
+
public void setClientSecret(String clientSecret) {
|
|
104
|
+
this.clientSecret = clientSecret;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Gets the PKCE setting.
|
|
109
|
+
*
|
|
110
|
+
* @return the PKCE setting
|
|
111
|
+
*/
|
|
112
|
+
public Pkce getPkce() {
|
|
113
|
+
return pkce;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Sets the PKCE setting.
|
|
118
|
+
*
|
|
119
|
+
* @param pkce the PKCE setting
|
|
120
|
+
*/
|
|
121
|
+
public void setPkce(Pkce pkce) {
|
|
122
|
+
this.pkce = pkce;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Gets the redirect URI.
|
|
127
|
+
*
|
|
128
|
+
* @return the redirect URI
|
|
129
|
+
*/
|
|
130
|
+
public String getRedirectUri() {
|
|
131
|
+
return redirectUri;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Sets the redirect URI.
|
|
136
|
+
*
|
|
137
|
+
* @param redirectUri the redirect URI
|
|
138
|
+
*/
|
|
139
|
+
public void setRedirectUri(String redirectUri) {
|
|
140
|
+
this.redirectUri = redirectUri;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Gets the credentials location.
|
|
145
|
+
*
|
|
146
|
+
* @return the credentials location
|
|
147
|
+
*/
|
|
148
|
+
public CredentialsLocation getCredentialsLocation() {
|
|
149
|
+
return credentialsLocation;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Sets the credentials location.
|
|
154
|
+
*
|
|
155
|
+
* @param credentialsLocation the credentials location
|
|
156
|
+
*/
|
|
157
|
+
public void setCredentialsLocation(CredentialsLocation credentialsLocation) {
|
|
158
|
+
this.credentialsLocation = credentialsLocation;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
package com.scalar.maven.core.authentication.flows;
|
|
2
|
+
|
|
3
|
+
import com.fasterxml.jackson.annotation.JsonInclude;
|
|
4
|
+
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
5
|
+
import com.scalar.maven.core.enums.CredentialsLocation;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Represents the OAuth2 Client Credentials flow configuration.
|
|
9
|
+
*/
|
|
10
|
+
@JsonInclude(JsonInclude.Include.NON_NULL)
|
|
11
|
+
public class ClientCredentialsFlow extends OAuthFlow {
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Gets or sets the client secret used for authentication.
|
|
15
|
+
*/
|
|
16
|
+
private String clientSecret;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Gets or sets the token URL to be used for this flow.
|
|
20
|
+
*/
|
|
21
|
+
private String tokenUrl;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Gets or sets the location where authentication credentials should be placed in HTTP requests.
|
|
25
|
+
*/
|
|
26
|
+
@JsonProperty("x-scalar-credentials-location")
|
|
27
|
+
private CredentialsLocation credentialsLocation;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Creates a new ClientCredentialsFlow.
|
|
31
|
+
*/
|
|
32
|
+
public ClientCredentialsFlow() {
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Gets the client secret.
|
|
37
|
+
*
|
|
38
|
+
* @return the client secret
|
|
39
|
+
*/
|
|
40
|
+
public String getClientSecret() {
|
|
41
|
+
return clientSecret;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Sets the client secret.
|
|
46
|
+
*
|
|
47
|
+
* @param clientSecret the client secret
|
|
48
|
+
*/
|
|
49
|
+
public void setClientSecret(String clientSecret) {
|
|
50
|
+
this.clientSecret = clientSecret;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Gets the token URL.
|
|
55
|
+
*
|
|
56
|
+
* @return the token URL
|
|
57
|
+
*/
|
|
58
|
+
public String getTokenUrl() {
|
|
59
|
+
return tokenUrl;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Sets the token URL.
|
|
64
|
+
*
|
|
65
|
+
* @param tokenUrl the token URL
|
|
66
|
+
*/
|
|
67
|
+
public void setTokenUrl(String tokenUrl) {
|
|
68
|
+
this.tokenUrl = tokenUrl;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Gets the credentials location.
|
|
73
|
+
*
|
|
74
|
+
* @return the credentials location
|
|
75
|
+
*/
|
|
76
|
+
public CredentialsLocation getCredentialsLocation() {
|
|
77
|
+
return credentialsLocation;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Sets the credentials location.
|
|
82
|
+
*
|
|
83
|
+
* @param credentialsLocation the credentials location
|
|
84
|
+
*/
|
|
85
|
+
public void setCredentialsLocation(CredentialsLocation credentialsLocation) {
|
|
86
|
+
this.credentialsLocation = credentialsLocation;
|
|
87
|
+
}
|
|
88
|
+
}
|
package/scalar-core/src/main/java/com/scalar/maven/core/authentication/flows/ImplicitFlow.java
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
package com.scalar.maven.core.authentication.flows;
|
|
2
|
+
|
|
3
|
+
import com.fasterxml.jackson.annotation.JsonInclude;
|
|
4
|
+
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Represents the OAuth2 Implicit flow configuration.
|
|
8
|
+
*/
|
|
9
|
+
@JsonInclude(JsonInclude.Include.NON_NULL)
|
|
10
|
+
public class ImplicitFlow extends OAuthFlow {
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Gets or sets the authorization URL to be used for this flow.
|
|
14
|
+
*/
|
|
15
|
+
private String authorizationUrl;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Gets or sets the redirect URI for the implicit flow.
|
|
19
|
+
*/
|
|
20
|
+
@JsonProperty("x-scalar-redirect-uri")
|
|
21
|
+
private String redirectUri;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Creates a new ImplicitFlow.
|
|
25
|
+
*/
|
|
26
|
+
public ImplicitFlow() {
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Gets the authorization URL.
|
|
31
|
+
*
|
|
32
|
+
* @return the authorization URL
|
|
33
|
+
*/
|
|
34
|
+
public String getAuthorizationUrl() {
|
|
35
|
+
return authorizationUrl;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Sets the authorization URL.
|
|
40
|
+
*
|
|
41
|
+
* @param authorizationUrl the authorization URL
|
|
42
|
+
*/
|
|
43
|
+
public void setAuthorizationUrl(String authorizationUrl) {
|
|
44
|
+
this.authorizationUrl = authorizationUrl;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Gets the redirect URI.
|
|
49
|
+
*
|
|
50
|
+
* @return the redirect URI
|
|
51
|
+
*/
|
|
52
|
+
public String getRedirectUri() {
|
|
53
|
+
return redirectUri;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Sets the redirect URI.
|
|
58
|
+
*
|
|
59
|
+
* @param redirectUri the redirect URI
|
|
60
|
+
*/
|
|
61
|
+
public void setRedirectUri(String redirectUri) {
|
|
62
|
+
this.redirectUri = redirectUri;
|
|
63
|
+
}
|
|
64
|
+
}
|