Skip to content
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

chore: kickoff release #3664

Merged
merged 1 commit into from
May 1, 2024
Merged
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
3 changes: 1 addition & 2 deletions Amplify/Core/Configuration/AmplifyOutputsData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ public struct AmplifyOutputsData: Codable {
@_spi(InternalAmplifyConfiguration)
public struct OAuth: Codable {
public let identityProviders: [String]
public let cognitoDomain: String
public let customDomain: String?
public let domain: String
public let scopes: [String]
public let redirectSignInUri: [String]
public let redirectSignOutUri: [String]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ struct ConfigurationHelper {

return createHostedConfiguration(appClientId: configuration.userPoolClientId,
clientSecret: nil,
domain: oauth.customDomain ?? oauth.cognitoDomain,
domain: oauth.domain,
scopes: oauth.scopes,
signInRedirectURI: signInRedirectURI,
signOutRedirectURI: signOutRedirectURI)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ final class ConfigurationHelperTests: XCTestCase {
userPoolId: "poolId",
userPoolClientId: "clientId",
oauth: AmplifyOutputsData.Auth.OAuth(identityProviders: ["provider1", "provider2"],
cognitoDomain: "cognitoDomain",
customDomain: nil,
domain: "domain",
scopes: ["scope1", "scope2"],
redirectSignInUri: ["redirect1", "redirect2"],
redirectSignOutUri: ["signOut1", "signOut2"],
Expand All @@ -62,35 +61,7 @@ final class ConfigurationHelperTests: XCTestCase {
XCTAssertEqual(hostedUIConfig.clientId, "clientId")
XCTAssertNil(hostedUIConfig.clientSecret, "Client secret should be nil as its not supported in Gen2")
XCTAssertEqual(hostedUIConfig.oauth.scopes, ["scope1", "scope2"])
XCTAssertEqual(hostedUIConfig.oauth.domain, "cognitoDomain")
XCTAssertEqual(hostedUIConfig.oauth.signInRedirectURI, "redirect1")
XCTAssertEqual(hostedUIConfig.oauth.signOutRedirectURI, "signOut1")
}

/// Test Oauth section's `customDomain` overwrites `cognitoDomain`
func testParseUserPoolData_WithOAuth_CustomDomain() throws {
let config = AmplifyOutputsData.Auth(
awsRegion: "us-east-1",
userPoolId: "poolId",
userPoolClientId: "clientId",
oauth: AmplifyOutputsData.Auth.OAuth(identityProviders: ["provider1", "provider2"],
cognitoDomain: "cognitoDomain",
customDomain: "customDomain",
scopes: ["scope1", "scope2"],
redirectSignInUri: ["redirect1", "redirect2"],
redirectSignOutUri: ["signOut1", "signOut2"],
responseType: "responseType"))

guard let config = ConfigurationHelper.parseUserPoolData(config),
let hostedUIConfig = config.hostedUIConfig else {
XCTFail("Expected to parse UserPoolData into object")
return
}

XCTAssertEqual(hostedUIConfig.clientId, "clientId")
XCTAssertNil(hostedUIConfig.clientSecret)
XCTAssertEqual(hostedUIConfig.oauth.scopes, ["scope1", "scope2"])
XCTAssertEqual(hostedUIConfig.oauth.domain, "customDomain")
XCTAssertEqual(hostedUIConfig.oauth.domain, "domain")
XCTAssertEqual(hostedUIConfig.oauth.signInRedirectURI, "redirect1")
XCTAssertEqual(hostedUIConfig.oauth.signOutRedirectURI, "signOut1")
}
Expand Down
Loading