Source code for x2gobroker.authmechs.testsuite_authmech

# -*- coding: utf-8 -*-
# vim:fenc=utf-8

# Copyright (C) 2012-2020 by Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
#
# X2Go Session Broker is free software; you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# X2Go Session Broker is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program; if not, write to the
# Free Software Foundation, Inc.,
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.

[docs] class X2GoBrokerAuthMech(object): """\ Unit testing *authentication mechanism* class. Used internally for running unit tests of the :mod:`x2gobroker` module's code base. Don't use this!!! """
[docs] def authenticate(self, username, password, **kwargs): """ Test function, faking sucessful authentication for user ``test`` with password ``sweet`` and user ``jacques`` with accentuated characters in the password ``thérèse``. Don't use this!!! :param username: The broker username sent by the client (ignored) :type username: ``str`` :param password: The broker password sent by the client (ignored) :type password: ``str`` :param kwargs: Any other parameter (for future features' compatibility, all ignored for now) :type kwargs: ``dict`` :returns: Authentication failure (always!) :rtype: ``bool`` """ # return ``True`` for user test with password sweet... (used by the unit tests) if username == 'test' and password == 'sweet': return True if username == "jacques" and password == 'thérèse': return True return False