Skip to content

Commit 8ce3b6e

Browse files
committed
Merge commit '2b8920069675171110fcd0c2af4e3a96f8d9d041' into arch-wizards-support-async-bind-prompter-functions
2 parents 7e8e849 + 2b89200 commit 8ce3b6e

File tree

5 files changed

+14
-13
lines changed

5 files changed

+14
-13
lines changed

docs/arch_develop.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -484,17 +484,17 @@ class ExampleWizard extends Wizard<ExampleState> {
484484

485485
### 2. `CompositeWizard` Class
486486

487-
This abstract class extends the `Wizard` class with an addition method to create and manage state of the nested wizards.
487+
`CompositeWizard` extends `Wizard` to create and manage a collection of nested/child wizards.
488488

489-
Extends this class to create a wizard that contains other wizards as part of the prompter flow.
490-
Use `this.createWizardPrompter()` to use another wizard class as a prompter in the main wizard.
489+
Extend this class to create a wizard that contains other wizards as part of a prompter flow.
490+
Use `this.createWizardPrompter()` to use a wizard as a prompter in the `CompositeWizard`.
491491

492492
Example:
493493

494494
```ts
495495

496496
// Child wizard
497-
class ChildWizard extends Wizards<ChildWizardForm> {...}
497+
class ChildWizard extends Wizard<ChildWizardForm> {...}
498498

499499

500500
// Composite wizard

packages/core/src/auth/sso/cache.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { getLogger } from '../../shared/logger/logger'
1010
import fs from '../../shared/fs/fs'
1111
import { createDiskCache, KeyedCache, mapCache } from '../../shared/utilities/cacheUtils'
1212
import { stripUndefined } from '../../shared/utilities/collectionUtils'
13-
import { getMissingProps, hasProps, selectFrom } from '../../shared/utilities/tsUtils'
13+
import { hasProps, selectFrom } from '../../shared/utilities/tsUtils'
1414
import { SsoToken, ClientRegistration } from './model'
1515
import { DevSettings } from '../../shared/settings'
1616
import { onceChanged } from '../../shared/utilities/functionUtils'
@@ -79,6 +79,11 @@ export function getTokenCache(directory = getCacheDir()): KeyedCache<SsoAccess>
7979
}
8080

8181
function read(data: StoredToken): SsoAccess {
82+
// Validate data is not missing. Since the input data is passed directly from whatever is on disk.
83+
if (!hasProps(data, 'accessToken')) {
84+
throw new ToolkitError(`SSO cache data looks malformed`)
85+
}
86+
8287
const registration = hasProps(data, 'clientId', 'clientSecret', 'registrationExpiresAt')
8388
? {
8489
...selectFrom(data, 'clientId', 'clientSecret', 'scopes', 'startUrl'),
@@ -93,12 +98,6 @@ export function getTokenCache(directory = getCacheDir()): KeyedCache<SsoAccess>
9398

9499
stripUndefined(token)
95100

96-
// Validate data is not missing.
97-
const missingProps = getMissingProps(token, 'accessToken', 'refreshToken')
98-
if (missingProps.length > 0) {
99-
throw new ToolkitError(`SSO cache data unexpectedly missing props: ${JSON.stringify(missingProps)}`)
100-
}
101-
102101
return {
103102
token,
104103
registration,

packages/core/src/test/credentials/sso/cache.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ describe('SSO Cache', function () {
2727
const validToken = {
2828
accessToken: 'longstringofrandomcharacters',
2929
expiresAt: new Date(Date.now() + hourInMs),
30-
refreshToken: 'dummyRefreshToken',
3130
} as SsoToken
3231

3332
beforeEach(async function () {

packages/core/src/test/credentials/sso/ssoAccessTokenProvider.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ describe('SsoAccessTokenProvider', function () {
4545
return {
4646
accessToken: 'dummyAccessToken',
4747
expiresAt: new clock.Date(clock.Date.now() + timeDelta),
48-
refreshToken: 'dummyRefreshToken',
4948
...extras,
5049
}
5150
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Bug Fix",
3+
"description": "Auth: SSO failed to missing refreshToken"
4+
}

0 commit comments

Comments
 (0)