Ϫf dZddlZddlmZmZmZddlmZmZddl m Z ddl m Z GddeZ Gd d eZGd d eZGd deZGddeZdZdZdZdZGddZy)z Support for resolving command-line strings that represent different checkers available to cred. Examples: - passwd:/etc/passwd - memory:admin:asdf:user:lkj - unix N)OptionalSequenceType) Attribute Interface) getPlugins)usagecVeZdZdZedZedZedZedZdZ y)ICheckerFactoryz A factory for objects which provide L{twisted.cred.checkers.ICredentialsChecker}. It's implemented by twistd plugins creating checkers. z0A tag that identifies the authentication method.zmA detailed (potentially multi-line) description of precisely what functionality this CheckerFactory provides.z=A short (one-line) description of the argument string format.z@A list of credentials interfaces that this factory will support.cy)z} Return an L{twisted.cred.checkers.ICredentialsChecker} provider using the supplied argument string. N) argstrings 6/usr/lib/python3/dist-packages/twisted/cred/strcred.pygenerateCheckerzICheckerFactory.generateChecker2sN) __name__ __module__ __qualname____doc__rauthTypeauthHelpargStringFormatcredentialInterfacesrr rrr r sGKLH ;H  GO%J rr ceZdZdZy)StrcredExceptionz+ Base exception class for strcred. Nrrrrr rrrr9srrceZdZdZy)InvalidAuthTypezv Raised when a user provides an invalid identifier for the authentication plugin (known as the authType). Nrr rrrr?rrceZdZdZy)InvalidAuthArgumentStringzl Raised by an authentication plugin when the argument string provided is formatted incorrectly. Nrr rrr!r!Frrr!ceZdZdZy)UnsupportedInterfacesz Raised when an application is given a checker to use that does not provide any of the application's supported credentials interfaces. Nrr rrr#r#Mrrr#z|jduxs||jvS)zR Returns whether a particular credentials interface is supported. N)r2)self interfaces rsupportsInterfacez!AuthOptionMixin.supportsInterfaces%''4/X9@X@X3XXrcL|jD]}|j|syy)z Returns whether a checker factory will provide at least one of the credentials interfaces that we care about. TF)rr6r4r'r5s rsupportsCheckerFactoryz&AuthOptionMixin.supportsCheckerFactorys/ !55 I%%i0 rcrg}|j |j}n4|jD]%}|j|s|j|'|st |jd|vri|d<d|vrg|d<|dj||D]&}|dj |gj|(y)zM Supply a supplied credentials checker to the Options class. NcredInterfaces credCheckers)r2rr6appendr# setdefault)r4checker supportedr5s r addCheckerzAuthOptionMixin.addCheckers   # # +44I$99 0 )))4$$Y/ 0'(D(DE E 4 '%'D! "  %#%D  ^##G," MI ! " - -i < C CG L MrcP |jt|y#t$r*}tjd|j dzd}~wt $r*}tjd|j dzd}~wt$r}tjd|zd}~wwxYw)zB Specify an authentication method for the server. zAuth plugin not supported: %srNzAuth plugin not recognized: %szUnexpected error: %s)rAr/r#r UsageErrorargsr Exception)r4r.es ropt_authzAuthOptionMixin.opt_auths ? OOK 4 5$ P""#BQVVAY#NO O Q""#CaffQi#OP P ?""#9A#=> > ?s, B%%A  B%%A<< B%B  B%c#zKtD]*}|jD]}|j|s|*,yw)z Return a list of which authTypes will be displayed by --help-auth. This makes it a lot easier to test this module. N)r%rr6r8s r_checkerFactoriesForOptHelpAuthz/AuthOptionMixin._checkerFactoriesForOptHelpAuthsE ,- G$99  )))4!M  s.; ;c|jjd|jjd|jjdd}|jD]0}t|j|kDst|j}2d|z}|jj|dz|jj|dz|jD]6}|jj||j|j fz8|jjdt d)z< Show all authentication methods available. z#Usage: --auth AuthType[:ArgString] z-For detailed help: --help-auth-type AuthType  rz %%-%is %%s )AuthTypezArgString format)z========z================) authOutputwriterIlenrr SystemExit)r4 firstLengthr' formatStrings r opt_help_authzAuthOptionMixin.opt_help_auths DE NO d# ;;= 4G7##${2!'"2"23  4);6  l-MMN l-MMN;;= G OO ! ! 0 0'2I2IJJ   d#mrc t|}|jj d|z|jj d|j z|jj d|jjjD].}|jj d|jz0|jj d|j|s=|jj dtz|jj dtd#t$rtjd|zwxYw)zA Show help for a particular authentication type. zInvalid auth type: %szUsage: --auth %s[:ArgString] zArgString format: %s rKz %s r)r(rr rCrMrNrrstrip splitlinesrstripr9notSupportedWarningrP)r4rcflines ropt_help_auth_typez"AuthOptionMixin.opt_help_auth_types G#H-B >IJ 69K9KKL d#KK%%'224 rcs ++/%  i <y & 0,X'$ CBBr