generated from digitalbazaar/bedrock-module-template-http
-
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.
- Loading branch information
Showing
27 changed files
with
1,169 additions
and
120 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
module.exports = { | ||
root: true, | ||
env: { | ||
node: true | ||
}, | ||
extends: [ | ||
'digitalbazaar', | ||
'digitalbazaar/jsdoc', | ||
'digitalbazaar/module' | ||
], | ||
ignorePatterns: ['node_modules/'], | ||
rules: { | ||
'unicorn/prefer-node-protocol': 'error' | ||
} | ||
}; |
This file was deleted.
Oops, something went wrong.
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 @@ | ||
legacy-peer-deps=true |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# bedrock-module-template-http ChangeLog | ||
# bedrock-basic-authz-server ChangeLog | ||
|
||
## 1.0.0 - TBD | ||
## 1.0.0 - 2025-mm-dd | ||
|
||
- See git history for changes. |
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 |
---|---|---|
@@ -1 +1 @@ | ||
# bedrock-module-template-http | ||
# bedrock-basic-authz-server |
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 |
---|---|---|
@@ -1,13 +1,68 @@ | ||
/*! | ||
* Copyright (c) 2021 Digital Bazaar, Inc. All rights reserved. | ||
* Copyright (c) 2024-2025 Digital Bazaar, Inc. All rights reserved. | ||
*/ | ||
import bedrock from 'bedrock'; | ||
const {config} = bedrock; | ||
import {config} from '@bedrock/core'; | ||
import {NAMESPACE} from './constants.js'; | ||
|
||
const namespace = 'module-template-http'; | ||
const cfg = config[namespace] = {}; | ||
const cfg = config[NAMESPACE] = {}; | ||
|
||
const basePath = '/foo'; | ||
cfg.routes = { | ||
basePath | ||
cfg.authorizeZcapInvocationOptions = { | ||
maxChainLength: 10, | ||
// 300 second clock skew permitted by default | ||
maxClockSkew: 300, | ||
// 1 year max TTL by default | ||
maxDelegationTtl: 1 * 60 * 60 * 24 * 365 * 1000 | ||
}; | ||
|
||
cfg.authorization = { | ||
oauth2: { | ||
accessTokens: { | ||
// TTL in seconds (default 24 hours = 86400 seconds) | ||
ttl: 86400 | ||
}, | ||
routes: { | ||
asMetadata: `/.well-known/oauth-authorization-server`, | ||
token: `/openid/token`, | ||
jwks: `/openid/jwks` | ||
}, | ||
clients: { | ||
/* | ||
<pet name of client>: { | ||
client_id: ..., | ||
// scopes that can be requested in the future; changing this DOES NOT | ||
// alter existing access (for already issued tokens) | ||
requestableScopes: ..., | ||
// a SHA-256 of the client ID's password; security depends on passwords | ||
// being sufficiently large (16 bytes or more) random strings; this | ||
// field should be populated using an appropriate cloud secret store | ||
// in any deployment | ||
passwordHash | ||
} | ||
*/ | ||
}, | ||
// 300 second clock skew permitted by default | ||
maxClockSkew: 300, | ||
// note: using undefined `allowedAlgorithms` will use the defaults set | ||
// by the `jose` library that are appropriate for the key / secret type; | ||
// (i.e., only asymmetric crypto will be used here); the top-level/parent | ||
// app should choose to either use `undefined` as the default or specify | ||
// a more restrictive list | ||
/*allowedAlgorithms: [ | ||
// RSASSA-PKCS1-v1_ w/sha-XXX | ||
'RS256', | ||
'RS384', | ||
'RS512', | ||
// RSASSA-PSS w/ SHA-XXX | ||
'PS256', | ||
'PS384', | ||
'PS512', | ||
// ECDSA w/ SHA-XXX | ||
'ES256', | ||
'ES256K', | ||
'ES384', | ||
'ES512', | ||
// ed25519 / ed448 | ||
'EdDSA' | ||
]*/ | ||
} | ||
}; |
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,4 @@ | ||
/*! | ||
* Copyright (c) 2025 Digital Bazaar, Inc. All rights reserved. | ||
*/ | ||
export const NAMESPACE = 'basic-authz-server'; |
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,27 @@ | ||
/*! | ||
* Copyright (c) 2018-2025 Digital Bazaar, Inc. All rights reserved. | ||
*/ | ||
import {documentLoader as brDocumentLoader} | ||
from '@bedrock/jsonld-document-loader'; | ||
import {didIo} from '@bedrock/did-io'; | ||
|
||
import '@bedrock/did-context'; | ||
import '@bedrock/security-context'; | ||
import '@bedrock/veres-one-context'; | ||
|
||
// load config defaults | ||
import './config.js'; | ||
|
||
export async function documentLoader(url) { | ||
if(url.startsWith('did:')) { | ||
const document = await didIo.get({did: url}); | ||
return { | ||
contextUrl: null, | ||
documentUrl: url, | ||
document | ||
}; | ||
} | ||
|
||
// finally, try the bedrock document loader | ||
return brDocumentLoader(url); | ||
} |
This file was deleted.
Oops, something went wrong.
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,7 @@ | ||
/*! | ||
* Copyright (c) 2024-2025 Digital Bazaar, Inc. All rights reserved. | ||
*/ | ||
import * as middleware from './middleware.js'; | ||
import {addOAuth2AuthzServer} from './oauth2.js'; | ||
|
||
export {middleware, addOAuth2AuthzServer}; |
Oops, something went wrong.