-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: better metadata policy validation
Signed-off-by: Berend Sliedrecht <[email protected]>
- Loading branch information
1 parent
d6a2600
commit 58078c7
Showing
9 changed files
with
64 additions
and
28 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
packages/core/__tests__/fixtures/metadataPolicyFigure12.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
export const metadataPolicyFigure12 = { | ||
openid_relying_party: { | ||
grant_types: { | ||
default: ['authorization_code'], | ||
subset_of: ['authorization_code', 'refresh_token'], | ||
superset_of: ['authorization_code'], | ||
}, | ||
token_endpoint_auth_method: { | ||
one_of: ['private_key_jwt', 'self_signed_tls_client_auth'], | ||
essential: true, | ||
}, | ||
token_endpoint_auth_signing_alg: { | ||
one_of: ['PS256', 'ES256'], | ||
}, | ||
subject_type: { | ||
value: 'pairwise', | ||
}, | ||
contacts: { | ||
add: ['[email protected]'], | ||
}, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
import { z } from 'zod' | ||
import { addOperator, addOperatorSchema } from './operator' | ||
import { defaultOperator, defaultOperatorSchema } from './operator' | ||
import { essentialOperator, essentialOperatorSchema } from './operator' | ||
import { oneOfOperator, oneOfOperatorSchema } from './operator' | ||
import { supersetOfOperator, supersetOfOperatorSchema } from './operator' | ||
import { subsetOfOperator, subsetOfOperatorSchema } from './operator' | ||
import { valueOperator, valueOperatorSchema } from './operator' | ||
import type { z } from 'zod' | ||
import { | ||
addOperatorSchema, | ||
defaultOperatorSchema, | ||
essentialOperatorSchema, | ||
oneOfOperatorSchema, | ||
subsetOfOperatorSchema, | ||
supersetOfOperatorSchema, | ||
valueOperatorSchema, | ||
} from './operator' | ||
|
||
export const metadataPolicySchema = z.object({ | ||
[addOperator.key]: addOperatorSchema.optional(), | ||
[defaultOperator.key]: defaultOperatorSchema.optional(), | ||
[essentialOperator.key]: essentialOperatorSchema.optional(), | ||
[oneOfOperator.key]: oneOfOperatorSchema.optional(), | ||
[supersetOfOperator.key]: supersetOfOperatorSchema.optional(), | ||
[subsetOfOperator.key]: subsetOfOperatorSchema.optional(), | ||
[valueOperator.key]: valueOperatorSchema.optional(), | ||
}) | ||
export const metadataPolicySchema = addOperatorSchema | ||
.and(defaultOperatorSchema.optional()) | ||
.and(essentialOperatorSchema.optional()) | ||
.and(oneOfOperatorSchema.optional()) | ||
.and(supersetOfOperatorSchema.optional()) | ||
.and(subsetOfOperatorSchema.optional()) | ||
.and(valueOperatorSchema.optional()) | ||
|
||
export type MetadataPolicyOperator = z.input<typeof metadataPolicySchema> |