Skip to content

Commit e28c428

Browse files
committed
chore: rename routes
Signed-off-by: Wouter Termont <wouter.termont@ugent.be>
1 parent 5263904 commit e28c428

22 files changed

+101
-152
lines changed

packages/uma/config/default.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
}
6060
],
6161
"defaultHandler": {
62-
"@type": "DefaultRouteHandler"
62+
"@type": "DefaultRequestHandler"
6363
}
6464
}
6565
}

packages/uma/config/discovery/default.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
}
1515
],
1616
"handler": {
17-
"@type": "UmaConfigRequestHandler",
17+
"@type": "ConfigRequestHandler",
1818
"baseUrl": { "@id": "urn:uma:variables:baseUrl" }
1919
},
2020
"path": "/uma/.well-known/uma2-configuration"

packages/uma/config/resource/default.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"@graph": [
66
{
77
"@id": "urn:uma:default:ResourceRegistrationHandler",
8-
"@type": "ResourceRegistrationHandler",
8+
"@type": "ResourceRegistrationRequestHandler",
99
"baseUrl": "urn:uma:variables:baseUrl",
1010
"resourceStore": {
1111
"@id": "urn:uma:default:ResourceRegistrationStore",

packages/uma/config/ticket/default.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"handler": {
1717
"@type": "JsonHttpErrorHandler",
1818
"nestedHandler": {
19-
"@type": "PermissionRegistrationHandler",
19+
"@type": "TicketRequestHandler",
2020
"resourceServers": [
2121
{
2222
"@type": "RequestingPartyRegistration",

packages/uma/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@
6565
"cross-fetch": "^4.0.0",
6666
"jose": "^4.5.1",
6767
"logform": "^2.6.0",
68-
"typescript-memoize": "^1.1.0",
6968
"uuid": "^9.0.1",
7069
"winston": "^3.11.0"
7170
},

packages/uma/src/index.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,13 @@ export * from './models/ScopeDescription';
88
export * from './models/Ticket';
99

1010
// Routes
11-
export * from './routes/DefaultRouteHandler';
12-
export * from './routes/IntrospectionHandler';
13-
export * from './routes/JwksRequestHandler';
14-
export * from './routes/OAuthConfigRequestHandler';
15-
export * from './routes/PermissionRegistrationHandler';
16-
export * from './routes/ResourceRegistrationHandler';
17-
export * from './routes/TokenRequestHandler';
18-
export * from './routes/UmaConfigRequestHandler';
11+
export * from './routes/Default';
12+
export * from './routes/Introspection';
13+
export * from './routes/Jwks';
14+
export * from './routes/Ticket';
15+
export * from './routes/ResourceRegistration';
16+
export * from './routes/Token';
17+
export * from './routes/Config';
1918

2019
// Token
2120
export * from './token/JwtTokenFactory';
File renamed without changes.

packages/uma/src/routes/Config.ts

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
import { ASYMMETRIC_CRYPTOGRAPHIC_ALGORITHM }
2+
from '@solid/access-token-verifier/dist/constant/ASYMMETRIC_CRYPTOGRAPHIC_ALGORITHM';
3+
import { HttpHandler } from '../util/http/models/HttpHandler';
4+
import { HttpHandlerContext } from '../util/http/models/HttpHandlerContext';
5+
import { HttpHandlerResponse } from '../util/http/models/HttpHandlerResponse';
6+
import { Logger } from '../util/logging/Logger';
7+
import { getLoggerFor } from '../util/logging/LoggerUtils';
8+
9+
// eslint-disable no-unused-vars
10+
export enum ResponseType {
11+
Token = 'token',
12+
Code = 'code',
13+
IDToken = 'id_token'
14+
};
15+
// eslint-enable
16+
17+
export type OAuthConfiguration = {
18+
issuer: string,
19+
jwks_uri?: string,
20+
token_endpoint?: string,
21+
grant_types_supported?: string[],
22+
dpop_signing_alg_values_supported?: string[],
23+
response_types_supported?: ResponseType[]
24+
scopes_supported?: string[]
25+
}
26+
27+
export type UmaConfiguration = OAuthConfiguration & {
28+
uma_profiles_supported: string[],
29+
resource_registration_endpoint: string,
30+
permission_endpoint: string,
31+
introspection_endpoint: string
32+
}
33+
34+
/**
35+
* An HttpHandler used for returning the configuration
36+
* of the UMA Authorization Service.
37+
*/
38+
export class ConfigRequestHandler extends HttpHandler {
39+
protected readonly logger: Logger = getLoggerFor(this);
40+
41+
/**
42+
* An HttpHandler used for returning the configuration
43+
* of the UMA Authorization Service.
44+
* @param {string} baseUrl - Base URL of the AS
45+
*/
46+
constructor(protected readonly baseUrl: string) {
47+
super();
48+
}
49+
50+
/**
51+
* Returns the endpoint's UMA configuration
52+
*
53+
* @param {HttpHandlerContext} context - an irrelevant incoming context
54+
* @return {Observable<HttpHandlerResponse>} - the mock response
55+
*/
56+
async handle(context: HttpHandlerContext): Promise<HttpHandlerResponse> {
57+
this.logger.info(`Received discovery request at '${context.request.url}'`);
58+
return {
59+
body: JSON.stringify(this.getConfig()),
60+
headers: {'content-type': 'application/json'},
61+
status: 200,
62+
};
63+
}
64+
65+
/**
66+
* Returns UMA Configuration for the AS
67+
* @return {UmaConfiguration} - AS Configuration
68+
*/
69+
public getConfig(): UmaConfiguration {
70+
return {
71+
jwks_uri: `${this.baseUrl}/keys`,
72+
token_endpoint: `${this.baseUrl}/token`,
73+
grant_types_supported: ['urn:ietf:params:oauth:grant-type:uma-ticket'],
74+
issuer: `${this.baseUrl}`,
75+
permission_endpoint: `${this.baseUrl}/ticket`,
76+
introspection_endpoint: `${this.baseUrl}/introspect`,
77+
resource_registration_endpoint: `${this.baseUrl}/resources`,
78+
uma_profiles_supported: ['http://openid.net/specs/openid-connect-core-1_0.html#IDToken'],
79+
dpop_signing_alg_values_supported: [...ASYMMETRIC_CRYPTOGRAPHIC_ALGORITHM],
80+
response_types_supported: [ResponseType.Token],
81+
};
82+
}
83+
}
File renamed without changes.

packages/uma/src/routes/DefaultRouteHandler.ts renamed to packages/uma/src/routes/Default.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {HttpHandlerResponse} from '../util/http/models/HttpHandlerResponse';
55
/**
66
* Default route handler
77
*/
8-
export class DefaultRouteHandler extends HttpHandler {
8+
export class DefaultRequestHandler extends HttpHandler {
99
/**
1010
* Default request handler returning a 404 error
1111
* @param {HttpHandlerContext} input

0 commit comments

Comments
 (0)