Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17287,6 +17287,7 @@ components:
- $ref: "#/components/schemas/SyntheticsBasicAuthDigest"
- $ref: "#/components/schemas/SyntheticsBasicAuthOauthClient"
- $ref: "#/components/schemas/SyntheticsBasicAuthOauthROP"
- $ref: "#/components/schemas/SyntheticsBasicAuthJWT"
SyntheticsBasicAuthDigest:
description: Object to handle digest authentication when performing the test.
properties:
Expand Down Expand Up @@ -17314,6 +17315,78 @@ components:
type: string
x-enum-varnames:
- DIGEST
SyntheticsBasicAuthJWT:
description: Object to handle JWT authentication when performing the test.
properties:
addClaims:
$ref: "#/components/schemas/SyntheticsBasicAuthJWTAddClaims"
algorithm:
$ref: "#/components/schemas/SyntheticsBasicAuthJWTAlgorithm"
expiresIn:
description: Token time-to-live in seconds.
example: 3600
format: int64
minimum: 1
type: integer
header:
description: Custom JWT header as a JSON string.
example: '{"kid": "my-key-id"}'
type: string
payload:
description: JWT claims as a JSON string.
example: '{"sub": "1234567890", "name": "John Doe"}'
type: string
secret:
description: |-
Signing key for the JWT authentication. Use the shared secret for `HS256`
or the private key (PEM format) for `RS256` and `ES256`.
example: "mysecretkey"
type: string
tokenPrefix:
description: Prefix added before the token in the `Authorization` header. Defaults to `Bearer`.
example: "Bearer"
type: string
type:
$ref: "#/components/schemas/SyntheticsBasicAuthJWTType"
required:
- algorithm
- payload
- secret
- type
type: object
SyntheticsBasicAuthJWTAddClaims:
description: Standard JWT claims to automatically inject.
properties:
exp:
description: Whether to inject the `exp` (expiration) claim.
example: true
type: boolean
iat:
description: Whether to inject the `iat` (issued at) claim.
example: true
type: boolean
type: object
SyntheticsBasicAuthJWTAlgorithm:
description: Algorithm to use for the JWT authentication.
enum:
- HS256
- RS256
- ES256
example: "HS256"
type: string
x-enum-varnames:
- HS256
- RS256
- ES256
SyntheticsBasicAuthJWTType:
default: "jwt"
description: The type of authentication to use when performing the test.
enum:
- jwt
example: "jwt"
type: string
x-enum-varnames:
- JWT
SyntheticsBasicAuthNTLM:
description: Object to handle `NTLM` authentication when performing the test.
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,51 @@ public SyntheticsBasicAuth deserialize(JsonParser jp, DeserializationContext ctx
log.log(Level.FINER, "Input data does not match schema 'SyntheticsBasicAuthOauthROP'", e);
}

// deserialize SyntheticsBasicAuthJWT
try {
boolean attemptParsing = true;
// ensure that we respect type coercion as set on the client ObjectMapper
if (SyntheticsBasicAuthJWT.class.equals(Integer.class)
|| SyntheticsBasicAuthJWT.class.equals(Long.class)
|| SyntheticsBasicAuthJWT.class.equals(Float.class)
|| SyntheticsBasicAuthJWT.class.equals(Double.class)
|| SyntheticsBasicAuthJWT.class.equals(Boolean.class)
|| SyntheticsBasicAuthJWT.class.equals(String.class)) {
attemptParsing = typeCoercion;
if (!attemptParsing) {
attemptParsing |=
((SyntheticsBasicAuthJWT.class.equals(Integer.class)
|| SyntheticsBasicAuthJWT.class.equals(Long.class))
&& token == JsonToken.VALUE_NUMBER_INT);
attemptParsing |=
((SyntheticsBasicAuthJWT.class.equals(Float.class)
|| SyntheticsBasicAuthJWT.class.equals(Double.class))
&& (token == JsonToken.VALUE_NUMBER_FLOAT
|| token == JsonToken.VALUE_NUMBER_INT));
attemptParsing |=
(SyntheticsBasicAuthJWT.class.equals(Boolean.class)
&& (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE));
attemptParsing |=
(SyntheticsBasicAuthJWT.class.equals(String.class)
&& token == JsonToken.VALUE_STRING);
}
}
if (attemptParsing) {
tmp = tree.traverse(jp.getCodec()).readValueAs(SyntheticsBasicAuthJWT.class);
// TODO: there is no validation against JSON schema constraints
// (min, max, enum, pattern...), this does not perform a strict JSON
// validation, which means the 'match' count may be higher than it should be.
if (!((SyntheticsBasicAuthJWT) tmp).unparsed) {
deserialized = tmp;
match++;
}
log.log(Level.FINER, "Input data matches schema 'SyntheticsBasicAuthJWT'");
}
} catch (Exception e) {
// deserialization failed, continue
log.log(Level.FINER, "Input data does not match schema 'SyntheticsBasicAuthJWT'", e);
}

