Skip to content

Commit a25b371

Browse files
author
awstools
committed
feat(client-sso-oidc): Updated request parameters for PKCE support.
1 parent d56a60a commit a25b371

File tree

6 files changed

+298
-7
lines changed

6 files changed

+298
-7
lines changed

clients/client-sso-oidc/src/commands/CreateTokenCommand.ts

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ export interface CreateTokenCommandOutput extends CreateTokenResponse, __Metadat
5252
* "STRING_VALUE",
5353
* ],
5454
* redirectUri: "STRING_VALUE",
55+
* codeVerifier: "STRING_VALUE",
5556
* };
5657
* const command = new CreateTokenCommand(input);
5758
* const response = await client.send(command);

clients/client-sso-oidc/src/commands/CreateTokenWithIAMCommand.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export interface CreateTokenWithIAMCommandOutput extends CreateTokenWithIAMRespo
3434
/**
3535
* <p>Creates and returns access and refresh tokens for clients and applications that are
3636
* authenticated using IAM entities. The access token can be used to fetch short-term credentials
37-
* for the assigned AWS accounts or to access application APIs using <code>bearer</code>
37+
* for the assigned Amazon Web Services accounts or to access application APIs using <code>bearer</code>
3838
* authentication.</p>
3939
* @example
4040
* Use a bare-bones client and the command you need to make an API call.
@@ -55,6 +55,7 @@ export interface CreateTokenWithIAMCommandOutput extends CreateTokenWithIAMRespo
5555
* subjectToken: "STRING_VALUE",
5656
* subjectTokenType: "STRING_VALUE",
5757
* requestedTokenType: "STRING_VALUE",
58+
* codeVerifier: "STRING_VALUE",
5859
* };
5960
* const command = new CreateTokenWithIAMCommand(input);
6061
* const response = await client.send(command);

clients/client-sso-oidc/src/commands/RegisterClientCommand.ts

+14
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,14 @@ export interface RegisterClientCommandOutput extends RegisterClientResponse, __M
4545
* scopes: [ // Scopes
4646
* "STRING_VALUE",
4747
* ],
48+
* redirectUris: [ // RedirectUris
49+
* "STRING_VALUE",
50+
* ],
51+
* grantTypes: [ // GrantTypes
52+
* "STRING_VALUE",
53+
* ],
54+
* issuerUrl: "STRING_VALUE",
55+
* entitledApplicationArn: "STRING_VALUE",
4856
* };
4957
* const command = new RegisterClientCommand(input);
5058
* const response = await client.send(command);
@@ -73,13 +81,19 @@ export interface RegisterClientCommandOutput extends RegisterClientResponse, __M
7381
* <p>Indicates that the client information sent in the request during registration is
7482
* invalid.</p>
7583
*
84+
* @throws {@link InvalidRedirectUriException} (client fault)
85+
* <p>Indicates that one or more redirect URI in the request is not supported for this operation.</p>
86+
*
7687
* @throws {@link InvalidRequestException} (client fault)
7788
* <p>Indicates that something is wrong with the input to the request. For example, a required
7889
* parameter might be missing or out of range.</p>
7990
*
8091
* @throws {@link InvalidScopeException} (client fault)
8192
* <p>Indicates that the scope provided in the request is invalid.</p>
8293
*
94+
* @throws {@link UnsupportedGrantTypeException} (client fault)
95+
* <p>Indicates that the grant type in the request is not supported by the service.</p>
96+
*
8397
* @throws {@link SSOOIDCServiceException}
8498
* <p>Base exception class for all service exceptions from SSOOIDC service.</p>
8599
*

clients/client-sso-oidc/src/models/models_0.ts

+82-2
Original file line numberDiff line numberDiff line change
@@ -146,14 +146,22 @@ export interface CreateTokenRequest {
146146
* @public
147147
*/
148148
redirectUri?: string;
149+
150+
/**
151+
* <p>Used only when calling this API for the Authorization Code grant type. This value is generated
152+
* by the client and presented to validate the original code challenge value the client passed at
153+
* authorization time.</p>
154+
* @public
155+
*/
156+
codeVerifier?: string;
149157
}
150158

