o
    O                     @   sN   d Z ddlZddlmZ ddlmZ ddlmZ dd ZG dd	 d	ejZdS )
z3Interface to handle end to end flow of U2F signing.    N)baseauthenticator)customauthenticator)localauthenticatorc                 C   s   t | t| g}t|S N)r   CustomAuthenticatorr   LocalAuthenticatorCompositeAuthenticator)originauthenticators r   H/tmp/google-cloud-sdk/lib/third_party/pyu2f/convenience/authenticator.pyCreateCompositeAuthenticator   s   r   c                   @   s0   e Zd ZdZdd ZejjfddZdd Z	dS )	r   zComposes multiple authenticators into a single authenticator.

  Priority is based on the order of the list initialized with the instance.
  c                 C   s
   || _ d S r   )r
   )selfr
   r   r   r   __init__$   s   
zCompositeAuthenticator.__init__c                 C   s2   | j D ]}| r||||}|  S qtd)See base class.zNo valid authenticators found)r
   IsAvailableAuthenticate
ValueError)r   app_idchallenge_dataprint_callbackauthenticatorresultr   r   r   r   '   s   
z#CompositeAuthenticator.Authenticatec                 C   s   dS )r   Tr   )r   r   r   r   r   3   s   z"CompositeAuthenticator.IsAvailableN)
__name__
__module____qualname____doc__r   sysstderrwriter   r   r   r   r   r   r      s    
r   )	r   r   pyu2f.conveniencer   r   r   r   BaseAuthenticatorr   r   r   r   r   <module>   s   