Your IP : 172.28.240.42


Current Path : /usr/lib/python2.7/dist-packages/twisted/cred/
Upload File :
Current File : //usr/lib/python2.7/dist-packages/twisted/cred/strcred.pyc

ó
[³XMc@sîdZddlZddlmZmZddlmZddlmZdefd„ƒYZ	de
fd	„ƒYZd
efd„ƒYZdefd
„ƒYZ
defd„ƒYZdZd„Zd„Zd„Zddd„ƒYZdS(s¨
Support for resolving command-line strings that represent different
checkers available to cred.

Examples:
 - passwd:/etc/passwd
 - memory:admin:asdf:user:lkj
 - unix
iÿÿÿÿN(t	Interfacet	Attribute(t
getPlugins(tusagetICheckerFactorycBsGeZdZedƒZedƒZedƒZedƒZd„ZRS(sš
    A factory for objects which provide
    L{twisted.cred.checkers.ICredentialsChecker}.

    It's implemented by twistd plugins creating checkers.
    s0A tag that identifies the authentication method.smA detailed (potentially multi-line) description of precisely what functionality this CheckerFactory provides.s=A short (one-line) description of the argument string format.s@A list of credentials interfaces that this factory will support.cCsdS(sf
        Return an L{ICredentialChecker} provider using the supplied
        argument string.
        N((t	argstring((s8/usr/lib/python2.7/dist-packages/twisted/cred/strcred.pytgenerateChecker3s(	t__name__t
__module__t__doc__RtauthTypetauthHelptargStringFormattcredentialInterfacesR(((s8/usr/lib/python2.7/dist-packages/twisted/cred/strcred.pyRs				tStrcredExceptioncBseZdZRS(s+
    Base exception class for strcred.
    (RRR	(((s8/usr/lib/python2.7/dist-packages/twisted/cred/strcred.pyR;stInvalidAuthTypecBseZdZRS(sv
    Raised when a user provides an invalid identifier for the
    authentication plugin (known as the authType).
    (RRR	(((s8/usr/lib/python2.7/dist-packages/twisted/cred/strcred.pyRBstInvalidAuthArgumentStringcBseZdZRS(sl
    Raised by an authentication plugin when the argument string
    provided is formatted incorrectly.
    (RRR	(((s8/usr/lib/python2.7/dist-packages/twisted/cred/strcred.pyRJstUnsupportedInterfacescBseZdZRS(s“
    Raised when an application is given a checker to use that does not
    provide any of the application's supported credentials interfaces.
    (RRR	(((s8/usr/lib/python2.7/dist-packages/twisted/cred/strcred.pyRRss<WARNING: This authType is not supported by this application.cCs
ttƒS(s=
    Find all objects that implement L{ICheckerFactory}.
    (RR(((s8/usr/lib/python2.7/dist-packages/twisted/cred/strcred.pytfindCheckerFactoriesascCs7x$tƒD]}|j|kr
|Sq
Wt|ƒ‚dS(sJ
    Find the first checker factory that supports the given authType.
    N(RR
R(R
tfactory((s8/usr/lib/python2.7/dist-packages/twisted/cred/strcred.pytfindCheckerFactoryiscCsFd|kr'|jddƒ\}}n|}d}t|ƒj|ƒS(s¤
    Returns an L{twisted.cred.checkers.ICredentialsChecker} based on the
    contents of a descriptive string. Similar to
    L{twisted.application.strports}.
    t:it(tsplitRR(tdescriptionR
R((s8/usr/lib/python2.7/dist-packages/twisted/cred/strcred.pytmakeCheckerts
tAuthOptionMixincBs\eZdZdZejZd„Zd„Z	d„Z
d„Zd„Zd„Z
d„ZRS(	sk
    Defines helper methods that can be added on to any
    L{usage.Options} subclass that needs authentication.

    This mixin implements three new options methods:

    The opt_auth method (--auth) will write two new values to the
    'self' dictionary: C{credInterfaces} (a dict of lists) and
    C{credCheckers} (a list).

    The opt_help_auth method (--help-auth) will search for all
    available checker plugins and list them for the user; it will exit
    when finished.

    The opt_help_auth_type method (--help-auth-type) will display
    detailed help for a particular checker plugin.

    @cvar supportedInterfaces: An iterable object that returns
       credential interfaces which this application is able to support.

    @cvar authOutput: A writeable object to which this options class
        will send all help-related output. Default: L{sys.stdout}
    cCs|jdkp||jkS(sR
        Returns whether a particular credentials interface is supported.
        N(tsupportedInterfacestNone(tselft	interface((s8/usr/lib/python2.7/dist-packages/twisted/cred/strcred.pytsupportsInterface scCs+x$|jD]}|j|ƒr
tSq
WtS(s‡
        Returns whether a checker factory will provide at least one of
        the credentials interfaces that we care about.
        (R
RtTruetFalse(RRR((s8/usr/lib/python2.7/dist-packages/twisted/cred/strcred.pytsupportsCheckerFactory¨scCság}|jdkr!|j}n3x0|jD]%}|j|ƒr+|j|ƒq+q+W|slt|jƒ‚nd|kr…i|d<nd|kržg|d<n|dj|ƒx+|D]#}|dj|gƒj|ƒq¶WdS(sM
        Supply a supplied credentials checker to the Options class.
        tcredInterfacestcredCheckersN(RRR
RtappendRt
setdefault(Rtcheckert	supportedR((s8/usr/lib/python2.7/dist-packages/twisted/cred/strcred.pyt
addChecker³s


cCsœy|jt|ƒƒWn~tk
rF}tjd|jdƒ‚nRtk
rr}tjd|jdƒ‚n&tk
r—}tjd|ƒ‚nXdS(sB
        Specify an authentication method for the server.
        sAuth plugin not supported: %sisAuth plugin not recognized: %ssUnexpected error: %sN(R)RRRt
UsageErrortargsRt	Exception(RRte((s8/usr/lib/python2.7/dist-packages/twisted/cred/strcred.pytopt_authËsccsDx=tƒD]2}x)|jD]}|j|ƒr|VPqqWq
WdS(sŒ
        Return a list of which authTypes will be displayed by --help-auth.
        This makes it a lot easier to test this module.
        N(RR
R(RRR((s8/usr/lib/python2.7/dist-packages/twisted/cred/strcred.pyt_checkerFactoriesForOptHelpAuthÛs
cCsý|jjdƒ|jjdƒ|jjdƒd}x;|jƒD]-}t|jƒ|krCt|jƒ}qCqCWd|}|jj|dƒ|jj|dƒx4|jƒD]&}|jj||j|jfƒq³W|jjdƒtdƒ‚d
S(
s<
        Show all authentication methods available.
        s#Usage: --auth AuthType[:ArgString]
s-For detailed help: --help-auth-type AuthType
s
is
  %%-%is	%%s
tAuthTypesArgString formats========s================N(R0sArgString format(s========s================(t
authOutputtwriteR/tlenR
Rt
SystemExit(RtfirstLengthRtformatString((s8/usr/lib/python2.7/dist-packages/twisted/cred/strcred.pyt
opt_help_authçs
	cCsyt|ƒ}Wn$tk
r6tjd|ƒ‚nX|jjd|ƒ|jjd|jƒ|jjdƒx7|jjƒj	ƒD] }|jjd|j
ƒƒqˆW|jjdƒ|j|ƒsò|jjdtƒ|jjdƒnt
dƒ‚dS(sA
        Show help for a particular authentication type.
        sInvalid auth type: %ssUsage: --auth %s[:ArgString]
sArgString format: %s
s
s  %s
iN(RRRR*R1R2RRtstript
splitlinestrstripR"tnotSupportedWarningR4(RR
tcftline((s8/usr/lib/python2.7/dist-packages/twisted/cred/strcred.pytopt_help_auth_typeýs
N(RRR	RRtsyststdoutR1RR"R)R.R/R7R>(((s8/usr/lib/python2.7/dist-packages/twisted/cred/strcred.pyRƒs							((R	R?tzope.interfaceRRttwisted.pluginRttwisted.pythonRRR,RRRRR;RRRR(((s8/usr/lib/python2.7/dist-packages/twisted/cred/strcred.pyt<module>s!