AlaK4X
Linux lhjmq-records 5.15.0-118-generic #128-Ubuntu SMP Fri Jul 5 09:28:59 UTC 2024 x86_64



Your IP : 3.148.145.219


Current Path : /usr/lib/python3/dist-packages/twisted/plugins/
Upload File :
Current File : //usr/lib/python3/dist-packages/twisted/plugins/cred_anonymous.py

# -*- test-case-name: twisted.test.test_strcred -*-
#
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.

"""
Cred plugin for anonymous logins.
"""


from zope.interface import implementer

from twisted import plugin
from twisted.cred.checkers import AllowAnonymousAccess
from twisted.cred.credentials import IAnonymous
from twisted.cred.strcred import ICheckerFactory

anonymousCheckerFactoryHelp = """
This allows anonymous authentication for servers that support it.
"""


@implementer(ICheckerFactory, plugin.IPlugin)
class AnonymousCheckerFactory:
    """
    Generates checkers that will authenticate an anonymous request.
    """

    authType = "anonymous"
    authHelp = anonymousCheckerFactoryHelp
    argStringFormat = "No argstring required."
    credentialInterfaces = (IAnonymous,)

    def generateChecker(self, argstring=""):
        return AllowAnonymousAccess()


theAnonymousCheckerFactory = AnonymousCheckerFactory()