Skip to content
项目

gary-archer/oauth.websample.final

在 GitHub 查看

关于

Final SPA Code Sample, secured with OAuth and OpenID Connect

安全与隐私

这些数字如何统计

实测星标增长

24小时
0
7天
0
15天
0
1个月
正在收集历史

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

OAuth Final SPA

Codacy Badge

Known Vulnerabilities

Overview

The final demo Single Page Application, which aims to meet some Web Architecture Goals.
The Token Handler Pattern enables the following main behaviors:

  • The SPA uses the most secure cookies with no tokens in the browser, to limit the impact of XSS exploits.
  • The SPA uses modern productive development with only client side React technology.
  • The SPA static content is distributed to hundreds of locations by a CDN for best web performance.

Components

Cookies are managed solely by OAuth Agent and OAuth Proxy utilities on the API side of the architecture:

SPA Architecture

Views

The SPA is a simple UI with some basic navigation between views, to render fictional investment resources.
Its data is returned from an OAuth-secured API that uses claims-based authorization.
The SPA uses user attributes from both the OpenID Connect userinfo endpoint and its API.

SPA Views

Online System

The online version uses the AWS CloudFront content delivery network to deliver static content to the browser.
Login at https://www.authsamples.com/ with the following AWS Cognito test account:

- User: [email protected]
- Password: GuestPassword1

Local Development Quick Start

Run the code sample from a terminal on Linux, macOS or Windows (with Git bash).
The SPA uses Real World OAuth Development URLs on a local computer.

Administrator Setup

You must use admin permissions to configure infrastructure before you run the code.
First, add DNS entries to your /etc/hosts file:

127.0.0.1 localhost www.authsamples-dev.com

Make sure OpenSSL 3+ is installed, specify a secrets folder, then create development certificates:

export SECRETS_FOLDER="$HOME/secrets"
mkdir -p "$SECRETS_FOLDER"
./certs/create.sh

Configure HTTPS Trust for the SSL root certificate at the following location:

./certs/authsamples-dev.ca.crt

Ensure that Node.js 26+ is installed, then grant it access to listen on port 443:

sudo setcap 'cap_net_bind_service=+ep' $(which node)

Run the Code

Then run the SPA, which does not require admin permissions:

./start.sh

The browser then opens at https://www.authsamples-dev.com/ and you can sign in with the test account.
You can then test all lifecycle operations, including expiry events, multi-tab browsing and multi-tab logout.

Further Information

Programming Languages

  • The app's code uses TypeScript and its views use React.

Infrastructure

  • AWS Route 53 provides custom hosting domains.
  • AWS S3 is the upload point for web static content.
  • AWS CloudFront distributes web static content globally, for equal web performance.
  • AWS Certificate Manager issues and auto renews the web host's SSL certificate.
  • AWS Cognito is the default authorization server for the SPA and API components.
  • AWS Serverless or Kubernetes host remote API endpoints that the SPA calls.
  • Token handler components implement API-driven cookie issuing on behalf of the SPA.

探索相关项目

加载中…