44 getLoggerFor ,
55 KeyValueStorage ,
66 MethodNotAllowedHttpError ,
7- UnauthorizedHttpError ,
8- UnsupportedMediaTypeHttpError
7+ UnauthorizedHttpError
98} from '@solid/community-server' ;
109import { randomUUID } from 'node:crypto' ;
1110import {
@@ -14,9 +13,9 @@ import {
1413 HttpHandlerRequest ,
1514 HttpHandlerResponse
1615} from '../util/http/models/HttpHandler' ;
17- import { ResourceDescription } from '../views/ResourceDescription' ;
18- import { reType } from '../util/ReType' ;
1916import { extractRequestSigner , verifyRequest } from '../util/HttpMessageSignatures' ;
17+ import { reType } from '../util/ReType' ;
18+ import { ResourceDescription } from '../views/ResourceDescription' ;
2019
2120type ErrorConstructor = { new ( msg : string ) : Error } ;
2221
@@ -29,20 +28,12 @@ type ErrorConstructor = { new(msg: string): Error };
2928export class ResourceRegistrationRequestHandler extends HttpHandler {
3029 protected readonly logger = getLoggerFor ( this ) ;
3130
32- /**
33- * @param {RequestingPartyRegistration[] } resourceServers - Pod Servers to be registered with the UMA AS
34- */
3531 constructor (
3632 private readonly resourceStore : KeyValueStorage < string , ResourceDescription > ,
3733 ) {
3834 super ( ) ;
3935 }
4036
41- /**
42- * Handle incoming requests for resource registration
43- * @param {HttpHandlerContext } param0
44- * @return {Observable<HttpHandlerResponse<PermissionRegistrationResponse>> }
45- */
4637 async handle ( { request } : HttpHandlerContext ) : Promise < HttpHandlerResponse < any > > {
4738 const signer = await extractRequestSigner ( request ) ;
4839
@@ -62,10 +53,6 @@ export class ResourceRegistrationRequestHandler extends HttpHandler {
6253 private async handlePost ( request : HttpHandlerRequest ) : Promise < HttpHandlerResponse < any > > {
6354 const { headers, body } = request ;
6455
65- if ( headers [ 'content-type' ] !== 'application/json' ) {
66- throw new UnsupportedMediaTypeHttpError ( 'Only Media Type "application/json" is supported for this route.' ) ;
67- }
68-
6956 try {
7057 reType ( body , ResourceDescription ) ;
7158 } catch ( e ) {
@@ -80,13 +67,10 @@ export class ResourceRegistrationRequestHandler extends HttpHandler {
8067
8168 return ( {
8269 status : 201 ,
83- headers : {
84- 'content-type' : 'application/json'
85- } ,
86- body : JSON . stringify ( {
70+ body : {
8771 _id : resource ,
8872 user_access_policy_uri : 'TODO: implement policy UI' ,
89- } ) ,
73+ } ,
9074 } )
9175 }
9276
@@ -99,10 +83,7 @@ export class ResourceRegistrationRequestHandler extends HttpHandler {
9983
10084 this . logger . info ( `Deleted resource ${ parameters . id } .` ) ;
10185
102- return ( {
103- status : 204 ,
104- headers : { } ,
105- } ) ;
86+ return { status : 204 } ;
10687 }
10788
10889 /**
0 commit comments