Skip to content

Commit 02a5f1c

Browse files
wdawsonpcarleton
andauthored
feat (auth): add sep-2207 client checks (#166)
* feat: add sep-2207 client checks * Update description for the offline access test Co-authored-by: Paul Carleton <paulcarletonjr@gmail.com> --------- Co-authored-by: Paul Carleton <paulcarletonjr@gmail.com>
1 parent 22f5c8b commit 02a5f1c

File tree

7 files changed

+356
-4
lines changed

7 files changed

+356
-4
lines changed

examples/clients/typescript/everything-client.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,10 @@ registerScenarios(
146146
'auth/token-endpoint-auth-post',
147147
'auth/token-endpoint-auth-none',
148148
// Resource mismatch (client should error when PRM resource doesn't match)
149-
'auth/resource-mismatch'
149+
'auth/resource-mismatch',
150+
// SEP-2207: Offline access / refresh token guidance (draft)
151+
'auth/offline-access-scope',
152+
'auth/offline-access-not-supported'
150153
],
151154
runAuthClient
152155
);

src/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import {
2020
listCoreScenarios,
2121
listExtensionScenarios,
2222
listBackcompatScenarios,
23+
listDraftScenarios,
2324
listScenariosForSpec,
2425
listClientScenariosForSpec,
2526
getScenarioSpecVersions,
@@ -112,6 +113,7 @@ program
112113
backcompat: listBackcompatScenarios,
113114
auth: listAuthScenarios,
114115
metadata: listMetadataScenarios,
116+
draft: listDraftScenarios,
115117
'sep-835': () =>
116118
listAuthScenarios().filter((name) => name.startsWith('auth/scope-'))
117119
};
@@ -230,7 +232,7 @@ program
230232
console.error('\nAvailable client scenarios:');
231233
listScenarios().forEach((s) => console.error(` - ${s}`));
232234
console.error(
233-
'\nAvailable suites: all, core, extensions, backcompat, auth, metadata, sep-835'
235+
'\nAvailable suites: all, core, extensions, backcompat, auth, metadata, draft, sep-835'
234236
);
235237
process.exit(1);
236238
}

src/scenarios/client/auth/index.test.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
import { authScenariosList, backcompatScenariosList } from './index';
1+
import {
2+
authScenariosList,
3+
backcompatScenariosList,
4+
draftScenariosList
5+
} from './index';
26
import {
37
runClientAgainstScenario,
48
InlineClientRunner
@@ -61,6 +65,21 @@ describe('Client Back-compat Scenarios', () => {
6165
}
6266
});
6367

68+
describe('Client Draft Scenarios', () => {
69+
for (const scenario of draftScenariosList) {
70+
test(`${scenario.name} passes`, async () => {
71+
const clientFn = getHandler(scenario.name);
72+
if (!clientFn) {
73+
throw new Error(`No handler registered for scenario: ${scenario.name}`);
74+
}
75+
const runner = new InlineClientRunner(clientFn);
76+
await runClientAgainstScenario(runner, scenario.name, {
77+
allowClientError: allowClientErrorScenarios.has(scenario.name)
78+
});
79+
});
80+
}
81+
});
82+
6483
describe('Negative tests', () => {
6584
test('bad client requests root PRM location', async () => {
6685
const runner = new InlineClientRunner(badPrmClient);

src/scenarios/client/auth/index.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ import {
2424
import { ResourceMismatchScenario } from './resource-mismatch';
2525
import { PreRegistrationScenario } from './pre-registration';
2626
import { CrossAppAccessCompleteFlowScenario } from './cross-app-access';
27+
import {
28+
OfflineAccessScopeScenario,
29+
OfflineAccessNotSupportedScenario
30+
} from './offline-access';
2731

2832
// Auth scenarios (required for tier 1)
2933
export const authScenariosList: Scenario[] = [
@@ -37,7 +41,6 @@ export const authScenariosList: Scenario[] = [
3741
new ClientSecretBasicAuthScenario(),
3842
new ClientSecretPostAuthScenario(),
3943
new PublicClientAuthScenario(),
40-
new ResourceMismatchScenario(),
4144
new PreRegistrationScenario()
4245
];
4346

@@ -53,3 +56,10 @@ export const extensionScenariosList: Scenario[] = [
5356
new ClientCredentialsBasicScenario(),
5457
new CrossAppAccessCompleteFlowScenario()
5558
];
59+
60+
// Draft scenarios (informational - not scored for tier assessment)
61+
export const draftScenariosList: Scenario[] = [
62+
new ResourceMismatchScenario(),
63+
new OfflineAccessScopeScenario(),
64+
new OfflineAccessNotSupportedScenario()
65+
];

0 commit comments

Comments
 (0)