-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added routes for contract and vc endpoints
- Loading branch information
Showing
6 changed files
with
148 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"@context": [ | ||
"https://linkedsoftwaredependencies.org/bundles/npm/@solidlab/uma/^0.0.0/components/context.jsonld" | ||
], | ||
"@graph": [ | ||
{ | ||
"@id": "urn:uma:default:ContractRoute", | ||
"@type": "HttpHandlerRoute", | ||
"operations": [ | ||
{ | ||
"@type": "HttpHandlerOperation", | ||
"method": "GET", | ||
"publish": true | ||
} | ||
], | ||
"handler": { | ||
"@type": "ContractRequestHandler", | ||
"baseUrl": { "@id": "urn:uma:variables:baseUrl" } | ||
}, | ||
"path": "/uma/contract" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"@context": [ | ||
"https://linkedsoftwaredependencies.org/bundles/npm/@solidlab/uma/^0.0.0/components/context.jsonld" | ||
], | ||
"@graph": [ | ||
{ | ||
"@id": "urn:uma:default:VCRoute", | ||
"@type": "HttpHandlerRoute", | ||
"operations": [ | ||
{ | ||
"@type": "HttpHandlerOperation", | ||
"method": "GET", | ||
"publish": true | ||
} | ||
], | ||
"handler": { | ||
"@type": "VCRequestHandler", | ||
"baseUrl": { "@id": "urn:uma:variables:baseUrl" } | ||
}, | ||
"path": "/uma/vc" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { ASYMMETRIC_CRYPTOGRAPHIC_ALGORITHM } | ||
from '@solid/access-token-verifier/dist/constant/ASYMMETRIC_CRYPTOGRAPHIC_ALGORITHM'; | ||
import { HttpHandler } from '../util/http/models/HttpHandler'; | ||
import { HttpHandlerContext } from '../util/http/models/HttpHandlerContext'; | ||
import { HttpHandlerResponse } from '../util/http/models/HttpHandlerResponse'; | ||
import { Logger } from '../util/logging/Logger'; | ||
import { getLoggerFor } from '../util/logging/LoggerUtils'; | ||
import { getOperationLogger } from '../logging/OperationLogger'; | ||
|
||
/** | ||
* An HttpHandler used for returning the logs | ||
* stored in the UMA Authorization Service. | ||
*/ | ||
export class ContractRequestHandler extends HttpHandler { | ||
protected readonly logger: Logger = getLoggerFor(this); | ||
|
||
operationLogger = getOperationLogger() | ||
|
||
/** | ||
* An HttpHandler used for returning the configuration | ||
* of the UMA Authorization Service. | ||
* @param {string} baseUrl - Base URL of the AS | ||
*/ | ||
constructor(protected readonly baseUrl: string) { | ||
super(); | ||
} | ||
|
||
/** | ||
* Returns the endpoint's UMA configuration | ||
* | ||
* @param {HttpHandlerContext} context - an irrelevant incoming context | ||
* @return {Observable<HttpHandlerResponse>} - the mock response | ||
*/ | ||
async handle(context: HttpHandlerContext): Promise<HttpHandlerResponse> { | ||
this.logger.info(`Received contract retrieval request at '${context.request.url}'`); | ||
|
||
return { | ||
body: '<this> <is> "the contract endpoint".', | ||
headers: {'content-type': 'application/trig'}, | ||
status: 200, | ||
}; | ||
} | ||
|
||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { ASYMMETRIC_CRYPTOGRAPHIC_ALGORITHM } | ||
from '@solid/access-token-verifier/dist/constant/ASYMMETRIC_CRYPTOGRAPHIC_ALGORITHM'; | ||
import { HttpHandler } from '../util/http/models/HttpHandler'; | ||
import { HttpHandlerContext } from '../util/http/models/HttpHandlerContext'; | ||
import { HttpHandlerResponse } from '../util/http/models/HttpHandlerResponse'; | ||
import { Logger } from '../util/logging/Logger'; | ||
import { getLoggerFor } from '../util/logging/LoggerUtils'; | ||
import { getOperationLogger } from '../logging/OperationLogger'; | ||
import { Quad } from 'n3'; | ||
import { serializeQuads } from '@solid/community-server'; | ||
|
||
|
||
/** | ||
* An HttpHandler used for returning the logs | ||
* stored in the UMA Authorization Service. | ||
*/ | ||
export class VCRequestHandler extends HttpHandler { | ||
protected readonly logger: Logger = getLoggerFor(this); | ||
|
||
operationLogger = getOperationLogger() | ||
|
||
/** | ||
* An HttpHandler used for returning the configuration | ||
* of the UMA Authorization Service. | ||
* @param {string} baseUrl - Base URL of the AS | ||
*/ | ||
constructor(protected readonly baseUrl: string) { | ||
super(); | ||
} | ||
|
||
/** | ||
* Returns the endpoint's UMA configuration | ||
* | ||
* @param {HttpHandlerContext} context - an irrelevant incoming context | ||
* @return {Observable<HttpHandlerResponse>} - the mock response | ||
*/ | ||
async handle(context: HttpHandlerContext): Promise<HttpHandlerResponse> { | ||
this.logger.info(`Received VC endpoint request at '${context.request.url}'`); | ||
|
||
return { | ||
body: '<this> <is> "the vc endpoint".', | ||
headers: {'content-type': 'application/trig'}, | ||
status: 200, | ||
}; | ||
} | ||
|
||
} | ||
|
||
|