Skip to content

remove endpoint from cognito user pool config #5046

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ class CognitoUserPoolConfig
this.appClientSecret,
required this.region,
this.hostedUI,
this.endpoint,
});

factory CognitoUserPoolConfig.fromJson(Map<String, Object?> json) =>
Expand All @@ -24,7 +23,6 @@ class CognitoUserPoolConfig
final String? appClientSecret;
final String region;
final CognitoOAuthConfig? hostedUI;
final String? endpoint;

@override
List<Object?> get props => [
Expand All @@ -33,7 +31,6 @@ class CognitoUserPoolConfig
appClientSecret,
region,
hostedUI,
endpoint,
];

CognitoUserPoolConfig copyWith({
Expand All @@ -42,15 +39,13 @@ class CognitoUserPoolConfig
String? appClientSecret,
String? region,
CognitoOAuthConfig? hostedUI,
String? endpoint,
}) {
return CognitoUserPoolConfig(
poolId: poolId ?? this.poolId,
appClientId: appClientId ?? this.appClientId,
appClientSecret: appClientSecret ?? this.appClientSecret,
region: region ?? this.region,
hostedUI: hostedUI ?? this.hostedUI,
endpoint: endpoint ?? this.endpoint,
);
}

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion packages/amplify_core/test/config/cli_config_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ const expected = {
poolId: USERPOOL_ID,
appClientId: APPCLIENT_ID,
appClientSecret: APPCLIENT_SECERT,
endpoint: OAUTH_DOMAIN,
region: REGION,
),
'Default': CognitoUserPoolConfig(
Expand Down
20 changes: 10 additions & 10 deletions packages/amplify_core/test/config/testdata/cli_generated.dart
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ const _v4auth = '''
"CustomEndpoint": {
"AppClientId": "$APPCLIENT_ID",
"AppClientSecret": "$APPCLIENT_SECERT",
"Endpoint": "$OAUTH_DOMAIN",
"PoolId": "$USERPOOL_ID",
"Region": "$REGION"
},
Expand Down Expand Up @@ -190,7 +189,8 @@ const _v4storage = '''
"plugins": {
"awsS3StoragePlugin": {
"bucket": "$BUCKET",
"region": "$REGION"
"region": "$REGION",
"defaultAccessLevel": "guest"
}
}
}
Expand Down Expand Up @@ -269,7 +269,6 @@ const _v5auth = '''
"CustomEndpoint": {
"AppClientId": "$APPCLIENT_ID",
"AppClientSecret": "$APPCLIENT_SECERT",
"Endpoint": "$OAUTH_DOMAIN",
"PoolId": "$USERPOOL_ID",
"Region": "$REGION"
},
Expand Down Expand Up @@ -376,7 +375,8 @@ const _v5storage = '''
"plugins": {
"awsS3StoragePlugin": {
"bucket": "$BUCKET",
"region": "$REGION"
"region": "$REGION",
"defaultAccessLevel": "guest"
}
}
}
Expand Down Expand Up @@ -455,7 +455,6 @@ const _v6auth = '''
"CustomEndpoint": {
"AppClientId": "$APPCLIENT_ID",
"AppClientSecret": "$APPCLIENT_SECERT",
"Endpoint": "$OAUTH_DOMAIN",
"PoolId": "$USERPOOL_ID",
"Region": "$REGION"
},
Expand Down Expand Up @@ -562,7 +561,8 @@ const _v6storage = '''
"plugins": {
"awsS3StoragePlugin": {
"bucket": "$BUCKET",
"region": "$REGION"
"region": "$REGION",
"defaultAccessLevel": "guest"
}
}
}
Expand Down Expand Up @@ -641,7 +641,6 @@ const _v7auth = '''
"CustomEndpoint": {
"AppClientId": "$APPCLIENT_ID",
"AppClientSecret": "$APPCLIENT_SECERT",
"Endpoint": "$OAUTH_DOMAIN",
"PoolId": "$USERPOOL_ID",
"Region": "$REGION"
},
Expand Down Expand Up @@ -748,7 +747,8 @@ const _v7storage = '''
"plugins": {
"awsS3StoragePlugin": {
"bucket": "$BUCKET",
"region": "$REGION"
"region": "$REGION",
"defaultAccessLevel": "guest"
}
}
}
Expand Down Expand Up @@ -827,7 +827,6 @@ const _vlatestauth = '''
"CustomEndpoint": {
"AppClientId": "$APPCLIENT_ID",
"AppClientSecret": "$APPCLIENT_SECERT",
"Endpoint": "$OAUTH_DOMAIN",
"PoolId": "$USERPOOL_ID",
"Region": "$REGION"
},
Expand Down Expand Up @@ -934,7 +933,8 @@ const _vlateststorage = '''
"plugins": {
"awsS3StoragePlugin": {
"bucket": "$BUCKET",
"region": "$REGION"
"region": "$REGION",
"defaultAccessLevel": "guest"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
"CustomEndpoint": {
"AppClientId": "$APPCLIENT_ID",
"AppClientSecret": "$APPCLIENT_SECERT",
"Endpoint": "$OAUTH_DOMAIN",
"PoolId": "$USERPOOL_ID",
"Region": "$REGION"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@ Map<String, Object?> removeDeprecatedKeys(Map<String, Object?> object) {
'authenticationFlowType',
],
);
removeKey(
newObject,
[
'storage',
'plugins',
'awsS3StoragePlugin',
'defaultAccessLevel',
],
);
return newObject;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,17 +181,11 @@ class WrappedCognitoIdentityProviderClient
/// {@macro amplify_auth_cognito_dart.sdk.wrapped_cognito_identity_provider_client}
WrappedCognitoIdentityProviderClient({
required String region,
String? endpoint,
required AWSCredentialsProvider credentialsProvider,
required DependencyManager dependencyManager,
}) : _base = CognitoIdentityProviderClient(
region: region,
credentialsProvider: credentialsProvider,
baseUri: endpoint == null
? null
: (endpoint.startsWith('http')
? Uri.parse(endpoint)
: Uri.parse('https://$endpoint')),
requestInterceptors: const [
WithHeader(AWSHeaders.cacheControl, 'no-store'),
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ final class ConfigurationStateMachine
region: userPoolConfig.region,
credentialsProvider: _credentialsProvider,
dependencyManager: this,
endpoint: userPoolConfig.endpoint,
),
);
}
Expand Down
Loading