mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
28 lines
699 B
Python
28 lines
699 B
Python
# -*- coding: utf-8 -*-
|
|
|
|
import logging
|
|
from moulinette.core import MoulinetteError
|
|
from moulinette.authenticators import BaseAuthenticator
|
|
|
|
logger = logging.getLogger("moulinette.authenticator.dummy")
|
|
|
|
# Dummy authenticator implementation
|
|
|
|
|
|
class Authenticator(BaseAuthenticator):
|
|
|
|
"""Dummy authenticator used for tests"""
|
|
|
|
vendor = "dummy"
|
|
|
|
def __init__(self, name, vendor, parameters, extra):
|
|
logger.debug("initialize authenticator dummy")
|
|
|
|
super(Authenticator, self).__init__(name, vendor, parameters, extra)
|
|
|
|
def authenticate(self, password=None):
|
|
|
|
if not password == self.name:
|
|
raise MoulinetteError("invalid_password")
|
|
|
|
return self
|