@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.
Files changed (70) hide show
  1. package/CHANGELOG.md +762 -0
  2. package/README.md +37 -0
  3. package/package.json +46 -0
  4. package/pom.xml +242 -0
  5. package/scalar-core/pom.xml +92 -0
  6. package/scalar-core/src/main/java/com/scalar/maven/core/ScalarConstants.java +26 -0
  7. package/scalar-core/src/main/java/com/scalar/maven/core/ScalarHtmlRenderer.java +135 -0
  8. package/scalar-core/src/main/java/com/scalar/maven/core/ScalarProperties.java +596 -0
  9. package/scalar-core/src/main/java/com/scalar/maven/core/authentication/ScalarAuthenticationOptions.java +235 -0
  10. package/scalar-core/src/main/java/com/scalar/maven/core/authentication/flows/AuthorizationCodeFlow.java +160 -0
  11. package/scalar-core/src/main/java/com/scalar/maven/core/authentication/flows/ClientCredentialsFlow.java +88 -0
  12. package/scalar-core/src/main/java/com/scalar/maven/core/authentication/flows/ImplicitFlow.java +64 -0
  13. package/scalar-core/src/main/java/com/scalar/maven/core/authentication/flows/OAuthFlow.java +185 -0
  14. package/scalar-core/src/main/java/com/scalar/maven/core/authentication/flows/PasswordFlow.java +134 -0
  15. package/scalar-core/src/main/java/com/scalar/maven/core/authentication/flows/ScalarFlows.java +113 -0
  16. package/scalar-core/src/main/java/com/scalar/maven/core/authentication/schemes/ScalarApiKeySecurityScheme.java +77 -0
  17. package/scalar-core/src/main/java/com/scalar/maven/core/authentication/schemes/ScalarHttpSecurityScheme.java +115 -0
  18. package/scalar-core/src/main/java/com/scalar/maven/core/authentication/schemes/ScalarOAuth2SecurityScheme.java +75 -0
  19. package/scalar-core/src/main/java/com/scalar/maven/core/authentication/schemes/ScalarSecurityScheme.java +45 -0
  20. package/scalar-core/src/main/java/com/scalar/maven/core/config/DefaultHttpClient.java +77 -0
  21. package/scalar-core/src/main/java/com/scalar/maven/core/config/ScalarAgentOptions.java +68 -0
  22. package/scalar-core/src/main/java/com/scalar/maven/core/config/ScalarServer.java +197 -0
  23. package/scalar-core/src/main/java/com/scalar/maven/core/config/ScalarSource.java +151 -0
  24. package/scalar-core/src/main/java/com/scalar/maven/core/enums/CredentialsLocation.java +52 -0
  25. package/scalar-core/src/main/java/com/scalar/maven/core/enums/DeveloperToolsVisibility.java +58 -0
  26. package/scalar-core/src/main/java/com/scalar/maven/core/enums/DocumentDownloadType.java +67 -0
  27. package/scalar-core/src/main/java/com/scalar/maven/core/enums/OperationSorter.java +52 -0
  28. package/scalar-core/src/main/java/com/scalar/maven/core/enums/OperationTitleSource.java +52 -0
  29. package/scalar-core/src/main/java/com/scalar/maven/core/enums/Pkce.java +57 -0
  30. package/scalar-core/src/main/java/com/scalar/maven/core/enums/PropertyOrder.java +53 -0
  31. package/scalar-core/src/main/java/com/scalar/maven/core/enums/ScalarClient.java +208 -0
  32. package/scalar-core/src/main/java/com/scalar/maven/core/enums/ScalarLayout.java +52 -0
  33. package/scalar-core/src/main/java/com/scalar/maven/core/enums/ScalarTarget.java +158 -0
  34. package/scalar-core/src/main/java/com/scalar/maven/core/enums/ScalarTheme.java +102 -0
  35. package/scalar-core/src/main/java/com/scalar/maven/core/enums/TagSorter.java +47 -0
  36. package/scalar-core/src/main/java/com/scalar/maven/core/enums/ThemeMode.java +52 -0
  37. package/scalar-core/src/main/java/com/scalar/maven/core/internal/ScalarConfiguration.java +425 -0
  38. package/scalar-core/src/main/java/com/scalar/maven/core/internal/ScalarConfigurationMapper.java +69 -0
  39. package/scalar-core/src/main/resources/META-INF/resources/webjars/scalar/index.html +22 -0
  40. package/scalar-core/src/test/java/com/scalar/maven/core/ScalarConfigurationTest.java +144 -0
  41. package/scalar-core/src/test/java/com/scalar/maven/core/ScalarHtmlRendererTest.java +104 -0
  42. package/scalar-core/src/test/java/com/scalar/maven/core/ScalarPropertiesTest.java +525 -0
  43. package/scalar-core/src/test/java/com/scalar/maven/core/config/DefaultHttpClientTest.java +61 -0
  44. package/scalar-core/src/test/java/com/scalar/maven/core/config/ScalarAgentOptionsTest.java +80 -0
  45. package/scalar-core/src/test/java/com/scalar/maven/core/config/ScalarServerTest.java +118 -0
  46. package/scalar-core/src/test/java/com/scalar/maven/core/config/ScalarSourceTest.java +105 -0
  47. package/scalar-playground-webflux/pom.xml +52 -0
  48. package/scalar-playground-webflux/src/main/java/com/scalar/maven/playground/CustomScalarWebFluxController.java +34 -0
  49. package/scalar-playground-webflux/src/main/java/com/scalar/maven/playground/PlaygroundApplication.java +27 -0
  50. package/scalar-playground-webflux/src/main/resources/application.properties +7 -0
  51. package/scalar-playground-webmvc/pom.xml +52 -0
  52. package/scalar-playground-webmvc/src/main/java/com/scalar/maven/playground/CustomScalarWebMvcController.java +34 -0
  53. package/scalar-playground-webmvc/src/main/java/com/scalar/maven/playground/PlaygroundApplication.java +27 -0
  54. package/scalar-playground-webmvc/src/main/resources/application.properties +7 -0
  55. package/scalar-webflux/pom.xml +110 -0
  56. package/scalar-webflux/src/main/java/com/scalar/maven/webflux/ScalarWebFluxActuatorEndpoint.java +103 -0
  57. package/scalar-webflux/src/main/java/com/scalar/maven/webflux/ScalarWebFluxAutoConfiguration.java +63 -0
  58. package/scalar-webflux/src/main/java/com/scalar/maven/webflux/ScalarWebFluxController.java +109 -0
  59. package/scalar-webflux/src/main/java/com/scalar/maven/webflux/SpringBootScalarProperties.java +43 -0
  60. package/scalar-webflux/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports +2 -0
  61. package/scalar-webflux/src/test/java/com/scalar/maven/webflux/ScalarWebFluxActuatorEndpointTest.java +136 -0
  62. package/scalar-webflux/src/test/java/com/scalar/maven/webflux/ScalarWebFluxControllerTest.java +162 -0
  63. package/scalar-webmvc/pom.xml +103 -0
  64. package/scalar-webmvc/src/main/java/com/scalar/maven/webmvc/ScalarWebMvcActuatorEndpoint.java +97 -0
  65. package/scalar-webmvc/src/main/java/com/scalar/maven/webmvc/ScalarWebMvcAutoConfiguration.java +63 -0
  66. package/scalar-webmvc/src/main/java/com/scalar/maven/webmvc/ScalarWebMvcController.java +103 -0
  67. package/scalar-webmvc/src/main/java/com/scalar/maven/webmvc/SpringBootScalarProperties.java +43 -0
  68. package/scalar-webmvc/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports +2 -0
  69. package/scalar-webmvc/src/test/java/com/scalar/maven/webmvc/ScalarWebMvcActuatorEndpointTest.java +128 -0
  70. package/scalar-webmvc/src/test/java/com/scalar/maven/webmvc/ScalarWebMvcControllerTest.java +154 -0
