diff --git a/src/middlewared/middlewared/auth.py b/src/middlewared/middlewared/auth.py index 5f11e997fab55..89edce8e9d5fb 100644 --- a/src/middlewared/middlewared/auth.py +++ b/src/middlewared/middlewared/auth.py @@ -131,3 +131,10 @@ class FakeApplication: def fake_app(): return FakeApplication() + + +def dump_credentials(credentials): + return { + "credentials": credentials.class_name(), + "credentials_data": credentials.dump(), + } diff --git a/src/middlewared/middlewared/plugins/auth.py b/src/middlewared/middlewared/plugins/auth.py index 6d3f3d19b17a8..d14abc5f37b25 100644 --- a/src/middlewared/middlewared/plugins/auth.py +++ b/src/middlewared/middlewared/plugins/auth.py @@ -10,7 +10,7 @@ from middlewared.auth import (SessionManagerCredentials, UserSessionManagerCredentials, UnixSocketSessionManagerCredentials, LoginPasswordSessionManagerCredentials, ApiKeySessionManagerCredentials, TrueNasNodeSessionManagerCredentials, - TokenSessionManagerCredentials) + TokenSessionManagerCredentials, dump_credentials) from middlewared.schema import accepts, Any, Bool, Datetime, Dict, Int, List, Password, Patch, Ref, returns, Str from middlewared.service import ( Service, filterable, filterable_returns, filter_list, no_auth_required, no_authz_required, @@ -144,13 +144,6 @@ def _app_on_close(self, app): self.logout(app) -def dump_credentials(credentials): - return { - "credentials": credentials.class_name(), - "credentials_data": credentials.dump(), - } - - class Session: def __init__(self, manager, credentials, app): self.manager = manager