0.0.4 • Published 5 years ago

authservestatic v0.0.4

Weekly downloads
1
License
ISC
Repository
-
Last release
5 years ago

StaticAuth

Simple module to serve static files with authentication.

Writing staticauth.json file

This is the config file that will be used to load the keys for auth, redirection urls and other data. You need to have a file called staticauth.json in the root. It will look something like this:

{
  "domain": "https://yourdomain.com",
  "callbackEndpoint": "/auth/google/callback",
  "contentFolder": "site",
  "googleAuth": {
    "clientID": "32724...90634r.apps.googleusercontent.com",
    "clientSecret": "QLYmt...YxGHq",
    "userProfileURL": "https://www.googleapis.com/oauth2/v3/userinfo"
  },
  "scope": [
    "profile",
    "email"
  ],
  "cookie": {
    "name": "session",
    "keys": [
      "key 1",
      "key 2"
    ],
    "maxAge": 86400000  // age in seconds
  },
  "validDomains": [
    "yourcompany.com"
  ],
  "failureMessage": "You need a valid YOURCOMPANY account to login",
  "failedAuthPage": "./failedauth.html",
  "successRedirect": "/docs"
}

How

  • make sure you dump your static content into the site folder
  • Install deps using npm install
  • do npm run deploy