@@ -0,0 +1,185 @@
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
+ import java.util.List;
7
+ import java.util.Map;
8
+
9
+ /**
10
+ * Base class containing common properties for all OAuth2 flows.
11
+ */
12
+ @JsonInclude(JsonInclude.Include.NON_NULL)
13
+ public abstract class OAuthFlow {
14
+
15
+ /**
16
+ * Gets or sets the URL to be used for obtaining refresh tokens.
17
+ */
18
+ private String refreshUrl;
19
+
20
+ /**
21
+ * Gets or sets the preselected scopes for the request.
22
+ */
23
+ private List<String> selectedScopes;
24
+
25
+ /**
26
+ * Gets or sets the client ID associated with the OAuth flow.
27
+ */
28
+ @JsonProperty("x-scalar-client-id")
29
+ private String clientId;
30
+
31
+ /**
32
+ * Gets or sets the authentication token.
33
+ */
34
+ private String token;
35
+
36
+ /**
37
+ * Gets or sets additional query parameters that should be included in the auth request.
38
+ */
39
+ @JsonProperty("x-scalar-security-query")
40
+ private Map<String, String> additionalQueryParameters;
41
+
42
+ /**
43
+ * Gets or sets additional body parameters that should be included in the token request.
44
+ */
45
+ @JsonProperty("x-scalar-security-body")
46
+ private Map<String, String> additionalBodyParameters;
47
+
48
+ /**
49
+ * Gets or sets the name of the token used in the OAuth flow.
50
+ */
51
+ @JsonProperty("x-tokenName")
52
+ private String tokenName;
53
+
54
+ /**
55
+ * Creates a new OAuthFlow.
56
+ */
57
+ protected OAuthFlow() {
58
+ }
59
+
60
+ /**
61
+ * Gets the refresh URL.
62
+ *
63
+ * @return the refresh URL
64
+ */
65
+ public String getRefreshUrl() {
66
+ return refreshUrl;
67
+ }
68
+
69
+ /**
70
+ * Sets the refresh URL.
71
+ *
72
+ * @param refreshUrl the refresh URL
73
+ */
74
+ public void setRefreshUrl(String refreshUrl) {
75
+ this.refreshUrl = refreshUrl;
76
+ }
77
+
78
+ /**
79
+ * Gets the selected scopes.
80
+ *
81
+ * @return the selected scopes
82
+ */
83
+ public List<String> getSelectedScopes() {
84
+ return selectedScopes;
85
+ }
86
+
87
+ /**
88
+ * Sets the selected scopes.
89
+ *
90
+ * @param selectedScopes the selected scopes
91
+ */
92
+ public void setSelectedScopes(List<String> selectedScopes) {
93
+ this.selectedScopes = selectedScopes;
94
+ }
95
+
96
+ /**
97
+ * Gets the client ID.
98
+ *
99
+ * @return the client ID
100
+ */
101
+ public String getClientId() {
102
+ return clientId;
103
+ }
104
+
105
+ /**
106
+ * Sets the client ID.
107
+ *
108
+ * @param clientId the client ID
109
+ */
110
+ public void setClientId(String clientId) {
111
+ this.clientId = clientId;
112
+ }
113
+
114
+ /**
115
+ * Gets the token.
116
+ *
117
+ * @return the token
118
+ */
119
+ public String getToken() {
120
+ return token;
121
+ }
122
+
123
+ /**
124
+ * Sets the token.
125
+ *
126
+ * @param token the token
127
+ */
128
+ public void setToken(String token) {
129
+ this.token = token;
130
+ }
131
+
132
+ /**
133
+ * Gets the additional query parameters.
134
+ *
135
+ * @return the additional query parameters
136
+ */
137
+ public Map<String, String> getAdditionalQueryParameters() {
138
+ return additionalQueryParameters;
139
+ }
140
+
141
+ /**
142
+ * Sets the additional query parameters.
143
+ *
144
+ * @param additionalQueryParameters the additional query parameters
145
+ */
146
+ public void setAdditionalQueryParameters(Map<String, String> additionalQueryParameters) {
147
+ this.additionalQueryParameters = additionalQueryParameters;
148
+ }
149
+
150
+ /**
151
+ * Gets the additional body parameters.
152
+ *
153
+ * @return the additional body parameters
154
+ */
155
+ public Map<String, String> getAdditionalBodyParameters() {
156
+ return additionalBodyParameters;
157
+ }
158
+
159
+ /**
160
+ * Sets the additional body parameters.
161
+ *
162
+ * @param additionalBodyParameters the additional body parameters
163
+ */
164
+ public void setAdditionalBodyParameters(Map<String, String> additionalBodyParameters) {
165
+ this.additionalBodyParameters = additionalBodyParameters;
166
+ }
167
+
168
+ /**
169
+ * Gets the token name.
170
+ *
171
+ * @return the token name
172
+ */
173
+ public String getTokenName() {
174
+ return tokenName;
175
+ }
176
+
177
+ /**
178
+ * Sets the token name.
179
+ *
180
+ * @param tokenName the token name
181
+ */
182
+ public void setTokenName(String tokenName) {
183
+ this.tokenName = tokenName;
184
+ }
185
+ }
@@ -0,0 +1,134 @@
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 Password flow configuration.
9
+ */
10
+ @JsonInclude(JsonInclude.Include.NON_NULL)
11
+ public class PasswordFlow 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 default username for the password flow.
25
+ */
26
+ private String username;
27
+
28
+ /**
29
+ * Gets or sets the default password for the password flow.
30
+ */
31
+ private String password;
32
+
33
+ /**
34
+ * Gets or sets the location where authentication credentials should be placed in HTTP requests.
35
+ */
36
+ @JsonProperty("x-scalar-credentials-location")
37
+ private CredentialsLocation credentialsLocation;
38
+
39
+ /**
40
+ * Creates a new PasswordFlow.
41
+ */
42
+ public PasswordFlow() {
43
+ }
44
+
45
+ /**
46
+ * Gets the client secret.
47
+ *
48
+ * @return the client secret
49
+ */
50
+ public String getClientSecret() {
51
+ return clientSecret;
52
+ }
53
+
54
+ /**
55
+ * Sets the client secret.
56
+ *
57
+ * @param clientSecret the client secret
58
+ */
59
+ public void setClientSecret(String clientSecret) {
60
+ this.clientSecret = clientSecret;
61
+ }
62
+
63
+ /**
64
+ * Gets the token URL.
65
+ *
66
+ * @return the token URL
67
+ */
68
+ public String getTokenUrl() {
69
+ return tokenUrl;
70
+ }
71
+
72
+ /**
73
+ * Sets the token URL.
74
+ *
75
+ * @param tokenUrl the token URL
76
+ */
77
+ public void setTokenUrl(String tokenUrl) {
78
+ this.tokenUrl = tokenUrl;
79
+ }
80
+
81
+ /**
82
+ * Gets the username.
83
+ *
84
+ * @return the username
85
+ */
86
+ public String getUsername() {
87
+ return username;
88
+ }
89
+
90
+ /**
91
+ * Sets the username.
92
+ *
93
+ * @param username the username
94
+ */
95
+ public void setUsername(String username) {
96
+ this.username = username;
97
+ }
98
+
99
+ /**
100
+ * Gets the password.
101
+ *
102
+ * @return the password
103
+ */
104
+ public String getPassword() {
105
+ return password;
106
+ }
107
+
108
+ /**
109
+ * Sets the password.
110
+ *
111
+ * @param password the password
112
+ */
113
+ public void setPassword(String password) {
114
+ this.password = password;
115
+ }
116
+
117
+ /**
118
+ * Gets the credentials location.
119
+ *
120
+ * @return the credentials location
121
+ */
122
+ public CredentialsLocation getCredentialsLocation() {
123
+ return credentialsLocation;
124
+ }
125
+
126
+ /**
127
+ * Sets the credentials location.
128
+ *
129
+ * @param credentialsLocation the credentials location
130
+ */
131
+ public void setCredentialsLocation(CredentialsLocation credentialsLocation) {
132
+ this.credentialsLocation = credentialsLocation;
133
+ }
134
+ }
@@ -0,0 +1,113 @@
1
+ package com.scalar.maven.core.authentication.flows;
2
+
3
+ import com.fasterxml.jackson.annotation.JsonInclude;
4
+
5
+ /**
6
+ * Represents the available OAuth 2.0 flows for authentication.
7
+ * This class defines the different OAuth 2.0 flow types that can be used for
8
+ * authentication.
9
+ * Each flow type has its own configuration properties that are used to prefill
10
+ * or overwrite
11
+ * values during the authentication process.
12
+ */
13
+ @JsonInclude(JsonInclude.Include.NON_NULL)
14
+ public class ScalarFlows {
15
+
16
+ /**
17
+ * Gets or sets the implicit flow configuration.
18
+ */
19
+ private ImplicitFlow implicit;
20
+
21
+ /**
22
+ * Gets or sets the password flow configuration.
23
+ */
24
+ private PasswordFlow password;
25
+
26
+ /**
27
+ * Gets or sets the client credentials flow configuration.
28
+ */
29
+ private ClientCredentialsFlow clientCredentials;
30
+
31
+ /**
32
+ * Gets or sets the authorization code flow configuration.
33
+ */
34
+ private AuthorizationCodeFlow authorizationCode;
35
+
36
+ /**
37
+ * Creates a new ScalarFlows.
38
+ */
39
+ public ScalarFlows() {
40
+ }
41
+
42
+ /**
43
+ * Gets the implicit flow configuration.
44
+ *
45
+ * @return the implicit flow configuration
46
+ */
47
+ public ImplicitFlow getImplicit() {
48
+ return implicit;
49
+ }
50
+
51
+ /**
52
+ * Sets the implicit flow configuration.
53
+ *
54
+ * @param implicit the implicit flow configuration
55
+ */
56
+ public void setImplicit(ImplicitFlow implicit) {
57
+ this.implicit = implicit;
58
+ }
59
+
60
+ /**
61
+ * Gets the password flow configuration.
62
+ *
63
+ * @return the password flow configuration
64
+ */
65
+ public PasswordFlow getPassword() {
66
+ return password;
67
+ }
68
+
69
+ /**
70
+ * Sets the password flow configuration.
71
+ *
72
+ * @param password the password flow configuration
73
+ */
74
+ public void setPassword(PasswordFlow password) {
75
+ this.password = password;
76
+ }
77
+
78
+ /**
79
+ * Gets the client credentials flow configuration.
80
+ *
81
+ * @return the client credentials flow configuration
82
+ */
83
+ public ClientCredentialsFlow getClientCredentials() {
84
+ return clientCredentials;
85
+ }
86
+
87
+ /**
88
+ * Sets the client credentials flow configuration.
89
+ *
90
+ * @param clientCredentials the client credentials flow configuration
91
+ */
92
+ public void setClientCredentials(ClientCredentialsFlow clientCredentials) {
93
+ this.clientCredentials = clientCredentials;
94
+ }
95
+
96
+ /**
97
+ * Gets the authorization code flow configuration.
98
+ *
99
+ * @return the authorization code flow configuration
100
+ */
101
+ public AuthorizationCodeFlow getAuthorizationCode() {
102
+ return authorizationCode;
103
+ }
104
+
105
+ /**
106
+ * Sets the authorization code flow configuration.
107
+ *
108
+ * @param authorizationCode the authorization code flow configuration
109
+ */
110
+ public void setAuthorizationCode(AuthorizationCodeFlow authorizationCode) {
111
+ this.authorizationCode = authorizationCode;
112
+ }
113
+ }
@@ -0,0 +1,77 @@
1
+ package com.scalar.maven.core.authentication.schemes;
2
+
3
+ import com.fasterxml.jackson.annotation.JsonInclude;
4
+
5
+ /**
6
+ * Represents a security scheme that uses HTTP header authentication.
7
+ * This scheme is used to prefill or overwrite HTTP header values for authentication purposes
8
+ * when making API requests. It allows specifying a custom header name and value pair.
9
+ */
10
+ @JsonInclude(JsonInclude.Include.NON_NULL)
11
+ public class ScalarApiKeySecurityScheme extends ScalarSecurityScheme {
12
+
13
+ /**
14
+ * Gets or sets the name of the HTTP header to be used for authentication.
15
+ * Common examples include "Authorization", "X-API-Key", or custom header names.
16
+ */
17
+ private String name;
18
+
19
+ /**
20
+ * Gets or sets the value of the HTTP header to be used for authentication.
21
+ * This value will be sent as-is in the specified header. For example, "Bearer token123" or "ApiKey abc123".
22
+ */
23
+ private String value;
24
+
25
+ /**
26
+ * Creates a new ScalarApiKeySecurityScheme.
27
+ */
28
+ public ScalarApiKeySecurityScheme() {
29
+ }
30
+
31
+ /**
32
+ * Creates a new ScalarApiKeySecurityScheme with the specified name and value.
33
+ *
34
+ * @param name the header name
35
+ * @param value the header value
36
+ */
37
+ public ScalarApiKeySecurityScheme(String name, String value) {
38
+ this.name = name;
39
+ this.value = value;
40
+ }
41
+
42
+ /**
43
+ * Gets the name of the HTTP header.
44
+ *
45
+ * @return the header name
46
+ */
47
+ public String getName() {
48
+ return name;
49
+ }
50
+
51
+ /**
52
+ * Sets the name of the HTTP header.
53
+ *
54
+ * @param name the header name
55
+ */
56
+ public void setName(String name) {
57
+ this.name = name;
58
+ }
59
+
60
+ /**
61
+ * Gets the value of the HTTP header.
62
+ *
63
+ * @return the header value
64
+ */
65
+ public String getValue() {
66
+ return value;
67
+ }
68
+
69
+ /**
70
+ * Sets the value of the HTTP header.
71
+ *
72
+ * @param value the header value
73
+ */
74
+ public void setValue(String value) {
75
+ this.value = value;
76
+ }
77
+ }
@@ -0,0 +1,115 @@
1
+ package com.scalar.maven.core.authentication.schemes;
2
+
3
+ import com.fasterxml.jackson.annotation.JsonInclude;
4
+
5
+ /**
6
+ * Represents a security scheme that uses HTTP authentication mechanisms like Basic or Bearer.
7
+ * This scheme is used to prefill or overwrite authentication values.
8
+ * It supports both Basic authentication (username/password) and Bearer authentication (token).
9
+ */
10
+ @JsonInclude(JsonInclude.Include.NON_NULL)
11
+ public class ScalarHttpSecurityScheme extends ScalarSecurityScheme {
12
+
13
+ /**
14
+ * Gets or sets the username used for HTTP basic authentication.
15
+ * When provided, this value will be used to prefill or overwrite the username
16
+ * for Basic authentication requests.
17
+ */
18
+ private String username;
19
+
20
+ /**
21
+ * Gets or sets the password used for HTTP basic authentication.
22
+ * When provided, this value will be used to prefill or overwrite the password
23
+ * for Basic authentication requests.
24
+ */
25
+ private String password;
26
+
27
+ /**
28
+ * Gets or sets the token used for HTTP bearer authentication.
29
+ * When provided, this value will be used to prefill or overwrite the token
30
+ * for Bearer authentication requests.
31
+ */
32
+ private String token;
33
+
34
+ /**
35
+ * Creates a new ScalarHttpSecurityScheme.
36
+ */
37
+ public ScalarHttpSecurityScheme() {
38
+ }
39
+
40
+ /**
41
+ * Creates a new ScalarHttpSecurityScheme for Basic authentication.
42
+ *
43
+ * @param username the username
44
+ * @param password the password
45
+ */
46
+ public ScalarHttpSecurityScheme(String username, String password) {
47
+ this.username = username;
48
+ this.password = password;
49
+ }
50
+
51
+ /**
52
+ * Creates a new ScalarHttpSecurityScheme for Bearer authentication.
53
+ *
54
+ * @param token the bearer token
55
+ */
56
+ public static ScalarHttpSecurityScheme forBearer(String token) {
57
+ ScalarHttpSecurityScheme scheme = new ScalarHttpSecurityScheme();
58
+ scheme.setToken(token);
59
+ return scheme;
60
+ }
61
+
62
+ /**
63
+ * Gets the username.
64
+ *
65
+ * @return the username
66
+ */
67
+ public String getUsername() {
68
+ return username;
69
+ }
70
+
71
+ /**
72
+ * Sets the username.
73
+ *
74
+ * @param username the username
75
+ */
76
+ public void setUsername(String username) {
77
+ this.username = username;
78
+ }
79
+
80
+ /**
81
+ * Gets the password.
82
+ *
83
+ * @return the password
84
+ */
85
+ public String getPassword() {
86
+ return password;
87
+ }
88
+
89
+ /**
90
+ * Sets the password.
91
+ *
92
+ * @param password the password
93
+ */
94
+ public void setPassword(String password) {
95
+ this.password = password;
96
+ }
97
+
98
+ /**
99
+ * Gets the token.
100
+ *
101
+ * @return the token
102
+ */
103
+ public String getToken() {
104
+ return token;
105
+ }
106
+
107
+ /**
108
+ * Sets the token.
109
+ *
110
+ * @param token the token
111
+ */
112
+ public void setToken(String token) {
113
+ this.token = token;
114
+ }
115
+ }
@@ -0,0 +1,75 @@
1
+ package com.scalar.maven.core.authentication.schemes;
2
+
3
+ import com.fasterxml.jackson.annotation.JsonInclude;
4
+ import com.fasterxml.jackson.annotation.JsonProperty;
5
+ import com.scalar.maven.core.authentication.flows.ScalarFlows;
6
+
7
+ import java.util.List;
8
+
9
+ /**
10
+ * Represents a security scheme that uses OAuth 2.0 authentication.
11
+ * This scheme is used to prefill or overwrite OAuth 2.0 authentication values
12
+ * when making API requests. It specifies flows and default scopes to be used
13
+ * during the authorization process.
14
+ */
15
+ @JsonInclude(JsonInclude.Include.NON_NULL)
16
+ public class ScalarOAuth2SecurityScheme extends ScalarSecurityScheme {
17
+
18
+ /**
19
+ * Gets or sets the OAuth 2.0 flows configuration for this security scheme.
20
+ * Contains configuration for different OAuth flow types like implicit, password,
21
+ * client credentials, or authorization code. The configured flows determine how
22
+ * the authentication process is handled.
23
+ */
24
+ private ScalarFlows flows;
25
+
26
+ /**
27
+ * Gets or sets the default OAuth 2.0 scopes to request during authorization.
28
+ * These scopes are prefilled or used to overwrite the requested scopes when initiating
29
+ * the OAuth flow.
30
+ */
31
+ @JsonProperty("x-default-scopes")
32
+ private List<String> defaultScopes;
33
+
34
+ /**
35
+ * Creates a new ScalarOAuth2SecurityScheme.
36
+ */
37
+ public ScalarOAuth2SecurityScheme() {
38
+ }
39
+
40
+ /**
41
+ * Gets the OAuth 2.0 flows configuration.
42
+ *
43
+ * @return the flows configuration
44
+ */
45
+ public ScalarFlows getFlows() {
46
+ return flows;
47
+ }
48
+
49
+ /**
50
+ * Sets the OAuth 2.0 flows configuration.
51
+ *
52
+ * @param flows the flows configuration
53
+ */
54
+ public void setFlows(ScalarFlows flows) {
55
+ this.flows = flows;
56
+ }
57
+
58
+ /**
59
+ * Gets the default OAuth 2.0 scopes.
60
+ *
61
+ * @return the default scopes
62
+ */
63
+ public List<String> getDefaultScopes() {
64
+ return defaultScopes;
65
+ }
66
+
67
+ /**
68
+ * Sets the default OAuth 2.0 scopes.
69
+ *
70
+ * @param defaultScopes the default scopes
71
+ */
72
+ public void setDefaultScopes(List<String> defaultScopes) {
73
+ this.defaultScopes = defaultScopes;
74
+ }
75
+ }