Skip to content

Commit a540828

Browse files
authored
Revert "Cognito domain creation and expose OAuth to frontend config (#756)" (#838)
This reverts commit 1d53a37.
1 parent 1d53a37 commit a540828

File tree

17 files changed

+36
-454
lines changed

17 files changed

+36
-454
lines changed

.changeset/strange-carrots-attend.md

Lines changed: 0 additions & 10 deletions
This file was deleted.

.changeset/twenty-spies-smile.md

Lines changed: 0 additions & 10 deletions
This file was deleted.

.eslint_dictionary.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
[
22
"aggregator",
33
"amazonaws",
4-
"amazoncognito",
54
"amplifyconfiguration",
65
"appleid",
76
"appsync",

packages/auth-construct/API.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,8 @@ export type ExternalProviderOptions = {
6060
oidc?: OidcProviderProps;
6161
saml?: SamlProviderProps;
6262
scopes?: ('PHONE' | 'EMAIL' | 'OPENID' | 'PROFILE' | 'COGNITO_ADMIN')[];
63-
callbackUrls: string[];
64-
domainPrefix?: string;
65-
logoutUrls: string[];
63+
callbackUrls?: string[];
64+
logoutUrls?: string[];
6665
};
6766

6867
// @public

packages/auth-construct/src/construct.test.ts

Lines changed: 0 additions & 161 deletions
Original file line numberDiff line numberDiff line change
@@ -498,66 +498,6 @@ void describe('Auth construct', () => {
498498
]);
499499
});
500500

501-
void it('stores outputs in platform - oauth config', () => {
502-
const authConstruct = new AmplifyAuth(stack, 'test', {
503-
loginWith: {
504-
email: true,
505-
externalProviders: {
506-
google: {
507-
clientId: googleClientId,
508-
clientSecret: SecretValue.unsafePlainText(googleClientSecret),
509-
},
510-
scopes: ['EMAIL', 'PROFILE'],
511-
callbackUrls: ['http://callback.com'],
512-
logoutUrls: ['http://logout.com'],
513-
domainPrefix: 'test-prefix',
514-
},
515-
},
516-
outputStorageStrategy: stubBackendOutputStorageStrategy,
517-
});
518-
519-
const expectedUserPoolId = (
520-
authConstruct.node.findChild('UserPool') as UserPool
521-
).userPoolId;
522-
const expectedIdentityPoolId = (
523-
authConstruct.node.findChild('IdentityPool') as CfnIdentityPool
524-
).ref;
525-
const expectedWebClientId = (
526-
authConstruct.node.findChild('UserPoolAppClient') as UserPoolClient
527-
).userPoolClientId;
528-
const expectedRegion = Stack.of(authConstruct).region;
529-
530-
const storeOutputArgs = storeOutputMock.mock.calls[0].arguments;
531-
assert.equal(storeOutputArgs.length, 2);
532-
533-
assert.deepStrictEqual(storeOutputArgs, [
534-
authOutputKey,
535-
{
536-
version: '1',
537-
payload: {
538-
userPoolId: expectedUserPoolId,
539-
webClientId: expectedWebClientId,
540-
identityPoolId: expectedIdentityPoolId,
541-
authRegion: expectedRegion,
542-
passwordPolicyMinLength:
543-
DEFAULTS.PASSWORD_POLICY.minLength.toString(),
544-
passwordPolicyRequirements:
545-
defaultPasswordPolicyCharacterRequirements,
546-
signupAttributes: '["EMAIL"]',
547-
verificationMechanisms: '["EMAIL"]',
548-
usernameAttributes: '["EMAIL"]',
549-
googleClientId: 'googleClientId',
550-
oauthDomain: `test-prefix.auth.${expectedRegion}.amazoncognito.com`,
551-
oauthScope: '["email","profile"]',
552-
oauthRedirectSignIn: 'http://callback.com',
553-
oauthRedirectSignOut: 'http://logout.com',
554-
oauthResponseType: 'code',
555-
socialProviders: '["GOOGLE"]',
556-
},
557-
},
558-
]);
559-
});
560-
561501
void it('multifactor prop updates mfaConfiguration & mfaTypes', () => {
562502
new AmplifyAuth(stack, 'test', {
563503
loginWith: {
@@ -974,8 +914,6 @@ void describe('Auth construct', () => {
974914
clientId: googleClientId,
975915
clientSecret: SecretValue.unsafePlainText(googleClientSecret),
976916
},
977-
callbackUrls: ['https://redirect.com'],
978-
logoutUrls: ['https://logout.com'],
979917
},
980918
},
981919
});
@@ -1005,8 +943,6 @@ void describe('Auth construct', () => {
1005943
clientId: googleClientId,
1006944
clientSecret: SecretValue.unsafePlainText(googleClientSecret),
1007945
},
1008-
callbackUrls: ['https://redirect.com'],
1009-
logoutUrls: ['https://logout.com'],
1010946
},
1011947
},
1012948
});
@@ -1036,8 +972,6 @@ void describe('Auth construct', () => {
1036972
clientId: facebookClientId,
1037973
clientSecret: facebookClientSecret,
1038974
},
1039-
callbackUrls: ['https://redirect.com'],
1040-
logoutUrls: ['https://logout.com'],
1041975
},
1042976
},
1043977
});
@@ -1067,8 +1001,6 @@ void describe('Auth construct', () => {
10671001
clientId: facebookClientId,
10681002
clientSecret: facebookClientSecret,
10691003
},
1070-
callbackUrls: ['https://redirect.com'],
1071-
logoutUrls: ['https://logout.com'],
10721004
},
10731005
},
10741006
});
@@ -1100,8 +1032,6 @@ void describe('Auth construct', () => {
11001032
privateKey: applePrivateKey,
11011033
teamId: appleTeamId,
11021034
},
1103-
callbackUrls: ['https://redirect.com'],
1104-
logoutUrls: ['https://logout.com'],
11051035
},
11061036
},
11071037
});
@@ -1133,8 +1063,6 @@ void describe('Auth construct', () => {
11331063
privateKey: applePrivateKey,
11341064
teamId: appleTeamId,
11351065
},
1136-
callbackUrls: ['https://redirect.com'],
1137-
logoutUrls: ['https://logout.com'],
11381066
},
11391067
},
11401068
});
@@ -1164,8 +1092,6 @@ void describe('Auth construct', () => {
11641092
clientId: amazonClientId,
11651093
clientSecret: amazonClientSecret,
11661094
},
1167-
callbackUrls: ['https://redirect.com'],
1168-
logoutUrls: ['https://logout.com'],
11691095
},
11701096
},
11711097
});
@@ -1195,8 +1121,6 @@ void describe('Auth construct', () => {
11951121
clientId: amazonClientId,
11961122
clientSecret: amazonClientSecret,
11971123
},
1198-
callbackUrls: ['https://redirect.com'],
1199-
logoutUrls: ['https://logout.com'],
12001124
},
12011125
},
12021126
});
@@ -1228,8 +1152,6 @@ void describe('Auth construct', () => {
12281152
issuerUrl: oidcIssuerUrl,
12291153
name: oidcProviderName,
12301154
},
1231-
callbackUrls: ['https://redirect.com'],
1232-
logoutUrls: ['https://logout.com'],
12331155
},
12341156
},
12351157
});
@@ -1275,8 +1197,6 @@ void describe('Auth construct', () => {
12751197
issuerUrl: oidcIssuerUrl,
12761198
name: oidcProviderName,
12771199
},
1278-
callbackUrls: ['https://redirect.com'],
1279-
logoutUrls: ['https://logout.com'],
12801200
},
12811201
},
12821202
});
@@ -1323,8 +1243,6 @@ void describe('Auth construct', () => {
13231243
metadataType: UserPoolIdentityProviderSamlMetadataType.FILE,
13241244
},
13251245
},
1326-
callbackUrls: ['https://redirect.com'],
1327-
logoutUrls: ['https://logout.com'],
13281246
},
13291247
},
13301248
});
@@ -1369,8 +1287,6 @@ void describe('Auth construct', () => {
13691287
metadataType: UserPoolIdentityProviderSamlMetadataType.FILE,
13701288
},
13711289
},
1372-
callbackUrls: ['https://redirect.com'],
1373-
logoutUrls: ['https://logout.com'],
13741290
},
13751291
},
13761292
});
@@ -1441,81 +1357,6 @@ void describe('Auth construct', () => {
14411357
});
14421358
});
14431359

