Skip to content
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
4 changes: 2 additions & 2 deletions packages/datastore/__tests__/subscription.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ describe('sync engine subscription module', () => {
)
).toEqual(authInfo);
});
test('group authorization', () => {
test('groups authorization', () => {
const model: SchemaModel = {
syncable: true,
name: 'Post',
Expand All @@ -185,7 +185,7 @@ describe('sync engine subscription module', () => {
{
provider: 'userPools',
ownerField: 'owner',
allow: 'group',
allow: 'groups',
groups: ['mygroup'],
identityClaim: 'cognito:username',
operations: ['create', 'update', 'delete'],
Expand Down
4 changes: 2 additions & 2 deletions packages/datastore/src/sync/processors/subscription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class SubscriptionProcessor {

// if not check if has groups authorization and token has groupClaim allowed for cognito token
let groupAuthRules = rules.filter(
rule => rule.authStrategy === 'group' && rule.provider === 'userPools'
rule => rule.authStrategy === 'groups' && rule.provider === 'userPools'
);

const validCognitoGroup = groupAuthRules.find(groupAuthRule => {
Expand All @@ -149,7 +149,7 @@ class SubscriptionProcessor {

// if not check if has groups authorization and token has groupClaim allowed for oidc token
groupAuthRules = rules.filter(
rule => rule.authStrategy === 'group' && rule.provider === 'oidc'
rule => rule.authStrategy === 'groups' && rule.provider === 'oidc'
);

const validOidcGroup = groupAuthRules.find(groupAuthRule => {
Expand Down
2 changes: 1 addition & 1 deletion packages/datastore/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export type AuthorizationRule = {
provider: 'userPools' | 'oidc' | 'iam' | 'apiKey';
groupClaim: string;
groups: [string];
authStrategy: 'owner' | 'group' | 'private' | 'public';
authStrategy: 'owner' | 'groups' | 'private' | 'public';
areSubscriptionsPublic: boolean;
};

Expand Down