abs-auth-rbac-core 0.3.0__tar.gz → 0.3.1__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.
- {abs_auth_rbac_core-0.3.0 → abs_auth_rbac_core-0.3.1}/PKG-INFO +1 -1
- {abs_auth_rbac_core-0.3.0 → abs_auth_rbac_core-0.3.1}/abs_auth_rbac_core/rbac/service.py +26 -14
- {abs_auth_rbac_core-0.3.0 → abs_auth_rbac_core-0.3.1}/pyproject.toml +1 -1
- {abs_auth_rbac_core-0.3.0 → abs_auth_rbac_core-0.3.1}/README.md +0 -0
- {abs_auth_rbac_core-0.3.0 → abs_auth_rbac_core-0.3.1}/abs_auth_rbac_core/__init__.py +0 -0
- {abs_auth_rbac_core-0.3.0 → abs_auth_rbac_core-0.3.1}/abs_auth_rbac_core/auth/__init__.py +0 -0
- {abs_auth_rbac_core-0.3.0 → abs_auth_rbac_core-0.3.1}/abs_auth_rbac_core/auth/auth_functions.py +0 -0
- {abs_auth_rbac_core-0.3.0 → abs_auth_rbac_core-0.3.1}/abs_auth_rbac_core/auth/jwt_functions.py +0 -0
- {abs_auth_rbac_core-0.3.0 → abs_auth_rbac_core-0.3.1}/abs_auth_rbac_core/auth/middleware.py +0 -0
- {abs_auth_rbac_core-0.3.0 → abs_auth_rbac_core-0.3.1}/abs_auth_rbac_core/models/__init__.py +0 -0
- {abs_auth_rbac_core-0.3.0 → abs_auth_rbac_core-0.3.1}/abs_auth_rbac_core/models/base_model.py +0 -0
- {abs_auth_rbac_core-0.3.0 → abs_auth_rbac_core-0.3.1}/abs_auth_rbac_core/models/gov_casbin_rule.py +0 -0
- {abs_auth_rbac_core-0.3.0 → abs_auth_rbac_core-0.3.1}/abs_auth_rbac_core/models/permissions.py +0 -0
- {abs_auth_rbac_core-0.3.0 → abs_auth_rbac_core-0.3.1}/abs_auth_rbac_core/models/rbac_model.py +0 -0
- {abs_auth_rbac_core-0.3.0 → abs_auth_rbac_core-0.3.1}/abs_auth_rbac_core/models/role_permission.py +0 -0
- {abs_auth_rbac_core-0.3.0 → abs_auth_rbac_core-0.3.1}/abs_auth_rbac_core/models/roles.py +0 -0
- {abs_auth_rbac_core-0.3.0 → abs_auth_rbac_core-0.3.1}/abs_auth_rbac_core/models/seeder/permission_seeder.py +0 -0
- {abs_auth_rbac_core-0.3.0 → abs_auth_rbac_core-0.3.1}/abs_auth_rbac_core/models/user.py +0 -0
- {abs_auth_rbac_core-0.3.0 → abs_auth_rbac_core-0.3.1}/abs_auth_rbac_core/models/user_permission.py +0 -0
- {abs_auth_rbac_core-0.3.0 → abs_auth_rbac_core-0.3.1}/abs_auth_rbac_core/models/user_role.py +0 -0
- {abs_auth_rbac_core-0.3.0 → abs_auth_rbac_core-0.3.1}/abs_auth_rbac_core/rbac/__init__.py +0 -0
- {abs_auth_rbac_core-0.3.0 → abs_auth_rbac_core-0.3.1}/abs_auth_rbac_core/rbac/decorator.py +0 -0
- {abs_auth_rbac_core-0.3.0 → abs_auth_rbac_core-0.3.1}/abs_auth_rbac_core/rbac/policy.conf +0 -0
- {abs_auth_rbac_core-0.3.0 → abs_auth_rbac_core-0.3.1}/abs_auth_rbac_core/schema/__init__.py +0 -0
- {abs_auth_rbac_core-0.3.0 → abs_auth_rbac_core-0.3.1}/abs_auth_rbac_core/schema/permission.py +0 -0
- {abs_auth_rbac_core-0.3.0 → abs_auth_rbac_core-0.3.1}/abs_auth_rbac_core/util/__init__.py +0 -0
- {abs_auth_rbac_core-0.3.0 → abs_auth_rbac_core-0.3.1}/abs_auth_rbac_core/util/permission_constants.py +0 -0
|
@@ -46,6 +46,7 @@ class RBACService:
|
|
|
46
46
|
self._initialize_casbin(redis_config)
|
|
47
47
|
self.watcher = None
|
|
48
48
|
|
|
49
|
+
|
|
49
50
|
def _initialize_casbin(self,redis_config:Optional[RedisWatcherSchema]=None):
|
|
50
51
|
"""
|
|
51
52
|
Initiates the casbin policy using the default rules
|
|
@@ -69,31 +70,42 @@ class RBACService:
|
|
|
69
70
|
|
|
70
71
|
if redis_config:
|
|
71
72
|
try:
|
|
72
|
-
# Create Redis client with proper configuration
|
|
73
73
|
redis_client = Redis(
|
|
74
74
|
host=redis_config.host,
|
|
75
75
|
port=redis_config.port,
|
|
76
76
|
password=redis_config.password if hasattr(redis_config, 'password') else None,
|
|
77
|
-
ssl=redis_config.ssl,
|
|
77
|
+
ssl=redis_config.ssl, # This is crucial for azure redis
|
|
78
|
+
ssl_cert_reqs=None, # This is crucial for azure redis (Should be none for azure redis)
|
|
79
|
+
ssl_check_hostname=False,
|
|
80
|
+
socket_connect_timeout=10, # Only socket_connect_timeout is required for azure redis watcher
|
|
78
81
|
decode_responses=True,
|
|
79
|
-
socket_connect_timeout=5,
|
|
80
|
-
socket_timeout=5,
|
|
81
82
|
retry_on_timeout=True,
|
|
82
|
-
health_check_interval=30
|
|
83
|
-
|
|
83
|
+
health_check_interval=30 # Required for open connection
|
|
84
|
+
)
|
|
85
|
+
|
|
84
86
|
|
|
85
87
|
# Test Redis connection
|
|
86
88
|
redis_client.ping()
|
|
87
89
|
|
|
88
90
|
# Create Watcher and Options
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
91
|
+
option = WatcherOptions()
|
|
92
|
+
option.host = redis_config.host
|
|
93
|
+
option.port = redis_config.port
|
|
94
|
+
option.password = redis_config.password
|
|
95
|
+
option.ssl = redis_config.ssl
|
|
96
|
+
option.channel = redis_config.channel
|
|
97
|
+
option.optional_update_callback = lambda _: self.enforcer.load_policy()
|
|
98
|
+
|
|
99
|
+
option.init_config()
|
|
100
|
+
|
|
101
|
+
watcher = RedisWatcher()
|
|
102
|
+
|
|
103
|
+
watcher.sub_client = redis_client.pubsub()
|
|
104
|
+
watcher.pub_client = redis_client
|
|
105
|
+
watcher.init_config(option)
|
|
106
|
+
watcher.close = False
|
|
107
|
+
watcher.subscribe_thread.start()
|
|
108
|
+
watcher.subscribe_event.wait(timeout=10)
|
|
97
109
|
|
|
98
110
|
self.enforcer.set_watcher(watcher)
|
|
99
111
|
self.watcher = watcher
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{abs_auth_rbac_core-0.3.0 → abs_auth_rbac_core-0.3.1}/abs_auth_rbac_core/auth/auth_functions.py
RENAMED
|
File without changes
|
{abs_auth_rbac_core-0.3.0 → abs_auth_rbac_core-0.3.1}/abs_auth_rbac_core/auth/jwt_functions.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{abs_auth_rbac_core-0.3.0 → abs_auth_rbac_core-0.3.1}/abs_auth_rbac_core/models/base_model.py
RENAMED
|
File without changes
|
{abs_auth_rbac_core-0.3.0 → abs_auth_rbac_core-0.3.1}/abs_auth_rbac_core/models/gov_casbin_rule.py
RENAMED
|
File without changes
|
{abs_auth_rbac_core-0.3.0 → abs_auth_rbac_core-0.3.1}/abs_auth_rbac_core/models/permissions.py
RENAMED
|
File without changes
|
{abs_auth_rbac_core-0.3.0 → abs_auth_rbac_core-0.3.1}/abs_auth_rbac_core/models/rbac_model.py
RENAMED
|
File without changes
|
{abs_auth_rbac_core-0.3.0 → abs_auth_rbac_core-0.3.1}/abs_auth_rbac_core/models/role_permission.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{abs_auth_rbac_core-0.3.0 → abs_auth_rbac_core-0.3.1}/abs_auth_rbac_core/models/user_permission.py
RENAMED
|
File without changes
|
{abs_auth_rbac_core-0.3.0 → abs_auth_rbac_core-0.3.1}/abs_auth_rbac_core/models/user_role.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{abs_auth_rbac_core-0.3.0 → abs_auth_rbac_core-0.3.1}/abs_auth_rbac_core/schema/permission.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|