Skip to content
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

Add Wso2 IS integration #67

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions frontend/.env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
REACT_APP_API_BASE_URL=http://localhost:8000
REACT_APP_WEB_SOCKET_BASE_URL=ws://127.0.0.1:8000
REACT_APP_RECAPTCHA_SITEKEY=
IDENTITY_SERVER_URL=https://localhost:9443/
CLIENT_ID=zaD9TmFtlFCVWkH4ny9uE6IVpQYa
3 changes: 3 additions & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,18 @@
"@material-ui/core": "^3.9.2",
"@material-ui/icons": "^3.0.2",
"@material-ui/lab": "^3.0.0-alpha.30",
"await-semaphore": "^0.1.3",
"axios": "^0.18.1",
"blueimp-md5": "^2.12.0",
"crypto-js": "^4.0.0",
"draft-js": "^0.11.1",
"draft-js-image-plugin": "^2.0.7",
"draft-js-plugins-editor": "^2.1.1",
"draftjs-to-html": "^0.8.4",
"filepond": "^4.7.2",
"filepond-plugin-file-validate-size": "^2.2.0",
"formik": "^1.5.8",
"history": "^4.10.1",
"immer": "^2.1.4",
"immutable": "^4.0.0-rc.12",
"material-table": "1.35.0",
Expand Down
69 changes: 69 additions & 0 deletions frontend/src/authentication/auth-module/actions/crypto.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/**
* Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/// <reference types="crypto-js" />
import { JWKInterface } from "../models/crypto";
/**
* Generate email hash.
*
* @returns {string} hashed email address.
*/
export declare const getEmailHash: (emailAddress: string) => import("crypto-js").WordArray;
/**
* Get URL encoded string.
*
* @param {CryptoJS.WordArray} value.
* @returns {string} base 64 url encoded value.
*/
export declare const base64URLEncode: (value: import("crypto-js").WordArray) => string;
/**
* Generate code verifier.
*
* @returns {string} code verifier.
*/
export declare const getCodeVerifier: () => string;
/**
* Derive code challenge from the code verifier.
*
* @param {string} verifier.
* @returns {string} code challenge.
*/
export declare const getCodeChallenge: (verifier: string) => string;
/**
* Get the supported signing algorithms for the id_token.
*
* @returns {string[]} array of supported algorithms.
*/
export declare const getSupportedSignatureAlgorithms: () => string[];
/**
* Get JWK used for the id_token
*
* @param {string} jwtHeader header of the id_token.
* @param {JWKInterface[]} keys jwks response.
* @returns {any} public key.
*/
export declare const getJWKForTheIdToken: (jwtHeader: string, keys: JWKInterface[]) => any;
/**
* Verify id token.
*
* @param idToken id_token received from the IdP.
* @param jwk public key used for signing.
* @param {string} clientID app identification.
* @param {string} issuer id_token issuer.
* @returns {any} whether the id_token is valid.
*/
export declare const isValidIdToken: (idToken: any, jwk: any, clientID: string, issuer: string) => any;
104 changes: 104 additions & 0 deletions frontend/src/authentication/auth-module/actions/crypto.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

129 changes: 129 additions & 0 deletions frontend/src/authentication/auth-module/actions/op-config.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
/**
* Copyright (c) 2019, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/**
* Checks whether openid configuration initiated.
*
* @returns {boolean}
*/
export declare const isOPConfigInitiated: () => boolean;
/**
* Set OAuth2 authorize endpoint.
*
* @param {string} authorizationEndpoint
*/
export declare const setAuthorizeEndpoint: (authorizationEndpoint: string) => void;
/**
* Set OAuth2 token endpoint.
*
* @param {string} tokenEndpoint
*/
export declare const setTokenEndpoint: (tokenEndpoint: string) => void;
/**
* Set OIDC end session endpoint.
*
* @param {string} endSessionEndpoint
*/
export declare const setEndSessionEndpoint: (endSessionEndpoint: string) => void;
/**
* Set JWKS URI.
*
* @param jwksEndpoint
*/
export declare const setJwksUri: (jwksEndpoint: any) => void;
/**
* Set OAuth2 revoke token endpoint.
*
* @param {string} revokeTokenEndpoint
*/
export declare const setRevokeTokenEndpoint: (revokeTokenEndpoint: string) => void;
/**
* Set openid configuration initiated.
*/
export declare const setOPConfigInitiated: () => void;
/**
* Set id_token issuer.
*
* @param issuer id_token issuer.
*/
export declare const setIssuer: (issuer: any) => void;
/**
* Initialize openid provider configuration.
*
* @param {string} wellKnownEndpoint openid provider configuration.
* @param {boolean} forceInit whether to initialize the configuration again.
* @returns {Promise<any>} promise.
*/
export declare const initOPConfiguration: (wellKnownEndpoint: string, forceInit: boolean) => Promise<any>;
/**
* Reset openid provider configuration.
*/
export declare const resetOPConfiguration: () => void;
/**
* Get OAuth2 authorize endpoint.
*
* @returns {string|null}
*/
export declare const getAuthorizeEndpoint: () => string;
/**
* Get OAuth2 token endpoint.
*
* @returns {string|null}
*/
export declare const getTokenEndpoint: () => string;
/**
* Get OAuth2 revoke token endpoint.
*
* @returns {string|null}
*/
export declare const getRevokeTokenEndpoint: () => string;
/**
* Get OIDC end session endpoint.
*
* @returns {string|null}
*/
export declare const getEndSessionEndpoint: () => string;
/**
* Get JWKS URI.
*
* @returns {string|null}
*/
export declare const getJwksUri: () => string;
/**
* Get authenticated user's username
*
* @returns {string|null}
*/
export declare const getUsername: () => string;
/**
* Get tenant name
*
* @returns {any}
*/
export declare const getTenant: () => string | string[];
/**
* Get id_token issuer.
*
* @returns {any}
*/
export declare const getIssuer: () => string;
/**
* Checks whether openid configuration initiated is valid.
*
* @returns {boolean}
*/
export declare const isValidOPConfig: (tenant: any) => boolean;
Loading