-
-
Notifications
You must be signed in to change notification settings - Fork 175
OpenAM UI JS SDK #941
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
maximthomas
wants to merge
45
commits into
OpenIdentityPlatform:master
Choose a base branch
from
maximthomas:openam-js-sdk
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
OpenAM UI JS SDK #941
Changes from all commits
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
5cce4e7
OpenAM UI JS SDK initial commit
maximthomas 30044e5
Add react router and realm and login url parameters
maximthomas c1bab4d
update README
maximthomas 58ba2d3
fix openam-ui-js-sdk build
maximthomas c2a3ec7
add save password function to the default user form
maximthomas 371dddd
Apply suggestions from code review
maximthomas f1414b8
CVE-2025-66453 Rhino has high CPU usage and potential DoS (#943)
dependabot[bot] 26c46cd
Update org.openidentityplatform.opendj to 5.0.2 (#940)
vharseko e4e72e0
CVE-2025-64718 js-yaml has prototype pollution in merge (<<)
maximthomas 4bb652d
CVE-2025-12183 CVE-2025-66566 LZ4 vulnerabilities (#946)
maximthomas 06daa71
Docs: set supported Java and Tomcat versions (#944)
maximthomas d4767d1
[maven-release-plugin] prepare release 16.0.4
ceec917
[maven-release-plugin] prepare for next development iteration
84d7115
fix javadoc build (#948)
maximthomas b8e5872
CVE-2025-67735 Netty has a CRLF Injection vulnerability in io.netty.h…
dependabot[bot] 587ef61
CVE-2025-15284 qs's arrayLimit bypass in its bracket notation allows …
dependabot[bot] 64a29a8
[#951] Set explicit xmlsec dependency for openam-federation-library (…
maximthomas 448c6bd
CVE-2025-13465 Lodash has Prototype Pollution Vulnerability in `_.uns…
dependabot[bot] 1bcf57e
CVE-2025-13465 Lodash versions 4.0.0 through 4.17.22 are vulnerable t…
maximthomas 21fc6e0
[#955] Update JSTL to Jakarta 2.0.0 version (#957)
maximthomas 57d3429
[#956] Add OpenAM secondary instances to the Docker test in build.yml…
maximthomas f4423ff
Update org.openidentityplatform.opendj to 5.0.3 (#947)
vharseko 7810d74
[maven-release-plugin] prepare release 16.0.5
0b35489
[maven-release-plugin] prepare for next development iteration
cbc01e7
CVE-2026-2391 qs's arrayLimit bypass in comma parsing allows denial o…
dependabot[bot] 5b3ee16
CVE-2026-32141 CVE-2026-33228 flatted vulnerable to unbounded recursi…
dependabot[bot] 195c53a
CVE-2026-33439 Pre-Authentication Remote Code Execution via jato.clie…
maximthomas 7af7143
Update opendj.version to 5.0.4 (#964)
vharseko 0b654a6
[maven-release-plugin] prepare release 16.0.6
9cbe55b
[maven-release-plugin] prepare for next development iteration
6382e00
Update build.yml add JDK 26 support (#967)
vharseko 6298224
CVE-2026-33672 CVE-2026-33671: Method injection in POSIX character c…
Copilot e420345
CVE-2026-33870 Netty: HTTP Request Smuggling via Chunked Extension Qu…
dependabot[bot] 7ab7133
disable resource filtering for openam-ui-js-sdk
maximthomas f663164
add missing copyright
maximthomas 9ac2134
process response errors for userService
maximthomas 1d1c858
Merge remote-tracking branch 'origin/master' into openam-js-sdk
maximthomas 72eca21
Apply suggestions from code review
maximthomas 31dc8a7
update parent pom version
maximthomas 8a36867
Apply suggestions from code review
maximthomas 5237f10
add missing copyright
maximthomas 5b0f093
Apply suggestions from code review
maximthomas cf8d55e
fix user service typo
maximthomas 25f5478
Fix review comments
maximthomas 03ed06a
fix build errors
maximthomas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| #VITE_OPENAM_SERVER=http://openam.example.org:8080 | ||
| #VITE_OPENAM_CONTEXT_PATH=/openam |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| VITE_OPENAM_SERVER=http://openam.example.org:8080 | ||
| VITE_OPENAM_CONTEXT_PATH=/openam |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| # Logs | ||
| logs | ||
| *.log | ||
| npm-debug.log* | ||
| yarn-debug.log* | ||
| yarn-error.log* | ||
| pnpm-debug.log* | ||
| lerna-debug.log* | ||
|
|
||
| node_modules | ||
| dist | ||
| dist-ssr | ||
| *.local | ||
|
|
||
| # Editor directories and files | ||
| .vscode/* | ||
| !.vscode/extensions.json | ||
| .idea | ||
| .DS_Store | ||
| *.suo | ||
| *.ntvs* | ||
| *.njsproj | ||
| *.sln | ||
| *.sw? | ||
|
|
||
|
|
||
| *.zip | ||
|
|
||
| example/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,153 @@ | ||
| # OpenAM Alternative Frontend SDK | ||
|
|
||
| OpenAM is a robust access management solution, but integrating it with modern frontend applications can be complex and time-consuming. This SDK aims to simplify that process by providing pre-built React components and a flexible, modular setup, saving developers significant time while ensuring secure, seamless integration with OpenAM. | ||
|
|
||
| This project is intended to provide an alternative frontend SDK for interacting with Open Identity Platform's OpenAM authentication services. It is built using modern web technologies and aims to simplify the integration process for developers. | ||
|
|
||
| ## Features | ||
| - **Ease of Use**: Pre-configured React components ready for integration. | ||
| - **Modular & Flexible**: Easily swap components and customize the SDK to suit your needs. | ||
| - **TypeScript Support**: Enhance development experience with type safety and better code completion. | ||
| - **Seamless Integration**: Easily integrate OpenAM with minimal configuration. | ||
|
|
||
| # Prerequisites | ||
| - Node.js 22 LTS and newer | ||
| - OpenAM 14 and newer | ||
|
|
||
| ## Installation | ||
|
|
||
| Clone and build the source code | ||
|
|
||
| ```bash | ||
| git clone https://github.com/OpenIdentityPlatform/openam-js-sdk.git | ||
| ``` | ||
|
|
||
| ```bash | ||
| cd openam-js-sdk | ||
| npm install | ||
| npm run build | ||
| ``` | ||
|
|
||
| ## Usage | ||
|
|
||
| ### As an Application | ||
|
|
||
| Copy the contents of the `target/app` folder into your OpenAM WAR file (or the extracted WAR contents in your web container), e.g., into a directory like `extui`, so it could be accessible in your OpenAM context path, for example, http://openam.example.org:8080/openam/extui | ||
|
|
||
| You can also run the application in a standalone server. The only condition, the servers should be on the same subdomain, so OpenAM's cookies could be sent from the frontend application. | ||
|
|
||
|
|
||
| ## As an SDK library | ||
|
|
||
| To install the SDK, use npm or yarn: | ||
|
|
||
| ```bash | ||
| npm install <path to openam-js-sdk folder> #for example /home/user/projects/openam-js-sdk | ||
| # or | ||
| yarn add <path to openam-js-sdk folder> | ||
| ``` | ||
| ## Usage | ||
| Here's a basic example of how to use the SDK in a React application: | ||
|
|
||
| ```tsx | ||
| import React from 'react'; | ||
| import { OpenAMUI } from 'openam-js-sdk'; | ||
|
|
||
| const App = () => { | ||
| return ( | ||
| <OpenAMUI /> | ||
| ); | ||
| }; | ||
| ``` | ||
|
|
||
| ## Customization | ||
|
|
||
| You can customize the SDK by providing your own UI components and styles. | ||
|
|
||
| To customize the application behaviour, customise the following settings: | ||
|
|
||
| ```ts | ||
| export interface Config { | ||
| openamServer: string; //OpenAM server host, for example http://openam.example.org:8080 | ||
| openamContextPath: string; //OpenAM context path, for example /openam | ||
| LoginForm: LoginForm; //LoginForm interface implementation | ||
| UserForm: UserForm; //UserForm interface implementation | ||
| ErrorForm: ErrorForm; //ErrorForm interface implementation | ||
| CallbackElement: CallbackElement; //CallbackElement interface implementation | ||
| ActionElements: ActionElements; //ActionElements interface implementation | ||
| redirectOnSuccessfulLogin: boolean; //redirects user on successful login to the target URL, otherwise shows a profile. | ||
| getOpenAmUrl: () => string; //returns a full OpenAM URL, for example http://openam.example.org:8080/openam | ||
| } | ||
| ``` | ||
|
|
||
| for example | ||
|
|
||
| ```tsx | ||
| // update the default configuration | ||
| import React, { StrictMode } from 'react'; | ||
| import { createRoot } from 'react-dom/client'; | ||
| import { OpenAMUI, setConfig } from 'openam-js-sdk'; | ||
|
|
||
| setConfig({ | ||
| openamServer: 'https://openam.example.org:443', | ||
| openamContextPath: '/am', | ||
| ErrorForm: ({ error, resetError }) => { | ||
| return ( | ||
| <div> | ||
| <h1>An error occurred</h1> | ||
| <p>{error?.message}</p> | ||
| <input | ||
| type="button" | ||
| value="Retry" | ||
| onClick={() => resetError()} | ||
| /> | ||
| </div> | ||
| ); | ||
| }, | ||
| }); | ||
|
|
||
| createRoot(document.getElementById('root')!).render( | ||
| <StrictMode> | ||
| <OpenAMUI /> | ||
| </StrictMode>, | ||
| ); | ||
| ``` | ||
|
|
||
| There are components you can override: | ||
|
|
||
| ```tsx | ||
| // renders a login form with callbacks | ||
| export type LoginForm = React.FC<{ | ||
| authData: AuthData, | ||
| setCallbackValue: (i: number, val: string) => void, | ||
| doLogin: (action: string) => void | ||
| }> | ||
|
|
||
| // renders a callback such as NameCallback, PasswordCallback and so on | ||
| export type CallbackElement = React.FC<{ | ||
| callback: Callback | ||
| setCallbackValue: (val: string) => void | ||
| }> | ||
|
|
||
| // renders a user profile form | ||
| export type UserForm = React.FC<{ | ||
| userData: UserData, | ||
| setUserData: (userData: UserData) => void | ||
| saveHandler: () => void | ||
| savePasswordHandler: (password: string) => void | ||
| }> | ||
|
|
||
| // renders an authentication error form | ||
| export type ErrorForm = React.FC<{ | ||
| error: AuthError, | ||
| resetError: () => void | ||
| }> | ||
|
|
||
| // renders submit buttons; if there are no ConfirmationCallback in the callbacks array, renders the default button | ||
| export type ActionElements = React.FC<{callbacks: Callback[]}> | ||
| ``` | ||
|
|
||
|
|
||
| ## Contributing | ||
| Contributions are welcome! Please fork the repository and submit a pull request with your changes. Make sure to follow the coding standards and include tests for any new features. | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <!-- | ||
| * The contents of this file are subject to the terms of the Common Development and | ||
| * Distribution License (the License). You may not use this file except in compliance with the | ||
| * License. | ||
| * | ||
| * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the | ||
| * specific language governing permission and limitations under the License. | ||
| * | ||
| * When distributing Covered Software, include this CDDL Header Notice in each file and include | ||
| * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL | ||
| * Header, with the fields enclosed by brackets [] replaced by your own identifying | ||
| * information: "Portions copyright [year] [name of copyright owner]". | ||
| * | ||
| * Copyright 2025 3A Systems LLC. | ||
| --> | ||
| <assembly xmlns="http://maven.apache.org/ASSEMBLY/2.2.0" | ||
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.2.0 http://maven.apache.org/xsd/assembly-2.2.0.xsd"> | ||
| <id>app</id> | ||
| <baseDirectory>/</baseDirectory> | ||
| <formats> | ||
| <format>zip</format> | ||
| </formats> | ||
| <fileSets> | ||
| <fileSet> | ||
| <directory>target/app</directory> | ||
| <outputDirectory>/</outputDirectory> | ||
| </fileSet> | ||
| </fileSets> | ||
| </assembly> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <!-- | ||
| * The contents of this file are subject to the terms of the Common Development and | ||
| * Distribution License (the License). You may not use this file except in compliance with the | ||
| * License. | ||
| * | ||
| * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the | ||
| * specific language governing permission and limitations under the License. | ||
| * | ||
| * When distributing Covered Software, include this CDDL Header Notice in each file and include | ||
| * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL | ||
| * Header, with the fields enclosed by brackets [] replaced by your own identifying | ||
| * information: "Portions copyright [year] [name of copyright owner]". | ||
| * | ||
| * Copyright 2025 3A Systems LLC. | ||
| --> | ||
| <assembly xmlns="http://maven.apache.org/ASSEMBLY/2.2.0" | ||
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.2.0 http://maven.apache.org/xsd/assembly-2.2.0.xsd"> | ||
| <id>lib</id> | ||
| <baseDirectory>/</baseDirectory> | ||
| <formats> | ||
| <format>zip</format> | ||
| </formats> | ||
| <fileSets> | ||
| <fileSet> | ||
| <directory>target/lib</directory> | ||
| <outputDirectory>/</outputDirectory> | ||
| </fileSet> | ||
| </fileSets> | ||
| </assembly> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| import js from '@eslint/js' | ||
| import globals from 'globals' | ||
| import reactHooks from 'eslint-plugin-react-hooks' | ||
| import reactRefresh from 'eslint-plugin-react-refresh' | ||
| import tseslint from 'typescript-eslint' | ||
| import { defineConfig, globalIgnores } from 'eslint/config' | ||
|
|
||
| export default defineConfig([ | ||
| globalIgnores(['dist']), | ||
| { | ||
| files: ['**/*.{ts,tsx}'], | ||
| extends: [ | ||
| js.configs.recommended, | ||
| tseslint.configs.recommended, | ||
| reactHooks.configs['recommended-latest'], | ||
| reactRefresh.configs.vite, | ||
| ], | ||
| languageOptions: { | ||
| ecmaVersion: 2020, | ||
| globals: globals.browser, | ||
| }, | ||
| }, | ||
| ]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| <!doctype html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
| <title>openam-js-sdk</title> | ||
| </head> | ||
| <body> | ||
| <div id="root"></div> | ||
| <script type="module" src="/src/main.tsx"></script> | ||
| </body> | ||
| </html> |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.