Skip to content

Commit

Permalink
Being integration of Capability Tokens and Identity Protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
martindale committed Sep 8, 2022
1 parent 9b3456e commit d15bac4
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 2 deletions.
10 changes: 10 additions & 0 deletions constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ const {
const TICK_INTERVAL = 1000;
const SESSION_SEED = '79084a7963fc1761e8f6871d6aa704c4922316030af4aa5a076dde35fc0b6857';

// auth
const HTTP_IDENTITY_HEADER_NAME = 'X-Fabric-Identity';
const HTTP_SIGNATURE_HEADER_NAME = 'X-Fabric-Signature';
const HTTP_IDENTITY_HEADER_NAME_LOWER = HTTP_IDENTITY_HEADER_NAME.toLowerCase();
const HTTP_SIGNATURE_HEADER_NAME_LOWER = HTTP_SIGNATURE_HEADER_NAME.toLowerCase();

// http
const HTTP_CLIENT_PORT = 80;
const HTTP_SERVER_PORT = 9999;
Expand All @@ -27,6 +33,10 @@ const BROWSER_TARGET = '#browser-content';
module.exports = {
TICK_INTERVAL,
SESSION_SEED,
HTTP_IDENTITY_HEADER_NAME,
HTTP_SIGNATURE_HEADER_NAME,
HTTP_IDENTITY_HEADER_NAME_LOWER,
HTTP_SIGNATURE_HEADER_NAME_LOWER,
HTTP_CLIENT_PORT,
HTTP_SERVER_PORT,
HTTPS_CLIENT_PORT,
Expand Down
9 changes: 9 additions & 0 deletions contracts/hasRole.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = function hasRole (role) {
if (this.identity) {
console.debug('[!!!] Identity start:', this.identity);
console.debug('[!!!] Checking for role:', role);
console.debug('[!!!] Authorization:', this.headers['authorization']);
}

return false;
}
16 changes: 16 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
],
"dependencies": {
"@fabric/core": "FabricLabs/fabric#master",
"@fabric/connect": "martindale/fabric-auth-middleware#eric/develop",
"body-parser": "^1.18.3",
"cross-fetch": "^3.1.5",
"d3": "^5.9.2",
Expand All @@ -55,7 +56,6 @@
"express-flash": "^0.0.2",
"express-session": "^1.15.6",
"fast-json-patch": "^3.1.1",
"fabric-auth-middleware": "FabricLabs/fabric-auth-middleware#master",
"isomorphic-ws": "^4.0.1",
"jquery": "^3.4.1",
"js-beautify": "^1.14.6",
Expand Down
4 changes: 3 additions & 1 deletion types/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ const http = require('http');
const crypto = require('crypto');
const merge = require('lodash.merge');
const pluralize = require('pluralize');
const auth = require('fabric-auth-middleware');

// TODO: remove Express entirely...
// NOTE: current blockers include PeerServer...
Expand All @@ -39,6 +38,9 @@ const Message = require('@fabric/core/types/message');
const Entity = require('@fabric/core/types/entity');
const State = require('@fabric/core/types/state');

// Internal Types
const auth = require('../middlewares/auth');

// Internal Components
// const App = require('./app');
// const Client = require('./client');
Expand Down

0 comments on commit d15bac4

Please sign in to comment.