Skip to content

Commit d257ac8

Browse files
authored
fix: datastore storage engine requirements when auth is apikey (#1366)
1 parent fc7539a commit d257ac8

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

AmplifyPlugins/Core/AWSPluginsCoreTests/Auth/AuthModeStrategyTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ private struct ModelWithCustomStrategy: Model {
212212
model.authRules = [
213213
rule(allow: .public, provider: .iam, operations: [.create, .read, .update, .delete]),
214214
rule(allow: .custom, provider: .function, operations: [.create, .read, .update, .delete]),
215-
rule(allow: .owner, provider: .userPools, operations: [.create, .read, .update, .delete]),
215+
rule(allow: .owner, provider: .userPools, operations: [.create, .read, .update, .delete])
216216
]
217217
}
218218
}

AmplifyPlugins/DataStore/AWSDataStoreCategoryPlugin/Storage/StorageEngine+SyncRequirement.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,11 @@ extension StorageEngine {
6565
internal extension AuthRule {
6666
var requiresAuthPlugin: Bool {
6767
switch provider {
68-
// OIDC and Function providers don't need
68+
// OIDC, Function and API key providers don't need
6969
// Auth plugin
70-
case .oidc, .function, .none:
70+
case .oidc, .function, .apiKey, .none:
7171
return false
72-
case .apiKey, .userPools, .iam:
72+
case .userPools, .iam:
7373
return true
7474
}
7575
}

AmplifyPlugins/DataStore/AWSDataStoreCategoryPluginTests/Sync/StorageEngineSyncRequirementsTests.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ class StorageEngineSyncRequirementsTests: XCTestCase {
3838
func testDoesNotRequireAuthPlugin() {
3939
let authRules: AuthRules = [
4040
AuthRule(allow: .owner, provider: .oidc),
41-
AuthRule(allow: .owner, provider: .function)
41+
AuthRule(allow: .owner, provider: .function),
42+
AuthRule(allow: .public, provider: .apiKey)
4243
]
4344
XCTAssertFalse(authRules.requireAuthPlugin)
4445
}

0 commit comments

Comments
 (0)