-
Notifications
You must be signed in to change notification settings - Fork 139
Re-wire auth to use a provider pattern. Lots of tests remove cloud references #3230
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
base: main
Are you sure you want to change the base?
Changes from 3 commits
eeffceb
c7bdcc4
418d37a
a77aae7
71e149b
0b38551
f0c4708
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| v22.18.0 |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,7 +27,7 @@ import { getEventClassification } from './get-event-classification'; | |
| import { simplifyAttributes } from './simplify-attributes'; | ||
|
|
||
| export async function getEventAttributes( | ||
| { historyEvent, namespace, settings, accessToken }: EventWithMetadata, | ||
| { historyEvent, namespace, settings }: EventWithMetadata, | ||
| { | ||
| convertWithCodec = convertPayloadToJsonWithCodec, | ||
| decodeAttributes = decodePayloadAttributes, | ||
|
|
@@ -38,7 +38,6 @@ export async function getEventAttributes( | |
| attributes, | ||
| namespace, | ||
| settings, | ||
| accessToken, | ||
| }); | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| const decodedAttributes = decodeAttributes(convertedAttributes) as object; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,7 +2,6 @@ import { get } from 'svelte/store'; | |
|
|
||
| import { page } from '$app/stores'; | ||
|
|
||
| import { authUser } from '$lib/stores/auth-user'; | ||
| import type { | ||
| PendingActivity, | ||
| PendingActivityWithMetadata, | ||
|
|
@@ -16,7 +15,7 @@ import { | |
| } from '$lib/utilities/decode-payload'; | ||
|
|
||
| export async function getActivityAttributes( | ||
| { activity, namespace, settings, accessToken }: PendingActivityWithMetadata, | ||
| { activity, namespace, settings }: PendingActivityWithMetadata, | ||
| { | ||
| convertWithCodec = convertPayloadToJsonWithCodec, | ||
| decodeAttributes = decodePayloadAttributes, | ||
|
|
@@ -26,7 +25,6 @@ export async function getActivityAttributes( | |
| attributes: activity, | ||
| namespace, | ||
| settings, | ||
| accessToken, | ||
| }); | ||
|
|
||
| const decodedAttributes = decodeAttributes( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
|
@@ -39,13 +37,11 @@ const decodePendingActivity = async ({ | |
| activity, | ||
| namespace, | ||
| settings, | ||
| accessToken, | ||
| }: PendingActivityWithMetadata): Promise<PendingActivity> => { | ||
| const decodedActivity = await getActivityAttributes({ | ||
| activity, | ||
| namespace, | ||
| settings, | ||
| accessToken, | ||
| }); | ||
| return decodedActivity; | ||
| }; | ||
|
|
@@ -54,7 +50,6 @@ export const toDecodedPendingActivities = async ( | |
| workflow: WorkflowExecution, | ||
| namespace: string = get(page).params.namespace, | ||
| settings: Settings = get(page).data.settings, | ||
| accessToken: string = get(authUser).accessToken, | ||
| ) => { | ||
| const pendingActivities = workflow?.pendingActivities ?? []; | ||
| const decodedActivities: PendingActivity[] = []; | ||
|
|
@@ -63,7 +58,6 @@ export const toDecodedPendingActivities = async ( | |
| activity, | ||
| namespace, | ||
| settings, | ||
| accessToken, | ||
| }); | ||
| decodedActivities.push(decodedActivity); | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,7 +10,6 @@ import pendingActivityWorkflow from '$fixtures/workflow.pending-activities.json' | |
|
|
||
| const namespace = 'unit-tests'; | ||
| const settings = settingsFixture as unknown as Settings; | ||
| const accessToken = 'access-token'; | ||
|
|
||
| describe('toDecodedPendingActivities', () => { | ||
| it('should decode heartbeatDetails', async () => { | ||
|
|
@@ -19,7 +18,6 @@ describe('toDecodedPendingActivities', () => { | |
| workflow, | ||
| namespace, | ||
| settings, | ||
| accessToken, | ||
| ); | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| expect(decodedHeartbeatDetails[0].heartbeatDetails.payloads[0]).toBe(2); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,7 +3,6 @@ import { get } from 'svelte/store'; | |
| import { page } from '$app/stores'; | ||
|
|
||
| import { translate } from '$lib/i18n/translate'; | ||
| import { authUser } from '$lib/stores/auth-user'; | ||
| import { | ||
| setLastDataEncoderFailure, | ||
| setLastDataEncoderSuccess, | ||
|
|
@@ -16,6 +15,7 @@ import { | |
| } from '$lib/utilities/get-codec'; | ||
| import { validateHttps } from '$lib/utilities/is-http'; | ||
| import { stringifyWithBigInt } from '$lib/utilities/parse-with-big-int'; | ||
| import { getAccessToken, getIdToken } from '$lib/utilities/token-provider'; | ||
|
|
||
| export type PotentialPayloads = { payloads: unknown[] }; | ||
|
|
||
|
|
@@ -41,14 +41,14 @@ export async function codeServerRequest({ | |
|
|
||
| if (passAccessToken) { | ||
| if (validateHttps(endpoint)) { | ||
| let accessToken = get(authUser).accessToken; | ||
| const accessTokenExtras = get(authUser).idToken; | ||
| if (globalThis?.AccessToken) { | ||
| accessToken = await globalThis?.AccessToken(); | ||
| } else if (accessTokenExtras) { | ||
| headers['Authorization-Extras'] = accessTokenExtras; | ||
| const accessToken = await getAccessToken(); | ||
| const idToken = await getIdToken(); | ||
| if (accessToken) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| headers['Authorization'] = `Bearer ${accessToken}`; | ||
| } | ||
| if (idToken) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| headers['Authorization-Extras'] = idToken; | ||
| } | ||
| headers['Authorization'] = `Bearer ${accessToken}`; | ||
| } else { | ||
| setLastDataEncoderFailure(); | ||
| return payloads; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.