miso-client 0.2.0__tar.gz → 0.5.0__tar.gz
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.
Potentially problematic release.
This version of miso-client might be problematic. Click here for more details.
- miso_client-0.5.0/CHANGELOG.md +438 -0
- {miso_client-0.2.0/miso_client.egg-info → miso_client-0.5.0}/PKG-INFO +348 -3
- {miso_client-0.2.0 → miso_client-0.5.0}/README.md +347 -2
- {miso_client-0.2.0 → miso_client-0.5.0}/miso_client/__init__.py +59 -3
- {miso_client-0.2.0 → miso_client-0.5.0}/miso_client/errors.py +22 -1
- miso_client-0.5.0/miso_client/models/__init__.py +5 -0
- miso_client-0.5.0/miso_client/models/error_response.py +50 -0
- miso_client-0.5.0/miso_client/models/filter.py +140 -0
- miso_client-0.5.0/miso_client/models/pagination.py +66 -0
- miso_client-0.5.0/miso_client/models/sort.py +25 -0
- {miso_client-0.2.0 → miso_client-0.5.0}/miso_client/services/logger.py +7 -6
- {miso_client-0.2.0 → miso_client-0.5.0}/miso_client/utils/data_masker.py +77 -5
- miso_client-0.5.0/miso_client/utils/error_utils.py +104 -0
- miso_client-0.5.0/miso_client/utils/filter.py +256 -0
- miso_client-0.5.0/miso_client/utils/http_client.py +692 -0
- miso_client-0.2.0/miso_client/utils/http_client.py → miso_client-0.5.0/miso_client/utils/internal_http_client.py +103 -19
- miso_client-0.5.0/miso_client/utils/pagination.py +157 -0
- miso_client-0.5.0/miso_client/utils/sensitive_fields_loader.py +116 -0
- miso_client-0.5.0/miso_client/utils/sort.py +116 -0
- {miso_client-0.2.0 → miso_client-0.5.0/miso_client.egg-info}/PKG-INFO +348 -3
- {miso_client-0.2.0 → miso_client-0.5.0}/miso_client.egg-info/SOURCES.txt +11 -1
- {miso_client-0.2.0 → miso_client-0.5.0}/pyproject.toml +1 -1
- {miso_client-0.2.0 → miso_client-0.5.0}/setup.py +1 -1
- miso_client-0.2.0/CHANGELOG.md +0 -237
- miso_client-0.2.0/miso_client/models/__init__.py +0 -1
- {miso_client-0.2.0 → miso_client-0.5.0}/LICENSE +0 -0
- {miso_client-0.2.0 → miso_client-0.5.0}/MANIFEST.in +0 -0
- {miso_client-0.2.0 → miso_client-0.5.0}/miso_client/models/config.py +0 -0
- {miso_client-0.2.0 → miso_client-0.5.0}/miso_client/py.typed +0 -0
- {miso_client-0.2.0 → miso_client-0.5.0}/miso_client/services/__init__.py +0 -0
- {miso_client-0.2.0 → miso_client-0.5.0}/miso_client/services/auth.py +0 -0
- {miso_client-0.2.0 → miso_client-0.5.0}/miso_client/services/cache.py +0 -0
- {miso_client-0.2.0 → miso_client-0.5.0}/miso_client/services/encryption.py +0 -0
- {miso_client-0.2.0 → miso_client-0.5.0}/miso_client/services/permission.py +0 -0
- {miso_client-0.2.0 → miso_client-0.5.0}/miso_client/services/redis.py +0 -0
- {miso_client-0.2.0 → miso_client-0.5.0}/miso_client/services/role.py +0 -0
- {miso_client-0.2.0 → miso_client-0.5.0}/miso_client/utils/__init__.py +0 -0
- {miso_client-0.2.0 → miso_client-0.5.0}/miso_client/utils/config_loader.py +0 -0
- {miso_client-0.2.0 → miso_client-0.5.0}/miso_client/utils/jwt_tools.py +0 -0
- {miso_client-0.2.0 → miso_client-0.5.0}/miso_client.egg-info/dependency_links.txt +0 -0
- {miso_client-0.2.0 → miso_client-0.5.0}/miso_client.egg-info/not-zip-safe +0 -0
- {miso_client-0.2.0 → miso_client-0.5.0}/miso_client.egg-info/requires.txt +0 -0
- {miso_client-0.2.0 → miso_client-0.5.0}/miso_client.egg-info/top_level.txt +0 -0
- {miso_client-0.2.0 → miso_client-0.5.0}/pytest.ini +0 -0
- {miso_client-0.2.0 → miso_client-0.5.0}/requirements-test.txt +0 -0
- {miso_client-0.2.0 → miso_client-0.5.0}/requirements.txt +0 -0
- {miso_client-0.2.0 → miso_client-0.5.0}/setup.cfg +0 -0
|
@@ -0,0 +1,438 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to the MisoClient SDK will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.5.0] - 2025-11-02
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **Pagination Utilities**: Complete pagination support for list responses
|
|
13
|
+
- `Meta` and `PaginatedListResponse` Pydantic models for standardized paginated responses
|
|
14
|
+
- `parse_pagination_params()` function to parse `page` and `page_size` query parameters
|
|
15
|
+
- `create_meta_object()` function to construct pagination metadata objects
|
|
16
|
+
- `apply_pagination_to_array()` function for local pagination in tests/mocks
|
|
17
|
+
- `create_paginated_list_response()` function to wrap data with pagination metadata
|
|
18
|
+
- Support for both snake_case (`total_items`, `current_page`, `page_size`) and camelCase (`totalItems`, `currentPage`, `pageSize`) attribute access
|
|
19
|
+
- Full type safety with Pydantic models and generic type support
|
|
20
|
+
|
|
21
|
+
- **Filtering Utilities**: Comprehensive filtering support for API queries
|
|
22
|
+
- `FilterOption`, `FilterQuery`, and `FilterBuilder` classes for building filter queries
|
|
23
|
+
- `FilterOperator` type supporting: `eq`, `neq`, `in`, `nin`, `gt`, `lt`, `gte`, `lte`, `contains`, `like`
|
|
24
|
+
- `parse_filter_params()` function to parse `filter=field:op:value` query parameters
|
|
25
|
+
- `build_query_string()` function to convert `FilterQuery` objects to URL query strings
|
|
26
|
+
- `apply_filters()` function for local filtering in tests/mocks
|
|
27
|
+
- `FilterBuilder` class with fluent API for method chaining (e.g., `FilterBuilder().add('status', 'eq', 'active').add('region', 'in', ['eu', 'us'])`)
|
|
28
|
+
- URL encoding support for field names and values (comma separators preserved for array values)
|
|
29
|
+
- Integration with `/metadata/filter` endpoint through `FilterBuilder` compatibility with `AccessFieldFilter`
|
|
30
|
+
|
|
31
|
+
- **Sorting Utilities**: Sort parameter parsing and building
|
|
32
|
+
- `SortOption` Pydantic model with `field` and `order` (asc/desc) properties
|
|
33
|
+
- `parse_sort_params()` function to parse `sort=-field` query parameters
|
|
34
|
+
- `build_sort_string()` function to convert `SortOption` lists to query string format
|
|
35
|
+
- Support for multiple sort fields with ascending/descending order
|
|
36
|
+
- URL encoding for field names with special characters
|
|
37
|
+
|
|
38
|
+
- **Error Handling Utilities**: Enhanced error response transformation and handling
|
|
39
|
+
- `transform_error_to_snake_case()` function for converting error dictionaries to `ErrorResponse` objects
|
|
40
|
+
- `handle_api_error_snake_case()` function for creating `MisoClientError` from API error responses
|
|
41
|
+
- Support for both camelCase and snake_case field names in error responses
|
|
42
|
+
- Automatic parameter overriding (instance and status_code parameters override response data)
|
|
43
|
+
- Graceful handling of missing optional fields (title, instance, request_key)
|
|
44
|
+
|
|
45
|
+
- **HTTP Client Enhancements**: New helper methods for filtered and paginated requests
|
|
46
|
+
- `get_with_filters()` method for making GET requests with `FilterBuilder` support
|
|
47
|
+
- `get_paginated()` method for making GET requests with pagination parameters
|
|
48
|
+
- Automatic query string building from filter/sort/pagination options
|
|
49
|
+
- Flexible response parsing (returns `PaginatedListResponse` when format matches, raw response otherwise)
|
|
50
|
+
|
|
51
|
+
- **ErrorResponse Model Enhancements**:
|
|
52
|
+
- Added `request_key` field for error tracking (supports both `request_key` and `requestKey` aliases)
|
|
53
|
+
- Made `title` field optional (defaults to `None`) for graceful handling of missing titles
|
|
54
|
+
- Added `status_code` property getter for snake_case access (complements `statusCode` camelCase field)
|
|
55
|
+
- Full support for both snake_case and camelCase attribute access
|
|
56
|
+
|
|
57
|
+
- **Model Exports**: All new models and utilities exported from main module
|
|
58
|
+
- Pagination: `Meta`, `PaginatedListResponse`, `parse_pagination_params`, `create_meta_object`, `apply_pagination_to_array`, `create_paginated_list_response`
|
|
59
|
+
- Filtering: `FilterOperator`, `FilterOption`, `FilterQuery`, `FilterBuilder`, `parse_filter_params`, `build_query_string`, `apply_filters`
|
|
60
|
+
- Sorting: `SortOption`, `parse_sort_params`, `build_sort_string`
|
|
61
|
+
- Error: `transform_error_to_snake_case`, `handle_api_error_snake_case`
|
|
62
|
+
- All utilities follow snake_case naming convention matching Miso/Dataplane API conventions
|
|
63
|
+
|
|
64
|
+
### Changed
|
|
65
|
+
|
|
66
|
+
- **ErrorResponse Model**: Made `title` field optional to support APIs that don't provide titles
|
|
67
|
+
- Old: `title: str = Field(..., description="Human-readable error title")`
|
|
68
|
+
- New: `title: Optional[str] = Field(default=None, description="Human-readable error title")`
|
|
69
|
+
- Backward compatible - existing code with required titles still works
|
|
70
|
+
|
|
71
|
+
- **handle_api_error_snake_case Function**: Enhanced parameter override behavior
|
|
72
|
+
- `instance` parameter now overrides instance in response_data (was only set if missing)
|
|
73
|
+
- `status_code` parameter now always overrides status_code in response_data (was only set if missing)
|
|
74
|
+
- Better error message generation when title is missing
|
|
75
|
+
|
|
76
|
+
### Technical Improvements
|
|
77
|
+
|
|
78
|
+
- **Type Safety**: Full type hints throughout all new utilities and models
|
|
79
|
+
- **Pydantic Models**: All new data structures use Pydantic for validation and serialization
|
|
80
|
+
- **Property Getters**: Added property getters to support both snake_case and camelCase attribute access in models
|
|
81
|
+
- **URL Encoding**: Smart encoding that preserves comma delimiters in array filter values
|
|
82
|
+
- **Comprehensive Tests**: 123 unit tests covering all utilities with 100% coverage for models and utilities
|
|
83
|
+
- **Documentation**: Complete README documentation with usage examples for all utilities
|
|
84
|
+
- **Snake_case Convention**: All utilities follow Python snake_case naming to match Miso/Dataplane API conventions
|
|
85
|
+
|
|
86
|
+
### Documentation
|
|
87
|
+
|
|
88
|
+
- Added comprehensive README section for pagination, filtering, and sorting utilities
|
|
89
|
+
- Usage examples for all utilities including combined usage patterns
|
|
90
|
+
- Integration examples with `/metadata/filter` endpoint
|
|
91
|
+
- Type hints and docstrings for all public APIs
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## [0.4.0] - 2025-11-02
|
|
96
|
+
|
|
97
|
+
### Added
|
|
98
|
+
|
|
99
|
+
- **ISO 27001 Compliant HTTP Client with Automatic Audit and Debug Logging**: New public `HttpClient` class that wraps `InternalHttpClient` with automatic ISO 27001 compliant audit and debug logging
|
|
100
|
+
- Automatic audit logging for all HTTP requests (`http.request.{METHOD}` format)
|
|
101
|
+
- Debug logging when `log_level === 'debug'` with detailed request/response information
|
|
102
|
+
- Automatic data masking using `DataMasker` before logging (ISO 27001 compliant)
|
|
103
|
+
- All request headers are masked (Authorization, x-client-token, Cookie, etc.)
|
|
104
|
+
- All request bodies are recursively masked for sensitive fields (password, token, secret, SSN, etc.)
|
|
105
|
+
- All response bodies are masked (limited to first 1000 characters)
|
|
106
|
+
- Query parameters are automatically masked
|
|
107
|
+
- Error messages are masked if they contain sensitive data
|
|
108
|
+
- Sensitive endpoints (`/api/logs`, `/api/auth/token`) are excluded from audit logging to prevent infinite loops
|
|
109
|
+
- JWT user ID extraction from Authorization headers for audit context
|
|
110
|
+
- Request duration tracking for performance monitoring
|
|
111
|
+
- Request/response size tracking for observability
|
|
112
|
+
|
|
113
|
+
- **JSON Configuration Support for DataMasker**: Enhanced `DataMasker` with JSON configuration file support for sensitive fields
|
|
114
|
+
- New `sensitive_fields_config.json` file with default ISO 27001 compliant sensitive fields
|
|
115
|
+
- Categories: authentication, pii, security
|
|
116
|
+
- Support for custom configuration path via `MISO_SENSITIVE_FIELDS_CONFIG` environment variable
|
|
117
|
+
- `DataMasker.set_config_path()` method for programmatic configuration
|
|
118
|
+
- Automatic merging of JSON fields with hardcoded defaults (fallback if JSON cannot be loaded)
|
|
119
|
+
- Backward compatible - existing hardcoded fields still work as fallback
|
|
120
|
+
|
|
121
|
+
- **New InternalHttpClient Class**: Separated core HTTP functionality into `InternalHttpClient` class
|
|
122
|
+
- Pure HTTP functionality with automatic client token management (no logging)
|
|
123
|
+
- Used internally by public `HttpClient` for actual HTTP requests
|
|
124
|
+
- Used by `LoggerService` for sending logs to prevent circular dependencies
|
|
125
|
+
- Not exported in public API (internal use only)
|
|
126
|
+
|
|
127
|
+
- **New sensitive_fields_loader Module**: Utility module for loading and merging sensitive fields configuration
|
|
128
|
+
- `load_sensitive_fields_config()` function for loading JSON configuration
|
|
129
|
+
- `get_sensitive_fields_array()` function for flattened sensitive fields list
|
|
130
|
+
- `get_field_patterns()` function for pattern matching rules
|
|
131
|
+
- Support for custom configuration paths via environment variables
|
|
132
|
+
|
|
133
|
+
### Changed
|
|
134
|
+
|
|
135
|
+
- **Breaking Change: HttpClient Constructor**: Public `HttpClient` constructor now requires `logger` parameter
|
|
136
|
+
- Old: `HttpClient(config)`
|
|
137
|
+
- New: `HttpClient(config, logger)`
|
|
138
|
+
- This is handled automatically when using `MisoClient` - no changes needed for typical usage
|
|
139
|
+
- Only affects code that directly instantiates `HttpClient`
|
|
140
|
+
|
|
141
|
+
- **Breaking Change: LoggerService Constructor**: `LoggerService` constructor now uses `InternalHttpClient` instead of `HttpClient`
|
|
142
|
+
- Old: `LoggerService(http_client: HttpClient, redis: RedisService)`
|
|
143
|
+
- New: `LoggerService(internal_http_client: InternalHttpClient, redis: RedisService)`
|
|
144
|
+
- This is handled automatically when using `MisoClient` - no changes needed for typical usage
|
|
145
|
+
- Prevents circular dependency (LoggerService uses InternalHttpClient for log sending)
|
|
146
|
+
|
|
147
|
+
- **MisoClient Architecture**: Updated `MisoClient` constructor to use new HttpClient architecture
|
|
148
|
+
- Creates `InternalHttpClient` first (pure HTTP functionality)
|
|
149
|
+
- Creates `LoggerService` with `InternalHttpClient` (prevents circular dependency)
|
|
150
|
+
- Creates public `HttpClient` wrapping `InternalHttpClient` with logger (adds audit/debug logging)
|
|
151
|
+
- All services now use public `HttpClient` with automatic audit logging
|
|
152
|
+
|
|
153
|
+
- **DataMasker Enhancement**: Updated `DataMasker` to load sensitive fields from JSON configuration
|
|
154
|
+
- Maintains backward compatibility with hardcoded fields as fallback
|
|
155
|
+
- Automatic loading on first use with caching
|
|
156
|
+
- Support for custom configuration paths
|
|
157
|
+
|
|
158
|
+
### ISO 27001 Compliance Features
|
|
159
|
+
|
|
160
|
+
- **Automatic Data Masking**: All sensitive data is automatically masked before logging
|
|
161
|
+
- Request headers: Authorization, x-client-token, Cookie, Set-Cookie, and any header containing sensitive keywords
|
|
162
|
+
- Request bodies: Recursively masks password, token, secret, SSN, creditcard, CVV, PIN, OTP, API keys, etc.
|
|
163
|
+
- Response bodies: Especially important for error responses that might contain sensitive data
|
|
164
|
+
- Query parameters: Automatically extracted and masked
|
|
165
|
+
- Error messages: Masked if containing sensitive data
|
|
166
|
+
|
|
167
|
+
- **Audit Log Structure**: Standardized audit log format for all HTTP requests
|
|
168
|
+
- Action: `http.request.{METHOD}` (e.g., `http.request.GET`, `http.request.POST`)
|
|
169
|
+
- Resource: Request URL path
|
|
170
|
+
- Context: method, url, statusCode, duration, userId, requestSize, responseSize, error (all sensitive data masked)
|
|
171
|
+
|
|
172
|
+
- **Debug Log Structure**: Detailed debug logging when `log_level === 'debug'`
|
|
173
|
+
- All audit context fields plus: requestHeaders, responseHeaders, requestBody, responseBody (all masked)
|
|
174
|
+
- Additional context: baseURL, timeout, queryParams (all sensitive data masked)
|
|
175
|
+
|
|
176
|
+
### Technical Improvements
|
|
177
|
+
|
|
178
|
+
- Improved error handling: Logging errors never break HTTP requests (all errors caught and swallowed)
|
|
179
|
+
- Performance: Async logging that doesn't block request/response flow
|
|
180
|
+
- Safety: Sensitive endpoints excluded from audit logging to prevent infinite loops
|
|
181
|
+
- Flexibility: Configurable sensitive fields via JSON configuration file
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
## [0.3.0] - 2025-11-01
|
|
186
|
+
|
|
187
|
+
### Added
|
|
188
|
+
|
|
189
|
+
- **Structured Error Response Interface**: Added generic `ErrorResponse` model following RFC 7807-style format for consistent error handling across applications
|
|
190
|
+
- `ErrorResponse` Pydantic model with fields: `errors`, `type`, `title`, `statusCode`, `instance`
|
|
191
|
+
- Automatic parsing of structured error responses from HTTP responses in `HttpClient`
|
|
192
|
+
- Support for both camelCase (`statusCode`) and snake_case (`status_code`) field names
|
|
193
|
+
- `MisoClientError` now includes optional `error_response` field with structured error information
|
|
194
|
+
- Enhanced error messages automatically generated from structured error responses
|
|
195
|
+
- Instance URI automatically extracted from request URL when not provided in response
|
|
196
|
+
- Backward compatible - falls back to traditional `error_body` dict when structured format is not available
|
|
197
|
+
- Export `ErrorResponse` from main module for reuse in other applications
|
|
198
|
+
- Comprehensive test coverage for error response parsing and fallback behavior
|
|
199
|
+
- Full type safety with Pydantic models
|
|
200
|
+
|
|
201
|
+
### Changed
|
|
202
|
+
|
|
203
|
+
- **Error Handling**: `MisoClientError` now prioritizes structured error information when available
|
|
204
|
+
- Error messages are automatically enhanced from structured error responses
|
|
205
|
+
- Status codes are extracted from structured responses when provided
|
|
206
|
+
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
## [0.2.0] - 2025-10-31
|
|
210
|
+
|
|
211
|
+
### Added
|
|
212
|
+
|
|
213
|
+
- **API_KEY Support for Testing**: Added optional `API_KEY` environment variable that allows bypassing OAuth2 authentication for testing purposes
|
|
214
|
+
- When `API_KEY` is set in environment, bearer tokens matching the key will automatically validate without OAuth2
|
|
215
|
+
- `validate_token()` returns `True` for matching API_KEY tokens without calling controller
|
|
216
|
+
- `get_user()` and `get_user_info()` return `None` when using API_KEY (by design for testing scenarios)
|
|
217
|
+
- Configuration supports `api_key` field in `MisoClientConfig`
|
|
218
|
+
- Comprehensive test coverage for API_KEY authentication flows
|
|
219
|
+
- Useful for testing without requiring Keycloak setup
|
|
220
|
+
|
|
221
|
+
- **PowerShell Makefile**: Added `Makefile.ps1` with all development commands for Windows PowerShell users
|
|
222
|
+
- Replaces `dev.bat` and `dev.ps1` scripts with unified PowerShell Makefile
|
|
223
|
+
- Supports all standard development commands (install, test, lint, format, build, etc.)
|
|
224
|
+
- Consistent interface with Unix Makefile
|
|
225
|
+
|
|
226
|
+
- **Validate Command**: Added new `validate` target to both Makefile and Makefile.ps1
|
|
227
|
+
- Runs lint + format + test in sequence
|
|
228
|
+
- Useful for pre-commit validation and CI/CD pipelines
|
|
229
|
+
- Usage: `make validate` or `.\Makefile.ps1 validate`
|
|
230
|
+
|
|
231
|
+
### Changed
|
|
232
|
+
|
|
233
|
+
- **Development Scripts**: Replaced `dev.bat` and `dev.ps1` with `Makefile.ps1` for better consistency
|
|
234
|
+
- All development commands now available through Makefile interface
|
|
235
|
+
- Improved cross-platform compatibility
|
|
236
|
+
|
|
237
|
+
### Testing
|
|
238
|
+
|
|
239
|
+
- Added comprehensive test suite for API_KEY functionality
|
|
240
|
+
- Tests for `validate_token()` with API_KEY matching and non-matching scenarios
|
|
241
|
+
- Tests for `get_user()` and `get_user_info()` with API_KEY
|
|
242
|
+
- Tests for config loader API_KEY loading
|
|
243
|
+
- All tests verify OAuth2 fallback behavior when API_KEY doesn't match
|
|
244
|
+
|
|
245
|
+
---
|
|
246
|
+
|
|
247
|
+
## [0.1.0] - 2025-10-30
|
|
248
|
+
|
|
249
|
+
### Added
|
|
250
|
+
|
|
251
|
+
- **Automatic Client Token Management in HttpClient**: Client tokens are now automatically fetched, cached, and refreshed by the HttpClient
|
|
252
|
+
- Proactive token refresh when < 60 seconds until expiry (30 second buffer before actual expiration)
|
|
253
|
+
- Automatic `x-client-token` header injection for all requests
|
|
254
|
+
- Concurrent token fetch prevention using async locks
|
|
255
|
+
- Automatic token clearing on 401 responses to force refresh
|
|
256
|
+
|
|
257
|
+
- **New Data Models**:
|
|
258
|
+
- `ClientTokenResponse`: Response model for client token requests with expiration tracking
|
|
259
|
+
- `PerformanceMetrics`: Performance metrics model for logging (start time, end time, duration, memory usage)
|
|
260
|
+
- `ClientLoggingOptions`: Advanced logging options with JWT context extraction, correlation IDs, data masking, and performance metrics support
|
|
261
|
+
|
|
262
|
+
- **RedisConfig Enhancement**:
|
|
263
|
+
- Added `db` field to specify Redis database number (default: 0)
|
|
264
|
+
- Supports multi-database Redis deployments
|
|
265
|
+
|
|
266
|
+
### Changed
|
|
267
|
+
|
|
268
|
+
- **Module Structure**: Moved type definitions from `miso_client.types.config` to `miso_client.models.config` for better organization
|
|
269
|
+
- All imports now use `from miso_client.models.config import ...`
|
|
270
|
+
- Previous compatibility layer (`types_backup_test`) removed as no longer needed
|
|
271
|
+
|
|
272
|
+
- **HttpClient Improvements**:
|
|
273
|
+
- Client token management is now fully automatic - no manual token handling required
|
|
274
|
+
- Better error handling with automatic token refresh on authentication failures
|
|
275
|
+
- All HTTP methods (GET, POST, PUT, DELETE) now automatically include client token header
|
|
276
|
+
|
|
277
|
+
### Technical Improvements
|
|
278
|
+
|
|
279
|
+
- Improved token expiration handling with proactive refresh mechanism
|
|
280
|
+
- Reduced API calls through intelligent token caching
|
|
281
|
+
- Better concurrency handling with async locks for token operations
|
|
282
|
+
- Enhanced error recovery with automatic token clearing on 401 responses
|
|
283
|
+
|
|
284
|
+
---
|
|
285
|
+
|
|
286
|
+
## [0.1.0] - 2025-10-01
|
|
287
|
+
|
|
288
|
+
### Added
|
|
289
|
+
|
|
290
|
+
- **Initial Release**: Complete MisoClient SDK implementation
|
|
291
|
+
- **Authentication**: JWT token validation and user management
|
|
292
|
+
- **Authorization**: Role-based access control (RBAC) with Redis caching
|
|
293
|
+
- **Permissions**: Fine-grained permission management with caching
|
|
294
|
+
- **Logging**: Structured logging with Redis queuing and HTTP fallback
|
|
295
|
+
- **Redis Integration**: Optional Redis caching for improved performance
|
|
296
|
+
- **Async Support**: Full async/await support for modern Python applications
|
|
297
|
+
- **Type Safety**: Complete type hints and Pydantic models
|
|
298
|
+
- **Graceful Degradation**: Works with or without Redis
|
|
299
|
+
- **Comprehensive Documentation**: Complete API reference and integration guides
|
|
300
|
+
- **Unit Tests**: Full test coverage mirroring TypeScript implementation
|
|
301
|
+
- **Package Distribution**: Ready for PyPI distribution with setup.py and pyproject.toml
|
|
302
|
+
|
|
303
|
+
### Features
|
|
304
|
+
|
|
305
|
+
#### Core Client
|
|
306
|
+
- `MisoClient` main class with initialization and lifecycle management
|
|
307
|
+
- Configuration management with `MisoClientConfig` and `RedisConfig`
|
|
308
|
+
- Connection state tracking and graceful fallback
|
|
309
|
+
|
|
310
|
+
#### Authentication Service
|
|
311
|
+
- Token validation with controller integration
|
|
312
|
+
- User information retrieval
|
|
313
|
+
- Login URL generation for web applications
|
|
314
|
+
- Logout functionality
|
|
315
|
+
|
|
316
|
+
#### Role Service
|
|
317
|
+
- Role retrieval with Redis caching (15-minute TTL)
|
|
318
|
+
- Role checking methods: `has_role`, `has_any_role`, `has_all_roles`
|
|
319
|
+
- Role refresh functionality to bypass cache
|
|
320
|
+
- Cache key management with user/environment/application scoping
|
|
321
|
+
|
|
322
|
+
#### Permission Service
|
|
323
|
+
- Permission retrieval with Redis caching (15-minute TTL)
|
|
324
|
+
- Permission checking methods: `has_permission`, `has_any_permission`, `has_all_permissions`
|
|
325
|
+
- Permission refresh functionality to bypass cache
|
|
326
|
+
- Cache clearing functionality
|
|
327
|
+
- Cache key management with user/environment/application scoping
|
|
328
|
+
|
|
329
|
+
#### Logger Service
|
|
330
|
+
- Structured logging with multiple levels: `info`, `error`, `audit`, `debug`
|
|
331
|
+
- Redis queue integration for log batching
|
|
332
|
+
- HTTP fallback when Redis is unavailable
|
|
333
|
+
- Context-aware logging with metadata support
|
|
334
|
+
|
|
335
|
+
#### HTTP Client
|
|
336
|
+
- Async HTTP client wrapper using httpx
|
|
337
|
+
- Automatic header injection (X-Environment, X-Application)
|
|
338
|
+
- Authenticated request support with Bearer token
|
|
339
|
+
- Error handling and status code management
|
|
340
|
+
|
|
341
|
+
#### Redis Service
|
|
342
|
+
- Async Redis integration using redis.asyncio
|
|
343
|
+
- Graceful degradation when Redis is unavailable
|
|
344
|
+
- Connection state tracking
|
|
345
|
+
- Key prefix support for multi-tenant environments
|
|
346
|
+
|
|
347
|
+
### Data Models
|
|
348
|
+
|
|
349
|
+
- `UserInfo`: User information from token validation
|
|
350
|
+
- `AuthResult`: Authentication result structure
|
|
351
|
+
- `LogEntry`: Structured log entry format
|
|
352
|
+
- `RoleResult`: Role query result
|
|
353
|
+
- `PermissionResult`: Permission query result
|
|
354
|
+
- `MisoClientConfig`: Main client configuration
|
|
355
|
+
- `RedisConfig`: Redis connection configuration
|
|
356
|
+
|
|
357
|
+
### Integration Examples
|
|
358
|
+
|
|
359
|
+
- **FastAPI**: Complete integration with dependencies and middleware
|
|
360
|
+
- **Django**: Middleware, decorators, and view integration
|
|
361
|
+
- **Flask**: Decorator-based authentication and authorization
|
|
362
|
+
- **Custom Applications**: Dependency injection and service patterns
|
|
363
|
+
|
|
364
|
+
### Documentation
|
|
365
|
+
|
|
366
|
+
- **README.md**: Comprehensive SDK documentation with quick start guide
|
|
367
|
+
- **API Reference**: Detailed method signatures and parameter descriptions
|
|
368
|
+
- **Integration Guide**: Framework-specific integration examples
|
|
369
|
+
- **Changelog**: Version history and feature tracking
|
|
370
|
+
|
|
371
|
+
### Testing
|
|
372
|
+
|
|
373
|
+
- **Unit Tests**: Comprehensive test coverage for all services
|
|
374
|
+
- **Mock Support**: Mock implementations for testing
|
|
375
|
+
- **Error Handling**: Test coverage for error scenarios and edge cases
|
|
376
|
+
- **Performance Tests**: Concurrent operation testing
|
|
377
|
+
|
|
378
|
+
### Package Management
|
|
379
|
+
|
|
380
|
+
- **setup.py**: Traditional Python package configuration
|
|
381
|
+
- **pyproject.toml**: Modern Python packaging (PEP 518)
|
|
382
|
+
- **Dependencies**: httpx, redis[hiredis], pydantic, pydantic-settings, structlog
|
|
383
|
+
- **Development Dependencies**: pytest, black, isort, mypy
|
|
384
|
+
- **Python Support**: Python 3.8+ compatibility
|
|
385
|
+
|
|
386
|
+
### Security
|
|
387
|
+
|
|
388
|
+
- **Token Handling**: Secure JWT token processing
|
|
389
|
+
- **Redis Security**: Password and key prefix support
|
|
390
|
+
- **Logging Security**: Careful handling of sensitive information
|
|
391
|
+
- **Error Handling**: Graceful error handling without information leakage
|
|
392
|
+
|
|
393
|
+
### Performance
|
|
394
|
+
|
|
395
|
+
- **Caching**: Redis-based caching for roles and permissions
|
|
396
|
+
- **Connection Pooling**: Efficient HTTP and Redis connection management
|
|
397
|
+
- **Async Operations**: Non-blocking async/await throughout
|
|
398
|
+
- **Batch Operations**: Support for concurrent operations
|
|
399
|
+
|
|
400
|
+
### Compatibility
|
|
401
|
+
|
|
402
|
+
- **Python Versions**: 3.8, 3.9, 3.10, 3.11, 3.12
|
|
403
|
+
- **Framework Support**: FastAPI, Django, Flask, and custom applications
|
|
404
|
+
- **Redis Versions**: Compatible with Redis 5.0+
|
|
405
|
+
- **HTTP Clients**: Uses httpx for modern async HTTP support
|
|
406
|
+
|
|
407
|
+
### Migration
|
|
408
|
+
|
|
409
|
+
- **From Keycloak**: Seamless migration from direct Keycloak integration
|
|
410
|
+
- **Backward Compatibility**: Maintains existing API patterns
|
|
411
|
+
- **Configuration**: Simple configuration migration
|
|
412
|
+
- **Testing**: Comprehensive migration testing support
|
|
413
|
+
|
|
414
|
+
---
|
|
415
|
+
|
|
416
|
+
## Future Releases
|
|
417
|
+
|
|
418
|
+
### Planned Features
|
|
419
|
+
|
|
420
|
+
- **WebSocket Support**: Real-time authentication updates
|
|
421
|
+
- **Metrics Integration**: Prometheus and OpenTelemetry support
|
|
422
|
+
- **Advanced Caching**: Cache invalidation strategies
|
|
423
|
+
- **Multi-Controller Support**: Load balancing across multiple controllers
|
|
424
|
+
- **SDK Extensions**: Framework-specific SDK extensions
|
|
425
|
+
|
|
426
|
+
### Roadmap
|
|
427
|
+
|
|
428
|
+
- **v1.1.0**: WebSocket support and real-time updates
|
|
429
|
+
- **v1.2.0**: Advanced metrics and monitoring
|
|
430
|
+
- **v2.0.0**: Multi-controller support and load balancing
|
|
431
|
+
- **v2.1.0**: Framework-specific SDK extensions
|
|
432
|
+
|
|
433
|
+
---
|
|
434
|
+
|
|
435
|
+
For more information about the MisoClient SDK, visit:
|
|
436
|
+
- [Documentation](https://docs.aifabrix.ai/miso-client-python)
|
|
437
|
+
- [GitHub Repository](https://github.com/aifabrix/miso-client-python)
|
|
438
|
+
- [Issue Tracker](https://github.com/aifabrix/miso-client-python/issues)
|