def test_deprecated_config_priority(): cfg = Config() cfg.ServerApp.token = "ignored" cfg.IdentityProvider.token = token = "idp_token" cfg.ServerApp.password = passwd("ignored") cfg.PasswordIdentityProvider.hashed_password = password = passwd("used") app = ServerApp(config=cfg) app.initialize([]) app.init_configurables() assert app.identity_provider.token == token assert app.identity_provider.hashed_password == password
def test_deprecated_config(): cfg = Config() cfg.ServerApp.token = token = "asdf" cfg.ServerApp.password = password = passwd("secrets") app = ServerApp(config=cfg) app.initialize([]) app.init_configurables() assert app.identity_provider.token == token assert app.token == token assert app.identity_provider.hashed_password == password assert app.password == password
import os c.ServerApp.ip = '*' c.ServerApp.allow_remote_access = True c.KernelManager.shutdown_wait_time = 10.0 c.FileContentsManager.delete_to_trash = False c.ServerApp.quit_button = False c.ServerApp.terminado_settings = {'shell_command': ['/bin/bash']} c.ServerApp.root_dir = '/jupyter' if 'PASSWORD' in os.environ: from jupyter_server.auth.security import passwd c.ServerApp.password = passwd(os.environ['PASSWORD']) del os.environ['PASSWORD']
def test_passwd_structure(): p = passwd("passphrase") algorithm, salt, hashed = p.split(":") assert algorithm == "sha1" assert len(salt) == salt_len assert len(hashed) == 40
def test_bad(): p = passwd("passphrase") assert not passwd_check(p, p) assert not passwd_check(p, "a:b:c:d") assert not passwd_check(p, "a:b")
def test_roundtrip(): p = passwd("passphrase") assert passwd_check(p, "passphrase")
def test_passwd_structure(): p = passwd('passphrase') algorithm, hashed = p.split(':') assert algorithm == 'argon2', algorithm assert hashed.startswith('$argon2id$'), hashed
def test_bad(): p = passwd('passphrase') assert not passwd_check(p, p) assert not passwd_check(p, 'a:b:c:d') assert not passwd_check(p, 'a:b')
def test_roundtrip(): p = passwd('passphrase') assert passwd_check(p, 'passphrase')
def test_passwd_structure(): p = passwd("passphrase") algorithm, hashed = p.split(":") assert algorithm == "argon2", algorithm assert hashed.startswith("$argon2id$"), hashed
def test_passwd_structure(): p = passwd('passphrase') algorithm, salt, hashed = p.split(':') assert algorithm == 'sha1' assert len(salt) == salt_len assert len(hashed) == 40