@asgardeo/node 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +72 -0
- package/dist/AsgardeoNodeClient.d.ts +28 -0
- package/dist/__legacy__/client.d.ts +346 -0
- package/dist/__legacy__/constants/index.d.ts +19 -0
- package/dist/__legacy__/constants/logger-config.d.ts +29 -0
- package/dist/__legacy__/constants/uuid-config.d.ts +18 -0
- package/dist/__legacy__/core/authentication.d.ts +43 -0
- package/dist/__legacy__/core/index.d.ts +18 -0
- package/dist/__legacy__/models/index.d.ts +19 -0
- package/dist/__legacy__/models/session-data.d.ts +22 -0
- package/dist/__legacy__/models/url-callback.d.ts +20 -0
- package/dist/__legacy__/stores/index.d.ts +18 -0
- package/dist/__legacy__/stores/memory-cache-store.d.ts +23 -0
- package/dist/__legacy__/utils/crypto-utils.d.ts +31 -0
- package/dist/__legacy__/utils/index.d.ts +19 -0
- package/dist/__legacy__/utils/logger-utils.d.ts +25 -0
- package/dist/__legacy__/utils/session-utils.d.ts +24 -0
- package/dist/cjs/index.js +795 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/constants/CookieConfig.d.ts +26 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.js +759 -0
- package/dist/index.js.map +7 -0
- package/dist/models/config.d.ts +29 -0
- package/dist/models/cookies.d.ts +58 -0
- package/dist/utils/generateSessionId.d.ts +19 -0
- package/dist/utils/getSessionCookieOptions.d.ts +40 -0
- package/package.json +68 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022, WSO2 Inc. (http://www.wso2.com) All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* WSO2 Inc. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
export declare const LOGGER_CONFIG: {
|
|
19
|
+
bgGreen: string;
|
|
20
|
+
bgRed: string;
|
|
21
|
+
bgWhite: string;
|
|
22
|
+
bgYellow: string;
|
|
23
|
+
fgBlack: string;
|
|
24
|
+
fgGreen: string;
|
|
25
|
+
fgRed: string;
|
|
26
|
+
fgWhite: string;
|
|
27
|
+
fgYellow: string;
|
|
28
|
+
reset: string;
|
|
29
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022, WSO2 Inc. (http://www.wso2.com) All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* WSO2 Inc. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
export declare const UUID_VERSION = 4;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022, WSO2 Inc. (http://www.wso2.com) All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* WSO2 Inc. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
import { AuthClientConfig, BasicUserInfo, CustomGrantConfig, DataLayer, IdTokenPayload, FetchResponse, OIDCEndpoints, Store, TokenResponse } from '@asgardeo/javascript';
|
|
19
|
+
import { AuthURLCallback } from '../models';
|
|
20
|
+
export declare class AsgardeoNodeCore<T> {
|
|
21
|
+
private _auth;
|
|
22
|
+
private _cryptoUtils;
|
|
23
|
+
private _store;
|
|
24
|
+
private _dataLayer;
|
|
25
|
+
constructor(config: AuthClientConfig<T>, store?: Store);
|
|
26
|
+
signIn(authURLCallback: AuthURLCallback, userID: string, authorizationCode?: string, sessionState?: string, state?: string, signInConfig?: Record<string, string | boolean>): Promise<TokenResponse>;
|
|
27
|
+
getAuthURL(userId: string, signInConfig?: Record<string, string | boolean>): Promise<string>;
|
|
28
|
+
requestAccessToken(authorizationCode: string, sessionState: string, userId: string, state: string): Promise<TokenResponse>;
|
|
29
|
+
getIDToken(userId: string): Promise<string>;
|
|
30
|
+
refreshAccessToken(userId?: string): Promise<TokenResponse>;
|
|
31
|
+
isAuthenticated(userId: string): Promise<boolean>;
|
|
32
|
+
signOut(userId: string): Promise<string>;
|
|
33
|
+
getBasicUserInfo(userId: string): Promise<BasicUserInfo>;
|
|
34
|
+
getOIDCServiceEndpoints(): Promise<OIDCEndpoints>;
|
|
35
|
+
getDecodedIDToken(userId?: string): Promise<IdTokenPayload>;
|
|
36
|
+
getAccessToken(userId?: string): Promise<string>;
|
|
37
|
+
requestCustomGrant(config: CustomGrantConfig, userId?: string): Promise<TokenResponse | FetchResponse>;
|
|
38
|
+
updateConfig(config: Partial<AuthClientConfig<T>>): Promise<void>;
|
|
39
|
+
revokeAccessToken(userId?: string): Promise<FetchResponse>;
|
|
40
|
+
static didSignOutFail(signOutRedirectURL: string): boolean;
|
|
41
|
+
static isSignOutSuccessful(signOutRedirectURL: string): boolean;
|
|
42
|
+
getDataLayer(): DataLayer<T>;
|
|
43
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022, WSO2 Inc. (http://www.wso2.com) All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* WSO2 Inc. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
export * from "./authentication";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022, WSO2 Inc. (http://www.wso2.com) All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* WSO2 Inc. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
export * from "./url-callback";
|
|
19
|
+
export * from "./session-data";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022, WSO2 Inc. (http://www.wso2.com) All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* WSO2 Inc. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
import { TokenResponse } from '@asgardeo/javascript';
|
|
19
|
+
export interface NodeSessionData extends TokenResponse {
|
|
20
|
+
createdAt: number;
|
|
21
|
+
expired?: boolean;
|
|
22
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022, WSO2 Inc. (http://www.wso2.com) All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* WSO2 Inc. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
export interface AuthURLCallback {
|
|
19
|
+
(url: string): void;
|
|
20
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022, WSO2 Inc. (http://www.wso2.com) All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* WSO2 Inc. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
export * from "./memory-cache-store";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022, WSO2 Inc. (http://www.wso2.com) All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* WSO2 Inc. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
import { Store } from '@asgardeo/javascript';
|
|
19
|
+
export declare class MemoryCacheStore implements Store {
|
|
20
|
+
setData(key: string, value: string): Promise<void>;
|
|
21
|
+
getData(key: string): Promise<string>;
|
|
22
|
+
removeData(key: string): Promise<void>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022, WSO2 Inc. (http://www.wso2.com) All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* WSO2 Inc. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
import { Crypto, JWKInterface } from '@asgardeo/javascript';
|
|
19
|
+
export declare class NodeCryptoUtils implements Crypto<Buffer | string> {
|
|
20
|
+
constructor();
|
|
21
|
+
/**
|
|
22
|
+
* Get URL encoded string.
|
|
23
|
+
*
|
|
24
|
+
* @returns {string} base 64 url encoded value.
|
|
25
|
+
*/
|
|
26
|
+
base64URLEncode(value: Buffer | string): string;
|
|
27
|
+
base64URLDecode(value: string): string;
|
|
28
|
+
hashSha256(data: string): string | Buffer;
|
|
29
|
+
generateRandomBytes(length: number): string | Buffer;
|
|
30
|
+
verifyJwt(idToken: string, jwk: Partial<JWKInterface>, algorithms: string[], clientID: string, issuer: string, subject: string, clockTolerance?: number): Promise<boolean>;
|
|
31
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022, WSO2 Inc. (http://www.wso2.com) All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* WSO2 Inc. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
export * from "./session-utils";
|
|
19
|
+
export * from "./logger-utils";
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022, WSO2 Inc. (http://www.wso2.com) All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* WSO2 Inc. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
export declare class Logger {
|
|
19
|
+
static LOG_LEVEL: string;
|
|
20
|
+
private constructor();
|
|
21
|
+
static debug(message: string): void;
|
|
22
|
+
static info(message: string): void;
|
|
23
|
+
static warn(message: string): void;
|
|
24
|
+
static error(message: string): void;
|
|
25
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2022, WSO2 Inc. (http://www.wso2.com) All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* WSO2 Inc. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
import { SessionData } from "@asgardeo/javascript";
|
|
19
|
+
export declare class SessionUtils {
|
|
20
|
+
private constructor();
|
|
21
|
+
static createUUID(): string;
|
|
22
|
+
static validateUUID(uuid: string): Promise<boolean>;
|
|
23
|
+
static validateSession(sessionData: SessionData): Promise<boolean>;
|
|
24
|
+
}
|