Skip to content

Commit dab670e

Browse files
committed
feat: allow token request without ticket
Signed-off-by: Wouter Termont <wouter.termont@ugent.be>
1 parent 30a0355 commit dab670e

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

packages/uma/src/dialog/BaseNegotiator.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,9 @@ export class BaseNegotiator implements Negotiator {
9595
return stored;
9696
}
9797

98-
if (!permissions) this.error(BadRequestHttpError, 'The provided ticket is not valid.');
98+
if (!permissions) {
99+
this.error(BadRequestHttpError, 'A token request without existing ticket should include requested permissions.');
100+
}
99101

100102
return await this.ticketingStrategy.initializeTicket(permissions);
101103
}

packages/uma/src/dialog/Input.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { Permission } from "../views/Permission";
55
* A ReType constant for {@link DialogInput:type}.
66
*/
77
export const DialogInput = ({
8-
ticket: string,
8+
ticket: $(string),
99
claim_token: $(string),
1010
claim_token_format: $(string), // TODO: switch to array of claims objects with unknown structure
1111
pct: $(string),

packages/uma/src/routes/Token.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,11 @@ export class TokenRequestHandler implements HttpHandler {
3737

3838
const params = input.request.body;
3939

40-
if (params['grant_type'] !== 'urn:ietf:params:oauth:grant-type:uma-ticket') {
41-
throw new BadRequestHttpError(`Expected 'grant_type' to be set to 'urn:ietf:params:oauth:grant-type:uma-ticket'`);
42-
}
40+
// if (params['grant_type'] !== 'urn:ietf:params:oauth:grant-type:uma-ticket') {
41+
// throw new BadRequestHttpError(
42+
// `Expected 'grant_type' to be set to 'urn:ietf:params:oauth:grant-type:uma-ticket'
43+
// `);
44+
// }
4345

4446
try {
4547
reType(params, DialogInput);

0 commit comments

Comments
 (0)