@aifabrix/miso-client 1.0.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/LICENSE +21 -0
- package/README.md +147 -0
- package/dist/index.d.ts +111 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +199 -0
- package/dist/index.js.map +1 -0
- package/dist/services/auth.service.d.ts +33 -0
- package/dist/services/auth.service.d.ts.map +1 -0
- package/dist/services/auth.service.js +79 -0
- package/dist/services/auth.service.js.map +1 -0
- package/dist/services/logger.service.d.ts +107 -0
- package/dist/services/logger.service.d.ts.map +1 -0
- package/dist/services/logger.service.js +260 -0
- package/dist/services/logger.service.js.map +1 -0
- package/dist/services/permission.service.d.ts +37 -0
- package/dist/services/permission.service.d.ts.map +1 -0
- package/dist/services/permission.service.js +128 -0
- package/dist/services/permission.service.js.map +1 -0
- package/dist/services/redis.service.d.ts +18 -0
- package/dist/services/redis.service.d.ts.map +1 -0
- package/dist/services/redis.service.js +112 -0
- package/dist/services/redis.service.js.map +1 -0
- package/dist/services/role.service.d.ts +33 -0
- package/dist/services/role.service.d.ts.map +1 -0
- package/dist/services/role.service.js +106 -0
- package/dist/services/role.service.js.map +1 -0
- package/dist/types/config.types.d.ts +66 -0
- package/dist/types/config.types.d.ts.map +1 -0
- package/dist/types/config.types.js +6 -0
- package/dist/types/config.types.js.map +1 -0
- package/dist/utils/data-masker.d.ts +26 -0
- package/dist/utils/data-masker.d.ts.map +1 -0
- package/dist/utils/data-masker.js +121 -0
- package/dist/utils/data-masker.js.map +1 -0
- package/dist/utils/http-client.d.ts +16 -0
- package/dist/utils/http-client.d.ts.map +1 -0
- package/dist/utils/http-client.js +79 -0
- package/dist/utils/http-client.js.map +1 -0
- package/package.json +60 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 eSystems Nordic Ltd.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
# AI Fabrix Miso Client SDK
|
|
2
|
+
|
|
3
|
+
[](https://badge.fury.io/js/%40aifabrix%2Fmiso-client)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
|
|
6
|
+
The **AI Fabrix Miso Client SDK** is a TypeScript/JavaScript library that provides authentication, authorization, and logging capabilities for applications integrated with the AI Fabrix platform. It offers seamless integration with Keycloak authentication, Redis caching, and centralized logging.
|
|
7
|
+
|
|
8
|
+
## 🚀 Features
|
|
9
|
+
|
|
10
|
+
- **🔐 Authentication**: Token validation and user management
|
|
11
|
+
- **🛡️ Authorization**: Role and permission-based access control
|
|
12
|
+
- **📊 Logging**: Centralized logging with audit trails and API key authentication
|
|
13
|
+
- **⚡ Caching**: Redis-based caching for improved performance
|
|
14
|
+
- **🔄 Fallback**: Automatic fallback to controller when Redis is unavailable
|
|
15
|
+
- **🔑 API Key Security**: Secure API key authentication for application logging
|
|
16
|
+
- **📱 Multi-platform**: Works in Node.js and browser environments
|
|
17
|
+
- **🔧 TypeScript**: Full TypeScript support with type definitions
|
|
18
|
+
|
|
19
|
+
## 📚 Documentation
|
|
20
|
+
|
|
21
|
+
- **[Getting Started](docs/getting-started.md)** - Installation and basic setup
|
|
22
|
+
- **[API Reference](docs/api-reference.md)** - Complete API documentation
|
|
23
|
+
- **[Configuration](docs/configuration.md)** - Configuration options and examples
|
|
24
|
+
- **[Examples](docs/examples.md)** - Practical usage examples
|
|
25
|
+
- **[Troubleshooting](docs/troubleshooting.md)** - Common issues and solutions
|
|
26
|
+
|
|
27
|
+
## 🏃♂️ Quick Start
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npm install @aifabrix/miso-client
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
```typescript
|
|
34
|
+
import { MisoClient } from '@aifabrix/miso-client';
|
|
35
|
+
|
|
36
|
+
const client = new MisoClient({
|
|
37
|
+
controllerUrl: 'https://controller.aifabrix.ai',
|
|
38
|
+
environment: 'dev',
|
|
39
|
+
applicationKey: 'your-app-key',
|
|
40
|
+
applicationId: 'your-app-id-123', // NEW: Application GUID
|
|
41
|
+
apiKey: 'your-api-key', // NEW: API key for logging
|
|
42
|
+
redis: {
|
|
43
|
+
host: 'localhost',
|
|
44
|
+
port: 6379,
|
|
45
|
+
password: 'your-redis-password'
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
await client.initialize();
|
|
50
|
+
|
|
51
|
+
// Validate user token
|
|
52
|
+
const isValid = await client.validateToken(userToken);
|
|
53
|
+
if (isValid) {
|
|
54
|
+
const user = await client.getUser(userToken);
|
|
55
|
+
const roles = await client.getRoles(userToken);
|
|
56
|
+
|
|
57
|
+
// Check permissions
|
|
58
|
+
const canEdit = await client.hasPermission(userToken, 'edit:content');
|
|
59
|
+
|
|
60
|
+
// Log events (now with API key authentication)
|
|
61
|
+
client.log.audit('user.login', 'authentication', { userId: user.id });
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## 🏗️ Architecture
|
|
66
|
+
|
|
67
|
+
The Miso Client SDK consists of several core services:
|
|
68
|
+
|
|
69
|
+
- **AuthService**: Handles token validation and user authentication
|
|
70
|
+
- **RoleService**: Manages user roles with Redis caching
|
|
71
|
+
- **PermissionService**: Handles fine-grained permissions
|
|
72
|
+
- **LoggerService**: Centralized logging and audit trails
|
|
73
|
+
- **RedisService**: Caching and queue management
|
|
74
|
+
|
|
75
|
+
## 🔧 Configuration
|
|
76
|
+
|
|
77
|
+
The SDK supports flexible configuration options:
|
|
78
|
+
|
|
79
|
+
```typescript
|
|
80
|
+
interface MisoClientConfig {
|
|
81
|
+
controllerUrl: string; // AI Fabrix controller URL
|
|
82
|
+
environment: 'dev' | 'tst' | 'pro'; // Environment
|
|
83
|
+
applicationKey: string; // Your application identifier
|
|
84
|
+
applicationId: string; // NEW: Application GUID
|
|
85
|
+
apiKey?: string; // NEW: API key for logging authentication
|
|
86
|
+
redis?: RedisConfig; // Optional Redis configuration
|
|
87
|
+
logLevel?: 'debug' | 'info' | 'warn' | 'error';
|
|
88
|
+
cache?: {
|
|
89
|
+
roleTTL?: number; // Role cache TTL (default: 15 minutes)
|
|
90
|
+
permissionTTL?: number; // Permission cache TTL (default: 15 minutes)
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## 🌐 Environments
|
|
96
|
+
|
|
97
|
+
The SDK supports three environments:
|
|
98
|
+
|
|
99
|
+
- **`dev`** - Development environment
|
|
100
|
+
- **`tst`** - Test environment
|
|
101
|
+
- **`pro`** - Production environment
|
|
102
|
+
|
|
103
|
+
## 📦 Installation
|
|
104
|
+
|
|
105
|
+
### NPM
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
npm install @aifabrix/miso-client
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Yarn
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
yarn add @aifabrix/miso-client
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### PNPM
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
pnpm add @aifabrix/miso-client
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## 🔗 Links
|
|
124
|
+
|
|
125
|
+
- **GitHub Repository**: [https://github.com/aifabrix/aifabrix-miso](https://github.com/aifabrix/aifabrix-miso)
|
|
126
|
+
- **Documentation**: [https://docs.aifabrix.ai](https://docs.aifabrix.ai)
|
|
127
|
+
- **Issues**: [https://github.com/aifabrix/aifabrix-miso/issues](https://github.com/aifabrix/aifabrix-miso/issues)
|
|
128
|
+
|
|
129
|
+
## 📄 License
|
|
130
|
+
|
|
131
|
+
This project is licensed under the MIT License - see the [LICENSE](./LICENSE) file for details.
|
|
132
|
+
|
|
133
|
+
## 🤝 Contributing
|
|
134
|
+
|
|
135
|
+
Contributions are welcome! Please read our contributing guidelines and submit pull requests to our GitHub repository.
|
|
136
|
+
|
|
137
|
+
## 📞 Support
|
|
138
|
+
|
|
139
|
+
For support and questions:
|
|
140
|
+
|
|
141
|
+
- **Email**: <support@aifabrix.ai>
|
|
142
|
+
- **Documentation**: [https://docs.aifabrix.ai](https://docs.aifabrix.ai)
|
|
143
|
+
- **GitHub Issues**: [https://github.com/aifabrix/aifabrix-miso/issues](https://github.com/aifabrix/aifabrix-miso/issues)
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
**Made with ❤️ by the AI Fabrix Team**
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Main MisoClient SDK class
|
|
3
|
+
*/
|
|
4
|
+
import { LoggerService } from './services/logger.service';
|
|
5
|
+
import { MisoClientConfig, UserInfo } from './types/config.types';
|
|
6
|
+
export declare class MisoClient {
|
|
7
|
+
private config;
|
|
8
|
+
private redis;
|
|
9
|
+
private auth;
|
|
10
|
+
private roles;
|
|
11
|
+
private permissions;
|
|
12
|
+
private logger;
|
|
13
|
+
private initialized;
|
|
14
|
+
constructor(config: MisoClientConfig);
|
|
15
|
+
/**
|
|
16
|
+
* Initialize the client (connect to Redis if configured)
|
|
17
|
+
*/
|
|
18
|
+
initialize(): Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* Disconnect from Redis
|
|
21
|
+
*/
|
|
22
|
+
disconnect(): Promise<void>;
|
|
23
|
+
/**
|
|
24
|
+
* Check if client is initialized
|
|
25
|
+
*/
|
|
26
|
+
isInitialized(): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Initiate login flow by redirecting to controller
|
|
29
|
+
* Returns the login URL for browser redirect or manual navigation
|
|
30
|
+
*/
|
|
31
|
+
login(redirectUri: string): string;
|
|
32
|
+
/**
|
|
33
|
+
* Validate token with controller
|
|
34
|
+
*/
|
|
35
|
+
validateToken(token: string): Promise<boolean>;
|
|
36
|
+
/**
|
|
37
|
+
* Get user information from token
|
|
38
|
+
*/
|
|
39
|
+
getUser(token: string): Promise<UserInfo | null>;
|
|
40
|
+
/**
|
|
41
|
+
* Check if user is authenticated
|
|
42
|
+
*/
|
|
43
|
+
isAuthenticated(token: string): Promise<boolean>;
|
|
44
|
+
/**
|
|
45
|
+
* Logout user
|
|
46
|
+
*/
|
|
47
|
+
logout(): Promise<void>;
|
|
48
|
+
/**
|
|
49
|
+
* Get user roles (cached in Redis if available)
|
|
50
|
+
*/
|
|
51
|
+
getRoles(token: string): Promise<string[]>;
|
|
52
|
+
/**
|
|
53
|
+
* Check if user has specific role
|
|
54
|
+
*/
|
|
55
|
+
hasRole(token: string, role: string): Promise<boolean>;
|
|
56
|
+
/**
|
|
57
|
+
* Check if user has any of the specified roles
|
|
58
|
+
*/
|
|
59
|
+
hasAnyRole(token: string, roles: string[]): Promise<boolean>;
|
|
60
|
+
/**
|
|
61
|
+
* Check if user has all of the specified roles
|
|
62
|
+
*/
|
|
63
|
+
hasAllRoles(token: string, roles: string[]): Promise<boolean>;
|
|
64
|
+
/**
|
|
65
|
+
* Force refresh roles from controller (bypass cache)
|
|
66
|
+
*/
|
|
67
|
+
refreshRoles(token: string): Promise<string[]>;
|
|
68
|
+
/**
|
|
69
|
+
* Get user permissions (cached in Redis if available)
|
|
70
|
+
*/
|
|
71
|
+
getPermissions(token: string): Promise<string[]>;
|
|
72
|
+
/**
|
|
73
|
+
* Check if user has specific permission
|
|
74
|
+
*/
|
|
75
|
+
hasPermission(token: string, permission: string): Promise<boolean>;
|
|
76
|
+
/**
|
|
77
|
+
* Check if user has any of the specified permissions
|
|
78
|
+
*/
|
|
79
|
+
hasAnyPermission(token: string, permissions: string[]): Promise<boolean>;
|
|
80
|
+
/**
|
|
81
|
+
* Check if user has all of the specified permissions
|
|
82
|
+
*/
|
|
83
|
+
hasAllPermissions(token: string, permissions: string[]): Promise<boolean>;
|
|
84
|
+
/**
|
|
85
|
+
* Force refresh permissions from controller (bypass cache)
|
|
86
|
+
*/
|
|
87
|
+
refreshPermissions(token: string): Promise<string[]>;
|
|
88
|
+
/**
|
|
89
|
+
* Clear cached permissions for a user
|
|
90
|
+
*/
|
|
91
|
+
clearPermissionsCache(token: string): Promise<void>;
|
|
92
|
+
/**
|
|
93
|
+
* Get logger service for application logging
|
|
94
|
+
*/
|
|
95
|
+
get log(): LoggerService;
|
|
96
|
+
/**
|
|
97
|
+
* Get current configuration
|
|
98
|
+
*/
|
|
99
|
+
getConfig(): MisoClientConfig;
|
|
100
|
+
/**
|
|
101
|
+
* Check if Redis is connected
|
|
102
|
+
*/
|
|
103
|
+
isRedisConnected(): boolean;
|
|
104
|
+
}
|
|
105
|
+
export * from './types/config.types';
|
|
106
|
+
export { AuthService } from './services/auth.service';
|
|
107
|
+
export { RoleService } from './services/role.service';
|
|
108
|
+
export { LoggerService } from './services/logger.service';
|
|
109
|
+
export { RedisService } from './services/redis.service';
|
|
110
|
+
export { HttpClient } from './utils/http-client';
|
|
111
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE1D,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAElE,qBAAa,UAAU;IACrB,OAAO,CAAC,MAAM,CAAmB;IACjC,OAAO,CAAC,KAAK,CAAe;IAC5B,OAAO,CAAC,IAAI,CAAc;IAC1B,OAAO,CAAC,KAAK,CAAc;IAC3B,OAAO,CAAC,WAAW,CAAoB;IACvC,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,WAAW,CAAS;gBAEhB,MAAM,EAAE,gBAAgB;IASpC;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAcjC;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAKjC;;OAEG;IACH,aAAa,IAAI,OAAO;IAMxB;;;OAGG;IACH,KAAK,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM;IAIlC;;OAEG;IACG,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAIpD;;OAEG;IACG,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;IAItD;;OAEG;IACG,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAItD;;OAEG;IACG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAM7B;;OAEG;IACG,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,M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AE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Main MisoClient SDK class
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
17
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.HttpClient = exports.RedisService = exports.LoggerService = exports.RoleService = exports.AuthService = exports.MisoClient = void 0;
|
|
21
|
+
const auth_service_1 = require("./services/auth.service");
|
|
22
|
+
const role_service_1 = require("./services/role.service");
|
|
23
|
+
const permission_service_1 = require("./services/permission.service");
|
|
24
|
+
const logger_service_1 = require("./services/logger.service");
|
|
25
|
+
const redis_service_1 = require("./services/redis.service");
|
|
26
|
+
class MisoClient {
|
|
27
|
+
constructor(config) {
|
|
28
|
+
this.initialized = false;
|
|
29
|
+
this.config = config;
|
|
30
|
+
this.redis = new redis_service_1.RedisService(config.redis);
|
|
31
|
+
this.auth = new auth_service_1.AuthService(config, this.redis);
|
|
32
|
+
this.roles = new role_service_1.RoleService(config, this.redis);
|
|
33
|
+
this.permissions = new permission_service_1.PermissionService(config, this.redis);
|
|
34
|
+
this.logger = new logger_service_1.LoggerService(config, this.redis);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Initialize the client (connect to Redis if configured)
|
|
38
|
+
*/
|
|
39
|
+
async initialize() {
|
|
40
|
+
if (this.initialized) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
try {
|
|
44
|
+
await this.redis.connect();
|
|
45
|
+
this.initialized = true;
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
// Redis connection failed, continue with controller fallback mode
|
|
49
|
+
this.initialized = true; // Still mark as initialized for fallback mode
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Disconnect from Redis
|
|
54
|
+
*/
|
|
55
|
+
async disconnect() {
|
|
56
|
+
await this.redis.disconnect();
|
|
57
|
+
this.initialized = false;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Check if client is initialized
|
|
61
|
+
*/
|
|
62
|
+
isInitialized() {
|
|
63
|
+
return this.initialized;
|
|
64
|
+
}
|
|
65
|
+
// ==================== AUTHENTICATION METHODS ====================
|
|
66
|
+
/**
|
|
67
|
+
* Initiate login flow by redirecting to controller
|
|
68
|
+
* Returns the login URL for browser redirect or manual navigation
|
|
69
|
+
*/
|
|
70
|
+
login(redirectUri) {
|
|
71
|
+
return this.auth.login(redirectUri);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Validate token with controller
|
|
75
|
+
*/
|
|
76
|
+
async validateToken(token) {
|
|
77
|
+
return this.auth.validateToken(token);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Get user information from token
|
|
81
|
+
*/
|
|
82
|
+
async getUser(token) {
|
|
83
|
+
return this.auth.getUser(token);
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Check if user is authenticated
|
|
87
|
+
*/
|
|
88
|
+
async isAuthenticated(token) {
|
|
89
|
+
return this.auth.isAuthenticated(token);
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Logout user
|
|
93
|
+
*/
|
|
94
|
+
async logout() {
|
|
95
|
+
return this.auth.logout();
|
|
96
|
+
}
|
|
97
|
+
// ==================== AUTHORIZATION METHODS ====================
|
|
98
|
+
/**
|
|
99
|
+
* Get user roles (cached in Redis if available)
|
|
100
|
+
*/
|
|
101
|
+
async getRoles(token) {
|
|
102
|
+
return this.roles.getRoles(token);
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Check if user has specific role
|
|
106
|
+
*/
|
|
107
|
+
async hasRole(token, role) {
|
|
108
|
+
return this.roles.hasRole(token, role);
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Check if user has any of the specified roles
|
|
112
|
+
*/
|
|
113
|
+
async hasAnyRole(token, roles) {
|
|
114
|
+
return this.roles.hasAnyRole(token, roles);
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Check if user has all of the specified roles
|
|
118
|
+
*/
|
|
119
|
+
async hasAllRoles(token, roles) {
|
|
120
|
+
return this.roles.hasAllRoles(token, roles);
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Force refresh roles from controller (bypass cache)
|
|
124
|
+
*/
|
|
125
|
+
async refreshRoles(token) {
|
|
126
|
+
return this.roles.refreshRoles(token);
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Get user permissions (cached in Redis if available)
|
|
130
|
+
*/
|
|
131
|
+
async getPermissions(token) {
|
|
132
|
+
return this.permissions.getPermissions(token);
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Check if user has specific permission
|
|
136
|
+
*/
|
|
137
|
+
async hasPermission(token, permission) {
|
|
138
|
+
return this.permissions.hasPermission(token, permission);
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Check if user has any of the specified permissions
|
|
142
|
+
*/
|
|
143
|
+
async hasAnyPermission(token, permissions) {
|
|
144
|
+
return this.permissions.hasAnyPermission(token, permissions);
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Check if user has all of the specified permissions
|
|
148
|
+
*/
|
|
149
|
+
async hasAllPermissions(token, permissions) {
|
|
150
|
+
return this.permissions.hasAllPermissions(token, permissions);
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Force refresh permissions from controller (bypass cache)
|
|
154
|
+
*/
|
|
155
|
+
async refreshPermissions(token) {
|
|
156
|
+
return this.permissions.refreshPermissions(token);
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Clear cached permissions for a user
|
|
160
|
+
*/
|
|
161
|
+
async clearPermissionsCache(token) {
|
|
162
|
+
return this.permissions.clearPermissionsCache(token);
|
|
163
|
+
}
|
|
164
|
+
// ==================== LOGGING METHODS ====================
|
|
165
|
+
/**
|
|
166
|
+
* Get logger service for application logging
|
|
167
|
+
*/
|
|
168
|
+
get log() {
|
|
169
|
+
return this.logger;
|
|
170
|
+
}
|
|
171
|
+
// ==================== UTILITY METHODS ====================
|
|
172
|
+
/**
|
|
173
|
+
* Get current configuration
|
|
174
|
+
*/
|
|
175
|
+
getConfig() {
|
|
176
|
+
return { ...this.config };
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Check if Redis is connected
|
|
180
|
+
*/
|
|
181
|
+
isRedisConnected() {
|
|
182
|
+
return this.redis.isConnected();
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
exports.MisoClient = MisoClient;
|
|
186
|
+
// Export types
|
|
187
|
+
__exportStar(require("./types/config.types"), exports);
|
|
188
|
+
// Export services for advanced usage
|
|
189
|
+
var auth_service_2 = require("./services/auth.service");
|
|
190
|
+
Object.defineProperty(exports, "AuthService", { enumerable: true, get: function () { return auth_service_2.AuthService; } });
|
|
191
|
+
var role_service_2 = require("./services/role.service");
|
|
192
|
+
Object.defineProperty(exports, "RoleService", { enumerable: true, get: function () { return role_service_2.RoleService; } });
|
|
193
|
+
var logger_service_2 = require("./services/logger.service");
|
|
194
|
+
Object.defineProperty(exports, "LoggerService", { enumerable: true, get: function () { return logger_service_2.LoggerService; } });
|
|
195
|
+
var redis_service_2 = require("./services/redis.service");
|
|
196
|
+
Object.defineProperty(exports, "RedisService", { enumerable: true, get: function () { return redis_service_2.RedisService; } });
|
|
197
|
+
var http_client_1 = require("./utils/http-client");
|
|
198
|
+
Object.defineProperty(exports, "HttpClient", { enumerable: true, get: function () { return http_client_1.HttpClient; } });
|
|
199
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;;AAEH,0DAAsD;AACtD,0DAAsD;AACtD,sEAAkE;AAClE,8DAA0D;AAC1D,4DAAwD;AAGxD,MAAa,UAAU;IASrB,YAAY,MAAwB;QAF5B,gBAAW,GAAG,KAAK,CAAC;QAG1B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,KAAK,GAAG,IAAI,4BAAY,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC5C,IAAI,CAAC,IAAI,GAAG,IAAI,0BAAW,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QAChD,IAAI,CAAC,KAAK,GAAG,IAAI,0BAAW,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QACjD,IAAI,CAAC,WAAW,GAAG,IAAI,sCAAiB,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QAC7D,IAAI,CAAC,MAAM,GAAG,IAAI,8BAAa,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,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K,EAAE,WAAW,CAAC,CAAC;IAChE,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,kBAAkB,CAAC,KAAa;QACpC,OAAO,IAAI,CAAC,WAAW,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;IACpD,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,qBAAqB,CAAC,KAAa;QACvC,OAAO,IAAI,CAAC,WAAW,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC;IACvD,CAAC;IAED,4DAA4D;IAE5D;;OAEG;IACH,IAAI,GAAG;QACL,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,4DAA4D;IAE5D;;OAEG;IACH,SAAS;QACP,OAAO,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;IAC5B,CAAC;IAED;;OAEG;IACH,gBAAgB;QACd,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;IAClC,CAAC;CACF;AA/LD,gCA+LC;AAED,eAAe;AACf,uDAAqC;AAErC,qCAAqC;AACrC,wDAAsD;AAA7C,2GAAA,WAAW,OAAA;AACpB,wDAAsD;AAA7C,2GAAA,WAAW,OAAA;AACpB,4DAA0D;AAAjD,+GAAA,aAAa,OAAA;AACtB,0DAAwD;AAA/C,6GAAA,YAAY,OAAA;AACrB,mDAAiD;AAAxC,yGAAA,UAAU,OAAA"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Authentication service for token validation and user management
|
|
3
|
+
*/
|
|
4
|
+
import { RedisService } from './redis.service';
|
|
5
|
+
import { MisoClientConfig, UserInfo } from '../types/config.types';
|
|
6
|
+
export declare class AuthService {
|
|
7
|
+
private httpClient;
|
|
8
|
+
private redis;
|
|
9
|
+
private config;
|
|
10
|
+
constructor(config: MisoClientConfig, redis: RedisService);
|
|
11
|
+
/**
|
|
12
|
+
* Initiate login flow by redirecting to controller
|
|
13
|
+
* Returns the login URL for browser redirect or manual navigation
|
|
14
|
+
*/
|
|
15
|
+
login(redirectUri: string): string;
|
|
16
|
+
/**
|
|
17
|
+
* Validate token with controller
|
|
18
|
+
*/
|
|
19
|
+
validateToken(token: string): Promise<boolean>;
|
|
20
|
+
/**
|
|
21
|
+
* Get user information from token
|
|
22
|
+
*/
|
|
23
|
+
getUser(token: string): Promise<UserInfo | null>;
|
|
24
|
+
/**
|
|
25
|
+
* Logout user
|
|
26
|
+
*/
|
|
27
|
+
logout(): Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* Check if user is authenticated (has valid token)
|
|
30
|
+
*/
|
|
31
|
+
isAuthenticated(token: string): Promise<boolean>;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=auth.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.service.d.ts","sourceRoot":"","sources":["../../src/services/auth.service.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAc,MAAM,uBAAuB,CAAC;AAE/E,qBAAa,WAAW;IACtB,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,KAAK,CAAe;IAC5B,OAAO,CAAC,MAAM,CAAmB;gBAErB,MAAM,EAAE,gBAAgB,EAAE,KAAK,EAAE,YAAY;IAMzD;;;OAGG;IACH,KAAK,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM;IAYlC;;OAEG;IACG,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAepD;;OAEG;IACG,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC;IAmBtD;;OAEG;IACG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAc7B;;OAEG;IACG,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAGvD"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Authentication service for token validation and user management
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.AuthService = void 0;
|
|
7
|
+
const http_client_1 = require("../utils/http-client");
|
|
8
|
+
class AuthService {
|
|
9
|
+
constructor(config, redis) {
|
|
10
|
+
this.config = config;
|
|
11
|
+
this.redis = redis;
|
|
12
|
+
this.httpClient = new http_client_1.HttpClient(config);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Initiate login flow by redirecting to controller
|
|
16
|
+
* Returns the login URL for browser redirect or manual navigation
|
|
17
|
+
*/
|
|
18
|
+
login(redirectUri) {
|
|
19
|
+
const loginUrl = `${this.config.controllerUrl}/auth/login?` +
|
|
20
|
+
`environment=${this.config.environment}&` +
|
|
21
|
+
`application=${this.config.applicationKey}&` +
|
|
22
|
+
`redirect=${encodeURIComponent(redirectUri)}`;
|
|
23
|
+
// In a browser environment, application should redirect to this URL
|
|
24
|
+
// In Node.js, application should handle URL appropriately
|
|
25
|
+
return loginUrl;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Validate token with controller
|
|
29
|
+
*/
|
|
30
|
+
async validateToken(token) {
|
|
31
|
+
try {
|
|
32
|
+
const result = await this.httpClient.authenticatedRequest('POST', '/auth/validate', token);
|
|
33
|
+
return result.authenticated;
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
// Token validation failed, return false
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Get user information from token
|
|
42
|
+
*/
|
|
43
|
+
async getUser(token) {
|
|
44
|
+
try {
|
|
45
|
+
const result = await this.httpClient.authenticatedRequest('POST', '/auth/validate', token);
|
|
46
|
+
if (result.authenticated && result.user) {
|
|
47
|
+
return result.user;
|
|
48
|
+
}
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
// Failed to get user info, return null
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Logout user
|
|
58
|
+
*/
|
|
59
|
+
async logout() {
|
|
60
|
+
try {
|
|
61
|
+
await this.httpClient.post('/auth/logout', {
|
|
62
|
+
environment: this.config.environment,
|
|
63
|
+
application: this.config.applicationKey
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
// Logout failed, re-throw error for application to handle
|
|
68
|
+
throw new Error('Logout failed: ' + (error instanceof Error ? error.message : 'Unknown error'));
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Check if user is authenticated (has valid token)
|
|
73
|
+
*/
|
|
74
|
+
async isAuthenticated(token) {
|
|
75
|
+
return this.validateToken(token);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
exports.AuthService = AuthService;
|
|
79
|
+
//# sourceMappingURL=auth.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.service.js","sourceRoot":"","sources":["../../src/services/auth.service.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,sDAAkD;AAIlD,MAAa,WAAW;IAKtB,YAAY,MAAwB,EAAE,KAAmB;QACvD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,UAAU,GAAG,IAAI,wBAAU,CAAC,MAAM,CAAC,CAAC;IAC3C,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,WAAmB;QACvB,MAAM,QAAQ,GACZ,GAAG,IAAI,CAAC,MAAM,CAAC,aAAa,cAAc;YAC1C,eAAe,IAAI,CAAC,MAAM,CAAC,WAAW,GAAG;YACzC,eAAe,IAAI,CAAC,MAAM,CAAC,cAAc,GAAG;YAC5C,YAAY,kBAAkB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