reviewboard.accounts.backends.nis¶
NIS authentication backend.
- class NISBackend[source]¶
Bases:
BaseAuthBackend
Authenticate against a user on an NIS server.
- name: Optional[StrOrPromise] = 'NIS'[source]¶
The display name for the authentication backend.
This will be shown in the list of backends in the administration UI.
- Type:
- settings_form[source]¶
alias of
NISSettingsForm
- login_instructions: Optional[StrOrPromise] = 'Use your standard NIS username and password.'[source]¶
Authentication instructions to display above the Login form.
- Type:
- nis[source]¶
The nis module, used for interacting with NIS.
On first access, this will check if NIS is available, logging an error if missing.
This safeguards against Python environments without NIS, and against versions of Python >= 3.13.
- Type:
module
- authenticate(request: Optional[HttpRequest] = None, *, username: Optional[str] = None, password: Optional[str] = None, **kwargs) Optional[User] [source]¶
Authenticate the user.
This will attempt to authenticate the user against NIS. If the username and password are valid, a user will be returned, and added to the database if it doesn’t already exist.
Changed in version 6.0:
request
is now optional.username
andpassword
are technically optional, to aid in consistency for type hints, but will result in aNone
result.
Changed in version 4.0: The
request
argument is now mandatory as the first positional argument, as per requirements in Django.- Parameters:
request (
django.http.HttpRequest
) – The HTTP request from the caller. This may beNone
.username (
str
) – The username to authenticate.password (
str
) – The password to authenticate.**kwargs (
dict
, unused) – Additional keyword arguments.
- Returns:
The authenticated user, or
None
if the user could not be authenticated.- Return type:
- get_or_create_user(username: str, request: Optional[HttpRequest] = None, passwd: Optional[_NISPasswdEntry] = None) Optional[User] [source]¶
Return an existing user, or create one if it does not exist.
If the user does not exist in the database, but does in the backend, its information will be stored in the database for later lookup.
- Parameters:
username (
str
) – The username of the user.request (
django.http.HttpRequest
, optional) – The HTTP request from the client.passwd (
tuple
, optional) – The parsed NIS passwd entry for the user.
- Returns:
The existing or newly-created user, or
None
if an error was encountered.- Return type:
- __annotations__ = {'INVALID_USERNAME_CHAR_REGEX': 're.Pattern', 'backend_id': 'Optional[str]', 'login_instructions': 'Optional[StrOrPromise]', 'name': 'Optional[StrOrPromise]', 'settings_form': 'Optional[Type[SiteSettingsForm]]', 'supports_change_email': 'bool', 'supports_change_name': 'bool', 'supports_change_password': 'bool', 'supports_registration': 'bool'}¶