Skip to content

Commit 43d70f0

Browse files
committed
feat: Use CSS KeyValueStorage
1 parent c414320 commit 43d70f0

12 files changed

Lines changed: 24 additions & 181 deletions

File tree

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"@context": [
3-
"https://linkedsoftwaredependencies.org/bundles/npm/@solidlab/uma/^0.0.0/components/context.jsonld"
3+
"https://linkedsoftwaredependencies.org/bundles/npm/@solid/community-server/^7.0.0/components/context.jsonld"
44
],
55
"@graph": [
66
{
77
"@id": "urn:uma:default:ResourceRegistrationStore",
8-
"@type": "MemoryStore"
8+
"@type": "MemoryMapStorage"
99
}
1010
]
11-
}
11+
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"@context": [
3-
"https://linkedsoftwaredependencies.org/bundles/npm/@solidlab/uma/^0.0.0/components/context.jsonld"
3+
"https://linkedsoftwaredependencies.org/bundles/npm/@solid/community-server/^7.0.0/components/context.jsonld"
44
],
55
"@graph": [
66
{
77
"@id": "urn:uma:default:TicketStore",
8-
"@type": "MemoryStore"
8+
"@type": "MemoryMapStorage"
99
}
1010
]
11-
}
11+
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"@context": [
3-
"https://linkedsoftwaredependencies.org/bundles/npm/@solidlab/uma/^0.0.0/components/context.jsonld"
3+
"https://linkedsoftwaredependencies.org/bundles/npm/@solid/community-server/^7.0.0/components/context.jsonld"
44
],
55
"@graph": [
66
{
77
"@id": "urn:uma:default:TokenStore",
8-
"@type": "MemoryStore"
8+
"@type": "MemoryMapStorage"
99
}
1010
]
11-
}
11+
}

packages/uma/src/dialog/BaseNegotiator.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@ import { NeedInfoError } from '../errors/NeedInfoError';
66
import { DialogInput } from './Input';
77
import { DialogOutput } from './Output';
88
import { reType } from '../util/ReType';
9-
import { KeyValueStore } from '../util/storage/models/KeyValueStore';
109
import { TicketingStrategy } from '../ticketing/strategy/TicketingStrategy';
1110
import { v4 } from 'uuid';
12-
import { BadRequestHttpError, ForbiddenHttpError, getLoggerFor } from '@solid/community-server';
11+
import { BadRequestHttpError, ForbiddenHttpError, getLoggerFor, KeyValueStorage } from '@solid/community-server';
1312

1413
/**
1514
* A concrete Negotiator that verifies incoming Claims and processes Tickets
@@ -21,13 +20,13 @@ export class BaseNegotiator implements Negotiator {
2120
/**
2221
* Construct a new Negotiator
2322
* @param verifier - The Verifier used to verify Claims of incoming Credentials.
24-
* @param ticketStore - A KeyValueStore to track Tickets.
23+
* @param ticketStore - A KeyValueStorage to track Tickets.
2524
* @param ticketManager - The strategy describing the life cycle of a Ticket.
2625
* @param tokenFactory - A factory for minting Access Tokens.
2726
*/
2827
public constructor(
2928
protected verifier: Verifier,
30-
protected ticketStore: KeyValueStore<string, Ticket>,
29+
protected ticketStore: KeyValueStorage<string, Ticket>,
3130
protected ticketingStrategy: TicketingStrategy,
3231
protected tokenFactory: TokenFactory,
3332
) {}

packages/uma/src/index.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,6 @@ export * from './views/ScopeDescription';
5252

5353
/* Replace the following with CSS types */
5454

55-
// Storage
56-
export * from './util/storage/MemoryStore';
57-
export * from './util/storage/models/KeyValueStore';
58-
export * from './util/storage/models/TypedKeyValueStore';
59-
6055
// HTTP
6156
export * from './util/http/identifier/BaseTargetExtractor';
6257
export * from './util/http/models/Handler';

