Skip to content

utils.aind_auth

validate_aind_username

validate_aind_username(
    username: str,
    domain: str = "corp.alleninstitute.org",
    domain_username: Optional[str] = None,
    timeout: Optional[float] = 2,
) -> bool

Validates if the given username is in the AIND Active Directory.

This function is a no-op on non-Windows platforms since Active Directory authentication is not available.

This function always returns True on non-Windows platforms.

Parameters:

Name Type Description Default
username str

The username to validate (ignored on non-Windows platforms)

required
domain str

The Active Directory domain (ignored on non-Windows platforms)

'corp.alleninstitute.org'
domain_username Optional[str]

Username for domain authentication (ignored on non-Windows platforms)

None
timeout Optional[float]

Timeout for the validation operation (ignored on non-Windows platforms)

2

Returns:

Name Type Description
bool bool

Always returns True on non-Windows platforms

Source code in src\clabe\utils\aind_auth.py
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
def validate_aind_username(
    username: str,
    domain: str = "corp.alleninstitute.org",
    domain_username: Optional[str] = None,
    timeout: Optional[float] = 2,
) -> bool:
    """
    Validates if the given username is in the AIND Active Directory.

    This function is a no-op on non-Windows platforms since Active Directory
    authentication is not available.

    This function always returns True on non-Windows platforms.

    Args:
        username: The username to validate (ignored on non-Windows platforms)
        domain: The Active Directory domain (ignored on non-Windows platforms)
        domain_username: Username for domain authentication (ignored on non-Windows platforms)
        timeout: Timeout for the validation operation (ignored on non-Windows platforms)

    Returns:
        bool: Always returns True on non-Windows platforms
    """
    logger.warning("Active Directory validation is not implemented for non-Windows platforms")
    return True