nvflare.fuel.hci.server.login module

class Authenticator[source]

Bases: ABC

Base class for authenticating credentials.

abstract authenticate(user_name: str, credential: str, credential_type: CredentialType) bool[source]

Authenticate a specified user with the provided credential.

Parameters:
  • user_name – user login name

  • credential – provided credential

  • credential_type – type of credential

Returns: True if successful, False otherwise

class LoginModule(authenticator: Authenticator, sess_mgr: SessionManager)[source]

Bases: CommandModule, CommandFilter

Login module.

CommandModule containing the login commands to handle login and logout of admin clients, as well as the CommandFilter pre_command to check that a client is logged in with a valid session.

Parameters:
  • authenticator – Authenticator

  • sess_mgr – SessionManager

close()[source]
get_spec()[source]
handle_cert_login(conn: Connection, args: List[str])[source]
handle_login(conn: Connection, args: List[str])[source]
handle_logout(conn: Connection, args: List[str])[source]
pre_command(conn: Connection, args: List[str])[source]

Code to execute before executing a command.

Returns: True to continue filter chain or False to not

class SimpleAuthenticator(users)[source]

Bases: Authenticator

Authenticator to use in the LoginModule for authenticating admin clients for login.

Parameters:

users – user information

authenticate(user_name: str, credential, credential_type)[source]

Authenticate a specified user with the provided credential.

Parameters:
  • user_name – user login name

  • credential – provided credential

  • credential_type – type of credential

Returns: True if successful, False otherwise

authenticate_cn(user_name: str, cn)[source]
authenticate_password(user_name: str, pwd: str)[source]