Skip to content
Merged
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 1 addition & 4 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
matrix:
os: [ubuntu-latest, macos-latest]
shardIndex: [1, 2, 3, 4] # Split tests into 4 shards
node: [18.19.0, 20.11.1]
node: [18.19.1, 20.11.1]
runs-on: ${{ matrix.os }}
defaults:
run:
Expand Down Expand Up @@ -42,7 +42,6 @@ jobs:
(cd reactjs-todo-journey && npm run e2e -- --shard=${{ matrix.shardIndex }}/4)
(cd reactjs-todo-oidc && npm run e2e -- --shard=${{ matrix.shardIndex }}/4)
(cd reactjs-todo-davinci && npm run e2e -- --shard=${{ matrix.shardIndex }}/4)
(cd angular-todo && npm run e2e -- --shard=${{ matrix.shardIndex }}/4)
env:
REST_OAUTH_SECRET: ${{ secrets.REST_OAUTH_SECRET }}

Expand All @@ -55,7 +54,5 @@ jobs:
./javascript/reactjs-todo-journey/playwright-report
./javascript/reactjs-todo-oidc/test-results
./javascript/reactjs-todo-oidc/playwright-report
./javascript/angular-todo/test-results
./javascript/angular-todo/playwright-report
./javascript/reactjs-todo-davinci/test-results
./javascript/reactjs-todo-davinci/playwright-report
20 changes: 20 additions & 0 deletions javascript/Archived/reactjs-todo-journey-legacy/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# APP_URL= # not using this for preview-environment instead, we can use window.location.origin
SERVER_URL=
SCOPE=
API_URL=
DEBUGGER_OFF=true
DEVELOPMENT=
JOURNEY_LOGIN=
JOURNEY_REGISTER=
PORT=
REALM_PATH=
REST_OAUTH_CLIENT=
REST_OAUTH_SECRET=
WEB_OAUTH_CLIENT=
SERVER_TYPE=
# bootstrap | journey
# 'bootstrap' will initialize protect at app bootstrap time
# 'journey' relies on the PingOneProtectInitialize callback for initialization
INIT_PROTECT=
# required when PingOne Protect callbacks are present
PINGONE_ENV_ID=
9 changes: 9 additions & 0 deletions javascript/Archived/reactjs-todo-journey-legacy/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
node_modules/
/test-results/
/playwright-report/
/blob-report/
/playwright/.cache/
/test-results/
/playwright-report/
/blob-report/
/playwright/.cache/
132 changes: 132 additions & 0 deletions javascript/Archived/reactjs-todo-journey-legacy/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
# React JS Todo Sample App

## Disclaimers

