Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for http server #285

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ ARG BUILD_DATE
ARG VCS_REF
ARG VCS_URL
ARG VERSION
ARG USE_HTTPS
ARG EXPOSE_HTTPS_PORT

# Define the Metadata Container image
Expand Down Expand Up @@ -59,6 +60,7 @@ ADD . /spid-saml-check
RUN mkdir /spid-saml-check/data

ENV TZ=Europe/Rome
ENV NODE_USE_HTTPS=${USE_HTTPS}
ENV NODE_HTTPS_PORT=${EXPOSE_HTTPS_PORT}

# Build validator
Expand Down
6 changes: 6 additions & 0 deletions README.it.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ docker run -t -i -p 8443:8443 italia/spid-saml-check

# Esecuzione di una specifica versione
docker run -t -i -p 8443:8443 italia/spid-saml-check:v.1.8.1

# Esecuzione dell'ultima versione specificando la porta TLS
docker run -t -i -p 10443:10443 -e NODE_HTTPS_PORT=10443 italia/spid-saml-check

# Esecuzione dell'ultima versione disabilitando il TLS e porta 8080
docker run -t -i -p 8080:8080 -e NODE_USE_HTTPS=false -e NODE_HTTPS_PORT=8080 italia/spid-saml-check
```

Così facendo l'applicazione spid-validator è immediatamente disponibile
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ docker run -t -i -p 8443:8443 italia/spid-saml-check

# Executes a specific version
docker run -t -i -p 8443:8443 italia/spid-saml-check:v.1.8.2

# Executes a specific version setting TLS port
docker run -t -i -p 10443:10443 -e NODE_HTTPS_PORT=10443 italia/spid-saml-check

# Executes a specific version disabling TLS and setting port 8080
docker run -t -i -p 8080:8080 -e NODE_USE_HTTPS=false -e NODE_HTTPS_PORT=8080 italia/spid-saml-check
```

The application spid-validator is immediately available at https://localhost:8443
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ services:
container_name: spid-saml-check
restart: unless-stopped
ports:
- "8080:8080"
- "8443:8443"
3 changes: 2 additions & 1 deletion spid-validator/config/server.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"host": "https://localhost",
"port": 8443,
"port": 8080,
"s_port": 8443,
"useProxy": false,
"useHttps": true,
"httpsPrivateKey": "./config/spid-saml-check.key",
Expand Down
11 changes: 8 additions & 3 deletions spid-validator/server/spid-validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,13 @@ const Authenticator = require("./lib/authenticator");
const { config } = require("process");
const os = require('os');

const useHttps = config_server.useHttps;
const httpPort = (process.env.NODE_HTTPS_PORT) ? process.env.NODE_HTTPS_PORT : config_server.port;
const useHttps = (process.env.NODE_USE_HTTPS) ? /^true$/i.test(process.env.NODE_USE_HTTPS) : config_server.useHttps;
const httpPort = process.env.NODE_HTTPS_PORT
? process.env.NODE_HTTPS_PORT
: useHttps
? config_server.s_port
: config_server.port;


let https;
let httpsPrivateKey;
Expand Down Expand Up @@ -278,5 +283,5 @@ app.listen(httpPort, () => {
console.log("\n\nSPID SP Test Tool (spid-sp-test), version: " + version);
});

console.log("\n\nlistening on port " + httpPort);
console.log("\n\nlistening on port " + httpPort + " support for TLS is: " + useHttps);
});