Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
mfriesen committed Oct 17, 2024
1 parent d624683 commit da841df
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 13 deletions.
3 changes: 3 additions & 0 deletions docs/openapi/openapi-iam.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10775,6 +10775,9 @@
userName:
type: string
description: The username of the recipient. You can use either email and userName.
clientUserId:
type: string
description: Specifies unique identifier for signer
email:
type: string
description: Specifies the email of the recipient
Expand Down
3 changes: 3 additions & 0 deletions docs/openapi/openapi-jwt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10775,6 +10775,9 @@
userName:
type: string
description: The username of the recipient. You can use either email and userName.
clientUserId:
type: string
description: Specifies unique identifier for signer
email:
type: string
description: Specifies the email of the recipient
Expand Down
3 changes: 3 additions & 0 deletions docs/openapi/openapi-key.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10775,6 +10775,9 @@
userName:
type: string
description: The username of the recipient. You can use either email and userName.
clientUserId:
type: string
description: Specifies unique identifier for signer
email:
type: string
description: Specifies the email of the recipient
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,12 @@
*
*/
public class ApiHttpRequest {

/** Http Body. */
private String body;

/** Http Method. */
private String httpMethod;

/** Headers. */
private Map<String, String> headers;
/** Is Request Body Base64 Encoded. */
private Boolean isBase64Encoded;
/** Http path. */
Expand All @@ -64,6 +63,26 @@ public ApiHttpRequest() {
this.requestContext.put("authorizer", authorizer);
}

/**
* Get Headers {@link Map}.
*
* @return {@link Map}
*/
public Map<String, String> headers() {
return this.headers;
}

/**
* Set Headers.
*
* @param httpHeaders {@link Map}
* @return ApiHttpRequest
*/
public ApiHttpRequest headers(final Map<String, String> httpHeaders) {
this.headers = httpHeaders;
return this;
}

/**
* Get Http Body.
*
Expand All @@ -84,15 +103,9 @@ public ApiHttpRequest body(final String httpBody) {
return this;
}

@SuppressWarnings("unchecked")
private Map<String, Object> getClaims() {
Map<String, Object> authorizer = (Map<String, Object>) this.requestContext.get("authorizer");
return (Map<String, Object>) authorizer.get("claims");
}

/**
* Set Http Group.
*
*
* @param group {@link String}
* @return {@link ApiHttpRequest}
*/
Expand All @@ -101,6 +114,12 @@ public ApiHttpRequest group(final String group) {
return this;
}

@SuppressWarnings("unchecked")
private Map<String, Object> getClaims() {
Map<String, Object> authorizer = (Map<String, Object>) this.requestContext.get("authorizer");
return (Map<String, Object>) authorizer.get("claims");
}

/**
* Get HTTP method.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,13 @@ public ApiHttpRequest apply(final HttpRequest httpRequest) {
String group = String.join(" ", decoder.getGroups());
Map<String, List<String>> permissions = decoder.getPermissions();

return new ApiHttpRequest().httpMethod(httpRequest.getMethod().getValue()).resource(resource)
.path(path).pathParameters(pathParameters).queryParameters(queryParameters)
.user(decoder.getUsername()).group(group).permissions(permissions).body(body);
Map<String, String> httpHeaders = httpRequest.getHeaders().getEntries().stream().collect(
Collectors.toMap(h -> h.getName().getValue(), h -> h.getValues().get(0).getValue()));

return new ApiHttpRequest().headers(httpHeaders).httpMethod(httpRequest.getMethod().getValue())
.resource(resource).path(path).pathParameters(pathParameters)
.queryParameters(queryParameters).user(decoder.getUsername()).group(group)
.permissions(permissions).body(body);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10885,6 +10885,9 @@ Resources:
userName:
type: "string"
description: "The username of the recipient. You can use either email and userName."
clientUserId:
type: "string"
description: "Specifies unique identifier for signer"
email:
type: "string"
description: "Specifies the email of the recipient"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10885,6 +10885,9 @@ Resources:
userName:
type: "string"
description: "The username of the recipient. You can use either email and userName."
clientUserId:
type: "string"
description: "Specifies unique identifier for signer"
email:
type: "string"
description: "Specifies the email of the recipient"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10885,6 +10885,9 @@ Resources:
userName:
type: "string"
description: "The username of the recipient. You can use either email and userName."
clientUserId:
type: "string"
description: "Specifies unique identifier for signer"
email:
type: "string"
description: "Specifies the email of the recipient"
Expand Down

0 comments on commit da841df

Please sign in to comment.