Skip to content
المشاريع

gary-archer/oauth.websample.final

عرض على GitHub

حول

Final SPA Code Sample, secured with OAuth and OpenID Connect

الأمان والخصوصية

كيف تُقاس هذه الأرقام

النمو المقاس للنجوم

خلال 24 ساعة
٠
خلال 7 أيام
٠
خلال 15 يومًا
٠
خلال شهر
جارٍ جمع السجل

تغيّر صافي النجوم خلال فترات متداخلة، وليس مجموعًا يوميًا. تبقى القياسات المفقودة فارغة. النجوم تقيس الاهتمام لا جودة البرمجيات.

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.

استكشف مشاريع مشابهة ومرتبطة

جارٍ التحميل…