403Webshell
Server IP : 209.205.66.10  /  Your IP : 216.73.216.173
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux ammon 5.15.0-186-generic #196-Ubuntu SMP Sat Jun 20 16:09:34 UTC 2026 x86_64
User :  ( 1006)
PHP Version : 8.5.8
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib/python3/dist-packages/macaroonbakery/checkers/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/macaroonbakery/checkers/__pycache__/_checkers.cpython-310.pyc
o

�6�\ �
@s*ddlZddlmZddlmZddlZddlmZddlmZm	Z	m
Z
mZmZm
Z
ddlmZddlmZdd	lmZdd
lmZddlmZGdd
�d
e�ZGdd�de�ZGdd�de�ZGdd�dedd��Zdd�Zdd�Zdd�Z dd�Z!dd�Z"d d!�Z#d"d#�Z$eee	eee ee!e
e"iZ%dS)$�N)�
namedtuple)�datetime�)�parse_caveat)�
COND_ALLOW�
COND_DECLARED�	COND_DENY�
COND_ERROR�COND_TIME_BEFORE�
STD_NAMESPACE)�DECLARED_KEY)�	Namespace)�OP_KEY)�TIME_KEY)�condition_with_prefixc@seZdZdZdS)�
RegisterErrorz<Raised when a condition cannot be registered with a Checker.N)�__name__�
__module__�__qualname__�__doc__�rr�C/usr/lib/python3/dist-packages/macaroonbakery/checkers/_checkers.pyrsrc@s,eZdZdZejZejdd��Zdd�Z	dS)�FirstPartyCaveatCheckerz�Used to check first party caveats for validity with respect to
    information in the provided context.

    If the caveat kind was not recognised, the checker should return
    ErrCaveatNotRecognized.
    cC�td��)z�	Checks that the given caveat condition is valid with respect to
        the given context information.
        :param ctx: an Auth context
        :param caveat a string
        z;check_first_party_caveat method must be defined in subclass��NotImplementedError)�self�ctx�caveatrrr�check_first_party_caveat&sz0FirstPartyCaveatChecker.check_first_party_caveatcCr)zC	Returns the namespace associated with the caveat checker.
        z,namespace method must be defined in subclassr�rrrr�	namespace0sz!FirstPartyCaveatChecker.namespaceN)
rrrr�abc�ABCMeta�
__metaclass__�abstractmethodrr!rrrrrs
	rc@sBeZdZdZddd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dS)�Checkerz6 Holds a set of checkers for first party caveats.
    NTcCs.|durt�}||_i|_|r|��dSdS�N)r
�
_namespace�	_checkers�register_std)rr!�include_std_checkersrrr�__init__;s�zChecker.__init__c
Cs�zt|�\}}Wnty#}zd�||jd�WYd}~Sd}~ww|j�|�}|dur3d�|�S|�|||�}|durDd�||�SdS)zz Checks the caveat against all registered caveat conditions.
        :return: error message string if any or None
        zcannot parse caveat "{}": {}rNz0caveat "{}" not satisfied: caveat not recognizedzcaveat "{}" not satisfied: {})r�
ValueError�format�argsr)�get�check)rr�cav�cond�arg�ex�checker�errrrrrCs����z Checker.check_first_party_caveatcCs|jS)z< Returns the namespace associated with the Checker.
        )r(r rrrr!UszChecker.namespacecCst|j��dd�d�S)z� Returns information on all the registered checkers.

        Sorted by namespace and then name
        :returns a list of CheckerInfo
        cSs|j|jfSr')�ns�name)�xrrr�<lambda>`szChecker.info.<locals>.<lambda>)�key)�sortedr)�valuesr rrr�infoZszChecker.infocCs�|durtd�||���|j�|�}|durtd�||���|dkr1|�d�dkr1td�||���t||�}|j�|�}|durJtd�|||j���t	||||d	�|j|<dS)
aF Registers the given condition(string) in the given namespace
        uri (string) to be checked with the given check function.
        The check function checks a caveat by passing an auth context, a cond
        parameter(string) that holds the caveat condition including any
        namespace prefix and an arg parameter(string) that hold any additional
        caveat argument text. It will return any error as string otherwise
        None.

        It will raise a ValueError if the namespace is not registered or
        if the condition has already been registered.
        NzKno check function registered for namespace {} when registering condition {}zCno prefix registered for namespace {} when registering condition {}��:rzLcaveat condition {} in namespace {} contains a colon but its prefix is emptyz@checker for {} (namespace {}) already registered in namespace {})r1r8r9�prefix)
rr.r(�resolve�findrr)r0r8�CheckerInfo)rr3�urir1rB�	full_condr?rrr�registerbs8���
��zChecker.registercCs.|j�td�tD]}|�|tt|�q	dS)z� Registers all the standard checkers in the given checker.

        If not present already, the standard checkers schema (STD_NAMESPACE) is
        added to the checker's namespace with an empty prefix.
        r@N)r(rHr�
_ALL_CHECKERS)rr3rrrr*�s�zChecker.register_std�NT)
rrrrr,rr!r?rHr*rrrrr&7s
'r&cs&eZdZdZdZd�fdd�	Z�ZS)rEz;CheckerInfo holds information on a registered checker.
    rNcstt|��|||||�S)a}
        :param check holds the actual checker function which takes an auth
        context and a condition and arg string as arguments.
        :param prefix holds the prefix for the checker condition as string.
        :param name holds the name of the checker condition as string.
        :param ns holds the namespace URI for the checker's schema as
        Namespace.
        )�superrE�__new__)�clsrBr9r8r1��	__class__rrrL�s	zCheckerInfo.__new__r')rrrr�	__slots__rL�
__classcell__rrrNrrE�srE�	CheckInfozprefix name ns checkcCsl|�t�}|durt��}n|��}ztj|dd�jdd�}||kr%WdSWdSty5d�|�YSw)NT)�utc)�tzinfozmacaroon has expiredzcannot parse "{}" as RFC 3339)	r0rr�utcnow�	pyrfc3339�parse�replacer-r.)rr3r4�clock�now�expiryrrr�_check_time_before�s

���r\cCsx|�dd�}t|�dkrdS|�ti�}|�|d�}|dur)d�|d|d�S||dkr:d�|d||d�SdS)N� r�zdeclared caveat has no valuerzgot {}=null, expected "{}"zgot {}="{}", expected "{}")�split�lenr0rr.)rr3r4�parts�attrs�valrrr�_check_declared�srdcCsdS)Nz
bad caveatr�rr3r4rrr�_check_error�srfcC�t|d|�SrJ��_check_operationsrerrr�_check_allow��rjcCrg)NFrhrerrr�_check_deny�rkrlcCsx|�tg�}t|�dkr#|r!|��}t|�dkrdSd�|d�SdS|��}|D]}t|||�}|dur9|Sq)dS)z� Checks an allow or a deny caveat. The need_ops parameter specifies
    whether we require all the operations in the caveat to be declared in
    the context.
    rzno operations allowed�{} not allowedN)r0rr`r_r.�	_check_op)r�need_opsr4�ctx_ops�f�fields�opr7rrrri�s�ricCs4d}|D]
}||krd}nq||krd�|�SdS)NFTrm)r.)�ctx_op�need_oprr�foundrsrrrrn�s�
rn)&r"�collectionsrrrV�_caveatr�_conditionsrrrr	r
r�	_declaredrr(r
�
_operationr�_timer�_utilsr�	Exceptionr�objectrr&rEr\rdrfrjrlrirnrIrrrr�<module>s8 ]�

Youez - 2016 - github.com/yon3zu
LinuXploit