from defence360agent.api.integration_conf import IntegrationConfig from defence360agent.contracts.config import UIRole from defence360agent.subsys.panels.generic.panel import get_admin_list class PamAuth: DEFAULT_AUTH_SERVICE = "system-auth" def authenticate(self, username, password) -> bool: from pam import pam try: config = IntegrationConfig().to_dict() service = config["PAM"]["SERVICE_NAME"] except KeyError: service = self.DEFAULT_AUTH_SERVICE p = pam() return p.authenticate(username, password, service=service) async def get_user_type(self, username: str) -> UIRole: admins = await get_admin_list() return UIRole.ADMIN if username in admins else UIRole.CLIENT
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
__pycache__ | Folder | 0755 |
|
|
server | Folder | 0755 |
|
|
__init__.py | File | 0 B | 0644 |
|
health.py | File | 3.38 KB | 0644 |
|
inactivity.py | File | 1.49 KB | 0644 |
|
integration_conf.py | File | 884 B | 0644 |
|
jwt_issuer.py | File | 2.97 KB | 0644 |
|
newsfeed.py | File | 4.3 KB | 0644 |
|
pam_auth.py | File | 779 B | 0644 |
|