Skip to content

Commit

Permalink
remove cast
Browse files Browse the repository at this point in the history
  • Loading branch information
Travis Sheppard committed Jul 21, 2022
1 parent ff09f66 commit 79ff3bc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,9 @@ Future<http.BaseRequest> authorizeHttpRequest(http.BaseRequest request,
throw UnimplementedError('${authType.name} not implemented.');
case APIAuthorizationType.userPools:
final authProvider = _validateAuthProvider(
authProviderRepo.getAuthProvider(authType.authProviderToken),
authType) as TokenAmplifyAuthProvider;
authProviderRepo.getAuthProvider(authType.authProviderToken),
authType,
);
final authorizedRequest =
await authProvider.authorizeRequest(_httpToAWSRequest(request));
return authorizedRequest.httpRequest;
Expand Down
10 changes: 7 additions & 3 deletions packages/api/amplify_api/test/authorize_http_request_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ void main() {

setUpAll(() {
authProviderRepo
..registerAuthProvider(APIAuthorizationType.apiKey.authProviderToken,
AppSyncApiKeyAuthProvider())
..registerAuthProvider(
APIAuthorizationType.apiKey.authProviderToken,
AppSyncApiKeyAuthProvider(),
)
..registerAuthProvider(
APIAuthorizationType.iam.authProviderToken,
TestIamAuthProvider(),
Expand Down Expand Up @@ -151,7 +153,9 @@ void main() {
authProviderRepo: authProviderRepo,
);
expect(
authorizedRequest.headers[AWSHeaders.authorization], testAccessToken);
authorizedRequest.headers[AWSHeaders.authorization],
testAccessToken,
);
});

test('authorizes with OIDC auth mode', () {}, skip: true);
Expand Down

0 comments on commit 79ff3bc

Please sign in to comment.