SyntheticsBasicAuth ret = new SyntheticsBasicAuth();
if (match == 1) {
ret.setActualInstance(deserialized);
Expand Down Expand Up @@ -408,6 +453,11 @@ public SyntheticsBasicAuth(SyntheticsBasicAuthOauthROP o) {
setActualInstance(o);
}

public SyntheticsBasicAuth(SyntheticsBasicAuthJWT o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}

static {
schemas.put("SyntheticsBasicAuthWeb", new GenericType<SyntheticsBasicAuthWeb>() {});
schemas.put("SyntheticsBasicAuthSigv4", new GenericType<SyntheticsBasicAuthSigv4>() {});
Expand All @@ -416,6 +466,7 @@ public SyntheticsBasicAuth(SyntheticsBasicAuthOauthROP o) {
schemas.put(
"SyntheticsBasicAuthOauthClient", new GenericType<SyntheticsBasicAuthOauthClient>() {});
schemas.put("SyntheticsBasicAuthOauthROP", new GenericType<SyntheticsBasicAuthOauthROP>() {});
schemas.put("SyntheticsBasicAuthJWT", new GenericType<SyntheticsBasicAuthJWT>() {});
JSON.registerDescendants(SyntheticsBasicAuth.class, Collections.unmodifiableMap(schemas));
}

Expand All @@ -428,7 +479,7 @@ public Map<String, GenericType> getSchemas() {
* Set the instance that matches the oneOf child schema, check the instance parameter is valid
* against the oneOf child schemas: SyntheticsBasicAuthWeb, SyntheticsBasicAuthSigv4,
* SyntheticsBasicAuthNTLM, SyntheticsBasicAuthDigest, SyntheticsBasicAuthOauthClient,
* SyntheticsBasicAuthOauthROP
* SyntheticsBasicAuthOauthROP, SyntheticsBasicAuthJWT
*
* <p>It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a
* composed schema (allOf, anyOf, oneOf).
Expand Down Expand Up @@ -460,6 +511,10 @@ public void setActualInstance(Object instance) {
super.setActualInstance(instance);
return;
}
if (JSON.isInstanceOf(SyntheticsBasicAuthJWT.class, instance, new HashSet<Class<?>>())) {
super.setActualInstance(instance);
return;
}

if (JSON.isInstanceOf(UnparsedObject.class, instance, new HashSet<Class<?>>())) {
super.setActualInstance(instance);
Expand All @@ -468,17 +523,17 @@ public void setActualInstance(Object instance) {
throw new RuntimeException(
"Invalid instance type. Must be SyntheticsBasicAuthWeb, SyntheticsBasicAuthSigv4,"
+ " SyntheticsBasicAuthNTLM, SyntheticsBasicAuthDigest, SyntheticsBasicAuthOauthClient,"
+ " SyntheticsBasicAuthOauthROP");
+ " SyntheticsBasicAuthOauthROP, SyntheticsBasicAuthJWT");
}

/**
* Get the actual instance, which can be the following: SyntheticsBasicAuthWeb,
* SyntheticsBasicAuthSigv4, SyntheticsBasicAuthNTLM, SyntheticsBasicAuthDigest,
* SyntheticsBasicAuthOauthClient, SyntheticsBasicAuthOauthROP
* SyntheticsBasicAuthOauthClient, SyntheticsBasicAuthOauthROP, SyntheticsBasicAuthJWT
*
* @return The actual instance (SyntheticsBasicAuthWeb, SyntheticsBasicAuthSigv4,
* SyntheticsBasicAuthNTLM, SyntheticsBasicAuthDigest, SyntheticsBasicAuthOauthClient,
* SyntheticsBasicAuthOauthROP)
* SyntheticsBasicAuthOauthROP, SyntheticsBasicAuthJWT)
*/
@Override
public Object getActualInstance() {
Expand Down Expand Up @@ -551,4 +606,15 @@ public SyntheticsBasicAuthOauthClient getSyntheticsBasicAuthOauthClient()
public SyntheticsBasicAuthOauthROP getSyntheticsBasicAuthOauthROP() throws ClassCastException {
return (SyntheticsBasicAuthOauthROP) super.getActualInstance();
}

/**
* Get the actual instance of `SyntheticsBasicAuthJWT`. If the actual instance is not
* `SyntheticsBasicAuthJWT`, the ClassCastException will be thrown.
*
* @return The actual instance of `SyntheticsBasicAuthJWT`
* @throws ClassCastException if the instance is not `SyntheticsBasicAuthJWT`
*/
public SyntheticsBasicAuthJWT getSyntheticsBasicAuthJWT() throws ClassCastException {
return (SyntheticsBasicAuthJWT) super.getActualInstance();
}
}
Loading
Loading