packages/uma/src/routes/Introspection.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
import { HttpHandlerContext } from '../util/http/models/HttpHandlerContext';
22
import { HttpHandler } from '../util/http/models/HttpHandler';
33
import { HttpHandlerResponse } from '../util/http/models/HttpHandlerResponse';
4-
import { KeyValueStore } from '../util/storage/models/KeyValueStore';
54
import { AccessToken } from '../tokens/AccessToken';
65
import { JwtTokenFactory } from '../tokens/JwtTokenFactory';
76
import { SerializedToken } from '../tokens/TokenFactory';
87
import {
98
BadRequestHttpError,
109
getLoggerFor,
11-
JwkGenerator,
10+
JwkGenerator, KeyValueStorage,
1211
UnauthorizedHttpError,
1312
UnsupportedMediaTypeHttpError
1413
} from '@solid/community-server';
@@ -27,7 +26,7 @@ export class IntrospectionHandler implements HttpHandler {
2726
* @param jwtTokenFactory - The factory with which to produce JWT representations of the tokens.
2827
*/
2928
constructor(
30-
private readonly tokenStore: KeyValueStore<string, AccessToken>,
29+
private readonly tokenStore: KeyValueStorage<string, AccessToken>,
3130
private readonly jwtTokenFactory: JwtTokenFactory,
3231
private readonly keyGen: JwkGenerator,
3332
) {}
@@ -74,7 +73,7 @@ export class IntrospectionHandler implements HttpHandler {
7473
const token = await this.tokenStore.get(opaque);
7574
if (!token) throw new Error('Token not found.');
7675

77-
return this.jwtTokenFactory.serialize(Object.assign(token, { active: true }));
76+
return this.jwtTokenFactory.serialize({ ...token, active: true } as AccessToken);
7877
}
7978

8079
}

packages/uma/src/routes/ResourceRegistration.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@ import {
22
BadRequestHttpError,
33
createErrorMessage,
44
getLoggerFor,
5+
KeyValueStorage,
56
MethodNotAllowedHttpError,
6-
UnauthorizedHttpError, UnsupportedMediaTypeHttpError
7+
UnauthorizedHttpError,
8+
UnsupportedMediaTypeHttpError
79
} from '@solid/community-server';
810
import {HttpHandler} from '../util/http/models/HttpHandler';
911
import {HttpHandlerContext} from '../util/http/models/HttpHandlerContext';
1012
import {HttpHandlerResponse} from '../util/http/models/HttpHandlerResponse';
11-
import {KeyValueStore} from '../util/storage/models/KeyValueStore';
1213
import {v4} from 'uuid';
1314
import { HttpHandlerRequest } from '../util/http/models/HttpHandlerRequest';
1415
import { ResourceDescription } from '../views/ResourceDescription';
@@ -30,7 +31,7 @@ export class ResourceRegistrationRequestHandler implements HttpHandler {
3031
* @param {RequestingPartyRegistration[]} resourceServers - Pod Servers to be registered with the UMA AS
3132
*/
3233
constructor(
33-
private readonly resourceStore: KeyValueStore<string, ResourceDescription>,
34+
private readonly resourceStore: KeyValueStorage<string, ResourceDescription>,
3435
) {}
3536

3637
/**

packages/uma/src/routes/Ticket.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {
22
BadRequestHttpError,
33
createErrorMessage,
4-
getLoggerFor, UnauthorizedHttpError,
4+
getLoggerFor, KeyValueStorage, UnauthorizedHttpError,
55
UnsupportedMediaTypeHttpError
66
} from '@solid/community-server';
77
import { HttpHandler } from '../util/http/models/HttpHandler';
@@ -10,7 +10,6 @@ import { HttpHandlerResponse } from '../util/http/models/HttpHandlerResponse';
1010
import { array, reType } from '../util/ReType';
1111
import { Permission } from '../views/Permission';
1212
import { Ticket } from '../ticketing/Ticket';
13-
import { KeyValueStore } from '../util/storage/models/KeyValueStore';
1413
import { TicketingStrategy } from '../ticketing/strategy/TicketingStrategy';
1514
import { v4 } from 'uuid';
1615
import { verifyRequest } from '../util/HttpMessageSignatures';
@@ -33,7 +32,7 @@ export class TicketRequestHandler implements HttpHandler {
3332
*/
3433
constructor(
3534
private readonly ticketingStrategy: TicketingStrategy,
36-
private readonly ticketStore: KeyValueStore<string, Ticket>,
35+
private readonly ticketStore: KeyValueStorage<string, Ticket>,
3736
) {}
3837

3938
/**

packages/uma/src/tokens/OpaqueTokenFactory.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
import { KeyValueStorage } from '@solid/community-server';
12
import {AccessToken} from './AccessToken';
23
import {SerializedToken, TokenFactory} from './TokenFactory';
3-
import {KeyValueStore} from '../util/storage/models/KeyValueStore';
44
import {v4} from 'uuid';
55

66
/**
@@ -9,9 +9,9 @@ import {v4} from 'uuid';
99
export class OpaqueTokenFactory extends TokenFactory {
1010
/**
1111
*
12-
* @param {KeyValueStore<string, AccessToken>} tokenStore
12+
* @param {KeyValueStorage<string, AccessToken>} tokenStore
1313
*/
14-
constructor(private tokenStore: KeyValueStore<string, AccessToken>) {
14+
constructor(private tokenStore: KeyValueStorage<string, AccessToken>) {
1515
super();
1616
}
1717

packages/uma/src/util/storage/MemoryStore.ts

Lines changed: 0 additions & 47 deletions
This file was deleted.

0 commit comments

Comments
 (0)