This sample code is provided "as is" and is not a supported product of Ping. It's purpose is solely to demonstrate how the Ping JavaScript SDK can be implemented within a React application. Also, this is not a demonstration of React itself or instructional for _how_ to build a React app. There are many aspects to routing, state management, tooling and other aspects to building a React app that are outside of the scope of this project. For information about creating a React app, [visit React's official documentation](https://reactjs.org/docs/create-a-new-react-app.html).

## Requirements

1. An instance of Ping's Access Manager (AM), either within a Ping's Advanced Identity Cloud tenant, your own private installation or locally installed on your computer
2. Node >= 14.2.0 (recommended: install via [official package installer](https://nodejs.org/en/))
3. Knowledge of using the Terminal/Command Line
4. Ability to generate security certs (recommended: mkcert ([installation instructions here](https://github.com/FiloSottile/mkcert#installation))
5. This project "cloned" to your computer

## Setup

Once you have the 5 requirements above met, we can build the project.

### Setup Your AM Instance

#### Configure CORS

1. Allowed origins: `https://localhost:8443`
2. Allowed methods: `GET` `POST`
3. Allowed headers: `Content-Type` `X-Requested-With` X-Requested-Platform` `Accept-API-Version` `Authorization`
4. Allow credentials: enable

#### Create Your OAuth Clients

1. Create a public (SPA) OAuth client for the web app: no secret, scopes of `openid profile email`, implicit consent enabled, and no "token authentication endpoint method".
2. Create a confidential (Node.js) OAuth client for the API server: with a secret, default scope of `am-introspect-all-tokens`, and `client_secret_basic` as the "token authentication endpoint method".

#### Create your Authentication Journeys/Trees

1. Login
2. Register

Note: The sample app currently supports the following callbacks only:

- NameCallback
- PasswordCallback
- ChoiceCallback
- ValidatedCreateUsernameCallback
- ValidatedCreatePasswordCallback
- StringAttributeInputCallback
- BooleanAttributeInputCallback
- KbaCreateCallback
- TermsAndConditionsCallback
- TextOutputCallback
- ConfirmationCallback
- SelectIdPCallback

### Configure Your `.env` File

Change the name of `.env.example` to `.env` and replace the bracketed values (e.g. `<<<helper-text>>>`) with your values.

Example with annotations:

```text
SERVER_URL=<<<URL to your AM instance>>>
APP_URL=https://localhost:8443 # in develop we do not use this variable for dynamic deployment reasons
API_URL=http://localhost:9443
DEBUGGER_OFF=false
JOURNEY_LOGIN=Login
JOURNEY_REGISTER=Registration
REALM_PATH=<<<Realm path of AM>>>
WEB_OAUTH_CLIENT=<<<Your Web OAuth client name/ID>>>
```

### Installing Dependencies and Run Build

**Run from root of repo**: since this sample app uses npm's workspaces, we recommend running the npm commands from the root of the repo.

```sh
# Install all dependencies (no need to pass the -w option)
npm install
```

### Run the Servers

Now, run the below commands to start the processes needed for building the application and running the servers for both client and API server:

```sh
# In one terminal window, run the following watch command from the root of the repository
npm run start:reactjs-todo-journey
```

Now, you should be able to visit `https://localhost:8443`, which is your web app or client (the Relying Party in OAuth terms). This client will make requests to your AM instance, (the Authorization Server in OAuth terms), which will be running on whatever domain you set, and `http://localhost:9443` as the REST API for your todos (the Resource Server).

### Accept Cert Exceptions

You will likely have to accept the security certificate exceptions for both your React app and the Node.js server. To accept the cert form the Node.js server, you can visit `http://localhost:9443/healthcheck` in your browser. Once you receive "OK", your Node.js server is running on the correct domain and port, and the cert is accepted.

## Learn About Integration Touchpoints

This project has a debugging statements that can be activated which causes the app to pause execution at each SDK integration point. It will have a comment above the `debugger` statement explaining the purpose of the integration.

If you'd like to use this feature as a learning tool, open the developer tools of your browser and rerun the app locally. It will automatically pause at these points of integration.

For local development, if you want to turn these debuggers off, you can set the environment variable of `DEBUGGER_OFF` to true.

## Modifying This Project

### React Client

To modify the client portion of this project, you'll need to be familiar with the following React patterns:

1. [Functional components and composition](https://reactjs.org/docs/components-and-props.html)
2. [Hooks (including custom hooks)](https://reactjs.org/docs/hooks-intro.html)
3. [Context API](https://reactjs.org/docs/hooks-reference.html#usecontext)
4. [React Router](https://reactrouter.com/)

You'll also want a [basic understanding of Webpack](https://webpack.js.org/concepts/) and the following:

1. [Babel transformation for React](https://webpack.js.org/loaders/babel-loader/#root)
2. [Plugins for Sass-to-CSS processing](https://webpack.js.org/loaders/sass-loader/#root)

#### Styling and CSS

We heavily leveraged [Twitter Bootstrap](https://getbootstrap.com/) and [it's utility classes](https://getbootstrap.com/docs/5.0/utilities/api/), but you will see classes with the prefix `cstm_`. These are custom classes, hence the `cstm` shorthand, and they are explicitly used to denote an additional style application on top of Bootstrap's styling.

### REST API Server

To modify the API server, you'll need a [basic understanding of Node](https://nodejs.org/en/about/) as well as the following things:

1. [Express](https://expressjs.com/)
2. [PouchDB](https://pouchdb.com/)
3. [Superagent](https://www.npmjs.com/package/superagent)

## TypeScript?

The Ping JavaScript SDK is developed with TypeScript, so type definitions are available. This sample application does not utilize TypeScript, but if you'd like to see a version of this written in TypeScript, let us know.
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ You will likely have to accept the security certificate exceptions for both your

This project has a debugging statements that can be activated which causes the app to pause execution at each SDK integration point. It will have a comment above the `debugger` statement explaining the purpose of the integration.

If you'd like to use this feature as a learning tool, [open the live app](https://fr-react-todos.crbrl.io/) and then open the developer tools of your browser. Rerun the app with the developer tools open, and it will automatically pause at these points of integration.
If you'd like to use this feature as a learning tool, open the developer tools of your browser and rerun the app locally. It will automatically pause at these points of integration.

For local development, if you want to turn these debuggers off, you can set the environment variable of `DEBUGGER_OFF` to true.

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Components

These are React based units of code that could potentially be used anywhere, to an extent. They are the units that compose a view. These could be actual React components or custom React hooks.
Loading
Loading