1444-
void it('throws an error if callbackUrls are not specified with external login providers', () => {
1445-
const app = new App();
1446-
const stack = new Stack(app);
1447-
assert.throws(
1448-
() =>
1449-
new AmplifyAuth(stack, 'test', {
1450-
loginWith: {
1451-
email: true,
1452-
externalProviders: {
1453-
google: {
1454-
clientId: googleClientId,
1455-
clientSecret: SecretValue.unsafePlainText(googleClientSecret),
1456-
},
1457-
scopes: ['EMAIL', 'PROFILE'],
1458-
callbackUrls: [],
1459-
logoutUrls: ['http://localhost'],
1460-
},
1461-
},
1462-
}),
1463-
{
1464-
message:
1465-
'You must define callbackUrls when configuring external login providers.',
1466-
}
1467-
);
1468-
});
1469-
1470-
void it('throws an error if logoutUrls are not specified with external login providers', () => {
1471-
const app = new App();
1472-
const stack = new Stack(app);
1473-
assert.throws(
1474-
() =>
1475-
new AmplifyAuth(stack, 'test', {
1476-
loginWith: {
1477-
email: true,
1478-
externalProviders: {
1479-
google: {
1480-
clientId: googleClientId,
1481-
clientSecret: SecretValue.unsafePlainText(googleClientSecret),
1482-
},
1483-
scopes: ['EMAIL', 'PROFILE'],
1484-
callbackUrls: ['http://redirect.com'],
1485-
logoutUrls: [],
1486-
},
1487-
},
1488-
}),
1489-
{
1490-
message:
1491-
'You must define logoutUrls when configuring external login providers.',
1492-
}
1493-
);
1494-
});
1495-
1496-
void it('throws an error if domainPrefix is configured without any external providers', () => {
1497-
const app = new App();
1498-
const stack = new Stack(app);
1499-
assert.throws(
1500-
() =>
1501-
new AmplifyAuth(stack, 'test', {
1502-
loginWith: {
1503-
email: true,
1504-
externalProviders: {
1505-
scopes: ['EMAIL', 'PROFILE'],
1506-
callbackUrls: [],
1507-
logoutUrls: ['http://localhost'],
1508-
domainPrefix: 'https://localhost',
1509-
},
1510-
},
1511-
}),
1512-
{
1513-
message:
1514-
'You cannot configure a domain prefix if there are no external providers configured.',
1515-
}
1516-
);
1517-
});
1518-
15191360
void it('supports all idps and login methods', () => {
15201361
const app = new App();
15211362
const stack = new Stack(app);
@@ -1555,8 +1396,6 @@ void describe('Auth construct', () => {
15551396
metadataType: UserPoolIdentityProviderSamlMetadataType.FILE,
15561397
},
15571398
},
1558-
callbackUrls: ['https://redirect.com'],
1559-
logoutUrls: ['https://logout.com'],
15601399
},
15611400
},
15621401
});

0 commit comments

Comments
 (0)