Skip to content

Commit

Permalink
fix: support pfx file
Browse files Browse the repository at this point in the history
  • Loading branch information
ralfaron committed Jul 7, 2024
1 parent 321b386 commit a6a3644
Show file tree
Hide file tree
Showing 7 changed files with 879 additions and 1,126 deletions.
1,964 changes: 852 additions & 1,112 deletions aasportal.mdx

Large diffs are not rendered by default.

16 changes: 10 additions & 6 deletions create-jwt.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import jwt from 'jsonwebtoken';

const token = jwt.sign({
id: '[email protected]',
name: 'John Doe',
role: 'editor'
}, 'The quick brown fox jumps over the lazy dog.');
const token = jwt.sign(
{
id: '[email protected]',
name: 'John Doe',
role: 'editor',
},
'The quick brown fox jumps over the lazy dog.',
);

console.log(token);
// eslint-disable-next-line no-undef
console.log(token);
Binary file modified docs/source/images/aas-portal-project.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/source/images/main.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions init-mongo.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ db.createUser({
roles: [
{
role: 'readWrite',
db: 'aasportal-users'
}
]
})
db: 'aasportal-users',
},
],
});
12 changes: 8 additions & 4 deletions projects/aas-server/src/app/variable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export class Variable {
this.SCAN_CONTAINER_TIMEOUT = process.env.SCAN_CONTAINER_TIMEOUT ? Number(process.env.TIMEOUT) : 5000;
this.HTTPS_CERT_FILE = process.env.HTTPS_CERT_FILE;
this.HTTPS_KEY_FILE = process.env.HTTPS_KEY_FILE;
this.HTTPS_PFX_FILE = process.env.HTTPS_PFX_FILE;
this.AAS_EXPIRES_IN = process.env.AAS_EXPIRES_IN ? Number(process.env.AAS_EXPIRES_IN) : 86400000;
this.AAS_INDEX = process.env.AAS_INDEX;
this.AAS_SERVER_USERNAME = process.env.AAS_SERVER_USERNAME ?? 'aas-server';
Expand Down Expand Up @@ -73,10 +74,10 @@ export class Variable {
/** The URLs of the initial AAS container endpoints. */
public readonly ENDPOINTS: string[];

/** */
/** The time before a new endpoint scan starts.*/
public readonly SCAN_CONTAINER_TIMEOUT: number;

/** */
/** The time before a new template scan starts. */
public readonly SCAN_TEMPLATES_TIMEOUT: number;

/** The key file if AASServer supports HTTPS. */
Expand All @@ -85,15 +86,18 @@ export class Variable {
/** The certificate file if AASServer supports HTTPS. */
public readonly HTTPS_CERT_FILE?: string;

/** The pfx file if AASServer supports HTTPS. */
public readonly HTTPS_PFX_FILE?: string;

/** The validity period of an AAS in milliseconds. */
public readonly AAS_EXPIRES_IN: number;

/** The AASIndex realization. */
public readonly AAS_INDEX?: string;

/** ToDo */
/** The user name of AASServer (default: aas-server) */
public readonly AAS_SERVER_USERNAME: string;

/** ToDo */
/** The root password. */
public readonly AAS_SERVER_PASSWORD: string;
}
5 changes: 5 additions & 0 deletions projects/aas-server/src/app/ws-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ export class WSServer extends EventEmitter {
key: fs.readFileSync(this.variable.HTTPS_KEY_FILE),
cert: fs.readFileSync(this.variable.HTTPS_CERT_FILE),
});
} else if (this.variable.HTTPS_PFX_FILE) {
this.server = https.createServer({
pfx: fs.readFileSync(this.variable.HTTPS_PFX_FILE),
passphrase: this.variable.AAS_SERVER_PASSWORD,
});
} else {
this.server = http.createServer();
}
Expand Down

0 comments on commit a6a3644

Please sign in to comment.