bluesky-authentication provides shared authenticator implementations and
protocol interfaces for Bluesky web services.
It centralizes authentication logic that was previously duplicated across projects, including Tiled and bluesky-httpserver.
Core package:
pip install bluesky-authenticationOptional authenticators require optional dependencies:
- LDAP:
pip install "bluesky-authentication[ldap]" - PAM:
pip install "bluesky-authentication[pam]" - SAML:
pip install "bluesky-authentication[saml]"
Import authenticators from bluesky_authentication.authenticators:
from bluesky_authentication.authenticators import (
DictionaryAuthenticator,
DummyAuthenticator,
EntraAuthenticator,
LDAPAuthenticator,
OIDCAuthenticator,
PAMAuthenticator,
ProxiedOIDCAuthenticator,
SAMLAuthenticator,
)Import protocol types from bluesky_authentication.protocols:
from bluesky_authentication.protocols import (
ExternalAuthenticator,
InternalAuthenticator,
UserSessionState,
)InternalAuthenticator implementations authenticate username/password:
state = await internal_authenticator.authenticate(username, password)
if state is None:
# Authentication failed
...ExternalAuthenticator implementations authenticate from a web callback
request:
state = await external_authenticator.authenticate(request)
if state is None:
# Authentication failed
...On success, authenticators return UserSessionState(user_name, state_dict).
When wiring authenticators through YAML config, use canonical import paths from this package:
authentication:
providers:
- provider: toy
authenticator: bluesky_authentication.authenticators:DictionaryAuthenticator
args:
users_to_passwords:
alice: ${ALICE_PASSWORD}The same pattern applies to all built-in authenticators, for example:
bluesky_authentication.authenticators:PAMAuthenticatorbluesky_authentication.authenticators:LDAPAuthenticatorbluesky_authentication.authenticators:OIDCAuthenticatorbluesky_authentication.authenticators:EntraAuthenticator
Host projects may continue to support legacy paths for backward compatibility,
such as tiled.authenticators:* and bluesky_httpserver.authenticators:*.
New configurations should use bluesky_authentication.authenticators:*.