/static-web-apps-auth

Azure static web apps auth library

Primary LanguageTypeScript

Static Web Apps Authentication

Overview

This repo is the home to the npm package @christianacca/angular-swa-auth

The repo includes the following projects:

  • the library itself
  • a demo app for the library
  • another simple demo app that does NOT require the angular-swa-auth helper library to implement authentication

The demo apps and documentation sites are available here:

Run demo app locally

  1. Install nodejs (LTS version)
  2. Clone the source code: git clone https://github.com/christianacca/static-web-apps-auth
  3. Trust the dev HTTPS certificate (see note below on security caveats):
  • windows: double click batch file ./tools/dev-scripts/trust-cert.bat and accept any prompts
  • mac/linux: From powershell, run ./tools/dev-scripts/trust-cert.ps1
  1. Install dependencies: npm install
  2. npm start then browse to https://localhost:4820/

Security caveats when trusting the dev cert

This demo tries to play nicely with best practice of always using TLS even for local development. To make this as frictionless as possible, this repo contains a self-signed cert which needs to be trusted for the browser to accept the content of the demo site served over https for localhost. Yay for convenience!

However, this might pose a security risk (?). If you are concerned with this, then the advice is to re-generate the certificate using the following script BEFORE trusting the cert: generate-dev-certificate.md.

This regenerated cert will only be local to your machine as it will not be committed back to this git repo.

Deploy

The demo apps and library document site are deployed to Azure static web apps:

On every PR:

  • Documentation and demo app sites will be deployed to a pre-prod staging environment
    • note: github bot will add a comment to the PR with the url to the new staging environment
  • Dry run publish of the library package to npm

On push to master:

  • Documentation and demo app sites will be deployed to an prod environment
  • Publish of the library package to npm where the version in package.json is different to the versions already published to npm

Contributing

CONTRIBUTING.md: developer guide if you intend to make changes in this repo

Other guides