--- title: Password Authenticator keywords: fastai sidebar: home_sidebar nb_path: "nbs/plugins.authenticators.password.ipynb" ---
class MyAuthenticatedPlugin(PluginBase):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.logged_in = False
self.authenticator = PasswordAuthenticator(self.client, self.pluginRun)
def login(self, username, password):
if not (username=="username" and password=="password"):
raise ValueError("Wrong credentials.")
def run(self):
self.authenticator.authenticate(login_callback=self.login)
self.logged_in = True
print("done!")
def add_to_schema(self):
pass
pod_client = PodClient()
run = PluginRun("", "", "")
account = Account(service="myAccount")
run.add_edge("account", account)
run.status = "started"
pod_client.create(run)
pod_client.create(account)
pod_client.create_edge(run.get_edges("account")[0]);