151159
/**
152160
* @public
153161
*/
154162
export interface CreateTokenResponse {
155163
/**
156-
* <p>A bearer token to access AWS accounts and applications assigned to a user.</p>
164+
* <p>A bearer token to access Amazon Web Services accounts and applications assigned to a user.</p>
157165
* @public
158166
*/
159167
accessToken?: string;
@@ -616,14 +624,22 @@ export interface CreateTokenWithIAMRequest {
616624
* @public
617625
*/
618626
requestedTokenType?: string;
627+
628+
/**
629+
* <p>Used only when calling this API for the Authorization Code grant type. This value is generated
630+
* by the client and presented to validate the original code challenge value the client passed at
631+
* authorization time.</p>
632+
* @public
633+
*/
634+
codeVerifier?: string;
619635
}
620636

621637
/**
622638
* @public
623639
*/
624640
export interface CreateTokenWithIAMResponse {
625641
/**
626-
* <p>A bearer token to access AWS accounts and applications assigned to a user.</p>
642+
* <p>A bearer token to access Amazon Web Services accounts and applications assigned to a user.</p>
627643
* @public
628644
*/
629645
accessToken?: string;
@@ -764,6 +780,41 @@ export class InvalidClientMetadataException extends __BaseException {
764780
}
765781
}
766782

783+
/**
784+
* <p>Indicates that one or more redirect URI in the request is not supported for this operation.</p>
785+
* @public
786+
*/
787+
export class InvalidRedirectUriException extends __BaseException {
788+
readonly name: "InvalidRedirectUriException" = "InvalidRedirectUriException";
789+
readonly $fault: "client" = "client";
790+
/**
791+
* <p>Single error code.
792+
* For this exception the value will be <code>invalid_redirect_uri</code>.</p>
793+
* @public
794+
*/
795+
error?: string;
796+
797+
/**
798+
* <p>Human-readable text providing additional information, used to assist the
799+
* client developer in understanding the error that occurred.</p>
800+
* @public
801+
*/
802+
error_description?: string;
803+
/**
804+
* @internal
805+
*/
806+
constructor(opts: __ExceptionOptionType<InvalidRedirectUriException, __BaseException>) {
807+
super({
808+
name: "InvalidRedirectUriException",
809+
$fault: "client",
810+
...opts,
811+
});
812+
Object.setPrototypeOf(this, InvalidRedirectUriException.prototype);
813+
this.error = opts.error;
814+
this.error_description = opts.error_description;
815+
}
816+
}
817+
767818
/**
768819
* @public
769820
*/
@@ -787,6 +838,33 @@ export interface RegisterClientRequest {
787838
* @public
788839
*/
789840
scopes?: string[];
841+
842+
/**
843+
* <p>The list of redirect URI that are defined by the client. At completion of authorization,
844+
* this list is used to restrict what locations the user agent can be redirected back to.</p>
845+
* @public
846+
*/
847+
redirectUris?: string[];
848+
849+
/**
850+
* <p>The list of OAuth 2.0 grant types that are defined by the client. This list is used to
851+
* restrict the token granting flows available to the client.</p>
852+
* @public
853+
*/
854+
grantTypes?: string[];
855+
856+
/**
857+
* <p>The IAM Identity Center Issuer URL associated with an instance of IAM Identity Center. This value is needed for user access to resources through the client.</p>
858+
* @public
859+
*/
860+
issuerUrl?: string;
861+
862+
/**
863+
* <p>This IAM Identity Center application ARN is used to define administrator-managed configuration for public client access to resources. At
864+
* authorization, the scopes, grants, and redirect URI available to this client will be restricted by this application resource.</p>
865+
* @public
866+
*/
867+
entitledApplicationArn?: string;
790868
}
791869

792870
/**
@@ -913,6 +991,7 @@ export const CreateTokenRequestFilterSensitiveLog = (obj: CreateTokenRequest): a
913991
...obj,
914992
...(obj.clientSecret && { clientSecret: SENSITIVE_STRING }),
915993
...(obj.refreshToken && { refreshToken: SENSITIVE_STRING }),
994+
...(obj.codeVerifier && { codeVerifier: SENSITIVE_STRING }),
916995
});
917996

918997
/**
@@ -933,6 +1012,7 @@ export const CreateTokenWithIAMRequestFilterSensitiveLog = (obj: CreateTokenWith
9331012
...(obj.refreshToken && { refreshToken: SENSITIVE_STRING }),
9341013
...(obj.assertion && { assertion: SENSITIVE_STRING }),
9351014
...(obj.subjectToken && { subjectToken: SENSITIVE_STRING }),
1015+
...(obj.codeVerifier && { codeVerifier: SENSITIVE_STRING }),
9361016
});
9371017

9381018
/**

clients/client-sso-oidc/src/protocols/Aws_restJson1.ts

+35
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import {
3636
InvalidClientException,
3737
InvalidClientMetadataException,
3838
InvalidGrantException,
39+
InvalidRedirectUriException,
3940
InvalidRequestException,
4041
InvalidRequestRegionException,
4142
InvalidScopeException,
@@ -63,6 +64,7 @@ export const se_CreateTokenCommand = async (
6364
clientId: [],
6465
clientSecret: [],
6566
code: [],
67+
codeVerifier: [],
6668
deviceCode: [],
6769
grantType: [],
6870
redirectUri: [],
@@ -95,6 +97,7 @@ export const se_CreateTokenWithIAMCommand = async (
9597
assertion: [],
9698
clientId: [],
9799
code: [],
100+
codeVerifier: [],
98101
grantType: [],
99102
redirectUri: [],
100103
refreshToken: [],
@@ -125,6 +128,10 @@ export const se_RegisterClientCommand = async (
125128
take(input, {
126129
clientName: [],
127130
clientType: [],
131+
entitledApplicationArn: [],
132+
grantTypes: (_) => _json(_),
133+
issuerUrl: [],
134+
redirectUris: (_) => _json(_),
128135
scopes: (_) => _json(_),
129136
})
130137
);
@@ -309,6 +316,9 @@ const de_CommandError = async (output: __HttpResponse, context: __SerdeContext):
309316
case "InvalidClientMetadataException":
310317
case "com.amazonaws.ssooidc#InvalidClientMetadataException":
311318
throw await de_InvalidClientMetadataExceptionRes(parsedOutput, context);
319+
case "InvalidRedirectUriException":
320+
case "com.amazonaws.ssooidc#InvalidRedirectUriException":
321+
throw await de_InvalidRedirectUriExceptionRes(parsedOutput, context);
312322
default:
313323
const parsedBody = parsedOutput.body;
314324
return throwDefaultError({
@@ -467,6 +477,27 @@ const de_InvalidGrantExceptionRes = async (
467477
return __decorateServiceException(exception, parsedOutput.body);
468478
};
469479

480+
/**
481+
* deserializeAws_restJson1InvalidRedirectUriExceptionRes
482+
*/
483+
const de_InvalidRedirectUriExceptionRes = async (
484+
parsedOutput: any,
485+
context: __SerdeContext
486+
): Promise<InvalidRedirectUriException> => {
487+
const contents: any = map({});
488+
const data: any = parsedOutput.body;
489+
const doc = take(data, {
490+
error: __expectString,
491+
error_description: __expectString,
492+
});
493+
Object.assign(contents, doc);
494+
const exception = new InvalidRedirectUriException({
495+
$metadata: deserializeMetadata(parsedOutput),
496+
...contents,
497+
});
498+
return __decorateServiceException(exception, parsedOutput.body);
499+
};
500+
470501
/**
471502
* deserializeAws_restJson1InvalidRequestExceptionRes
472503
*/
@@ -592,6 +623,10 @@ const de_UnsupportedGrantTypeExceptionRes = async (
592623
return __decorateServiceException(exception, parsedOutput.body);
593624
};
594625

626+
// se_GrantTypes omitted.
627+
628+
// se_RedirectUris omitted.
629+
595630
// se_Scopes omitted.
596631

597632
// de_Scopes omitted.

0 commit comments

Comments
 (0)