@rxap/nest-auth0 10.0.1-dev.2 → 10.1.0-dev.0
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/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,16 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [10.1.0-dev.0](https://gitlab.com/rxap/packages/compare/@rxap/nest-auth0@10.0.1...@rxap/nest-auth0@10.1.0-dev.0) (2025-03-12)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- **auth0:** enhance validation schema with default values support ([10cd7ce](https://gitlab.com/rxap/packages/commit/10cd7ce818e022bc46247f761ece006257b4c29a))
|
|
11
|
+
|
|
12
|
+
## [10.0.1](https://gitlab.com/rxap/packages/compare/@rxap/nest-auth0@10.0.1-dev.2...@rxap/nest-auth0@10.0.1) (2025-02-23)
|
|
13
|
+
|
|
14
|
+
**Note:** Version bump only for package @rxap/nest-auth0
|
|
15
|
+
|
|
6
16
|
## [10.0.1-dev.2](https://gitlab.com/rxap/packages/compare/@rxap/nest-auth0@10.0.1-dev.1...@rxap/nest-auth0@10.0.1-dev.2) (2025-02-23)
|
|
7
17
|
|
|
8
18
|
**Note:** Version bump only for package @rxap/nest-auth0
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "10.0
|
|
2
|
+
"version": "10.1.0-dev.0",
|
|
3
3
|
"name": "@rxap/nest-auth0",
|
|
4
4
|
"description": "This package provides an Auth0 module for NestJS applications, simplifying integration with Auth0 for authentication and authorization. It includes a configurable module, JWT strategy, and service for interacting with the Auth0 Authentication API. The module also offers validation schemas for environment variables related to Auth0 configuration.\n",
|
|
5
5
|
"license": "GPL-3.0-or-later",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@nestjs/passport": "^11.0.5",
|
|
8
|
-
"@nx/devkit": "20.
|
|
8
|
+
"@nx/devkit": "20.5.0",
|
|
9
9
|
"auth0": "^4.18.0",
|
|
10
10
|
"passport-jwt": "^4.0.1",
|
|
11
11
|
"tslib": "^2.3.0"
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"schematics": "./generators.json",
|
|
40
40
|
"type": "commonjs",
|
|
41
41
|
"types": "./src/index.d.ts",
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "e4552670b179901abc7ce57cc3ff490ac705b867"
|
|
43
43
|
}
|
|
@@ -1,19 +1,37 @@
|
|
|
1
1
|
import { Environment } from '@rxap/nest-utilities';
|
|
2
2
|
import * as Joi from 'joi';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Auth0ValidationSchema defines the structure for environment variables
|
|
5
|
+
* used in configuring and validating Auth0 authentication.
|
|
5
6
|
*
|
|
6
|
-
*
|
|
7
|
+
* This interface specifies the required properties needed for integrating
|
|
8
|
+
* Auth0, including URLs, audience, domain, client ID, and client secret.
|
|
7
9
|
*
|
|
8
|
-
*
|
|
9
|
-
* -
|
|
10
|
-
*
|
|
11
|
-
* -
|
|
12
|
-
*
|
|
13
|
-
* -
|
|
10
|
+
* Properties:
|
|
11
|
+
* - AUTH0_ISSUER_URL: The URL representing the Auth0 issuer, typically used
|
|
12
|
+
* for validating tokens and identifying the authorization server.
|
|
13
|
+
* - AUTH0_AUDIENCE: The unique identifier representing the API audience
|
|
14
|
+
* that tokens will be issued for.
|
|
15
|
+
* - AUTH0_DOMAIN: The domain of the Auth0 tenant, used for constructing
|
|
16
|
+
* URLs and making Auth0 API calls.
|
|
17
|
+
* - AUTH0_CLIENT_ID: The client identifier for the application, provided
|
|
18
|
+
* by Auth0 during application registration.
|
|
19
|
+
* - AUTH0_CLIENT_SECRET: The secret key associated with the application,
|
|
20
|
+
* used for validating communication and securing requests.
|
|
21
|
+
*/
|
|
22
|
+
export interface Auth0ValidationSchema {
|
|
23
|
+
AUTH0_ISSUER_URL: string;
|
|
24
|
+
AUTH0_AUDIENCE: string;
|
|
25
|
+
AUTH0_DOMAIN: string;
|
|
26
|
+
AUTH0_CLIENT_ID: string;
|
|
27
|
+
AUTH0_CLIENT_SECRET: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Generates a validation schema for Auth0 configuration settings using Joi.
|
|
31
|
+
* This schema can be used to validate environment-specific variables.
|
|
14
32
|
*
|
|
15
|
-
* @
|
|
16
|
-
*
|
|
17
|
-
*
|
|
33
|
+
* @param {Environment} environment - The application's environment configuration used to determine the applicable validation schema.
|
|
34
|
+
* @param {Partial<Auth0ValidationSchema>} [defaults={}] - An optional object with default values for the schema keys.
|
|
35
|
+
* @return {Record<string, StringSchema>} The Joi validation schema object for Auth0 configuration.
|
|
18
36
|
*/
|
|
19
|
-
export declare function auth0ValidationSchema(environment: Environment): Joi.
|
|
37
|
+
export declare function auth0ValidationSchema(environment: Environment, defaults?: Partial<Auth0ValidationSchema>): Record<string, Joi.StringSchema<string>>;
|
|
@@ -3,27 +3,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.auth0ValidationSchema = auth0ValidationSchema;
|
|
4
4
|
const Joi = require("joi");
|
|
5
5
|
/**
|
|
6
|
-
* Generates a
|
|
6
|
+
* Generates a validation schema for Auth0 configuration settings using Joi.
|
|
7
|
+
* This schema can be used to validate environment-specific variables.
|
|
7
8
|
*
|
|
8
|
-
* @param environment - The environment
|
|
9
|
-
*
|
|
10
|
-
* @
|
|
11
|
-
* - `AUTH0_ISSUER_URL`: Must be a string.
|
|
12
|
-
* - `AUTH0_AUDIENCE`: Must be a string.
|
|
13
|
-
* - `AUTH0_DOMAIN`: Must be a string and a valid domain.
|
|
14
|
-
* - `AUTH0_CLIENT_ID`: Must be a string.
|
|
15
|
-
* - `AUTH0_CLIENT_SECRET`: Must be a string.
|
|
16
|
-
*
|
|
17
|
-
* @example
|
|
18
|
-
* ```typescript
|
|
19
|
-
* const schema = auth0ValidationSchema(environment);
|
|
9
|
+
* @param {Environment} environment - The application's environment configuration used to determine the applicable validation schema.
|
|
10
|
+
* @param {Partial<Auth0ValidationSchema>} [defaults={}] - An optional object with default values for the schema keys.
|
|
11
|
+
* @return {Record<string, StringSchema>} The Joi validation schema object for Auth0 configuration.
|
|
20
12
|
*/
|
|
21
|
-
function auth0ValidationSchema(environment) {
|
|
13
|
+
function auth0ValidationSchema(environment, defaults = {}) {
|
|
22
14
|
const schema = {};
|
|
23
15
|
schema['AUTH0_ISSUER_URL'] = Joi.string();
|
|
24
16
|
schema['AUTH0_AUDIENCE'] = Joi.string();
|
|
25
17
|
schema['AUTH0_DOMAIN'] = Joi.string().domain();
|
|
26
18
|
schema['AUTH0_CLIENT_ID'] = Joi.string();
|
|
27
19
|
schema['AUTH0_CLIENT_SECRET'] = Joi.string();
|
|
20
|
+
for (const [key, value] of Object.keys(defaults)) {
|
|
21
|
+
schema[key] = schema[key].default(value);
|
|
22
|
+
}
|
|
28
23
|
return schema;
|
|
29
24
|
}
|