o
    b                     @   sX   d dl Z d dlmZmZmZmZmZ d dlmZm	Z	 G dd de	Z
G dd deZdS )    N)ColumnStringBooleanTextInteger)
TokenMixinAuthorizationCodeMixinc                   @   s   e Zd ZeeddddZeedZeeddZeeddZ	eeddZ
eeZeeddd	 d
ZeeZeedZdd Zdd Zdd Zdd Zdd ZdS )OAuth2AuthorizationCodeMixinx   TFuniquenullable0    defaultc                   C      t t S Ninttime r   r   m/var/www/secure340b-portal/env/lib/python3.10/site-packages/authlib/integrations/sqla_oauth2/tokens_mixins.py<lambda>       z%OAuth2AuthorizationCodeMixin.<lambda>r   r   c                 C   s   | j d t k S )Ni,  )	auth_timer   selfr   r   r   
is_expired   s   z'OAuth2AuthorizationCodeMixin.is_expiredc                 C      | j S r   )redirect_urir   r   r   r   get_redirect_uri      z-OAuth2AuthorizationCodeMixin.get_redirect_uric                 C   r    r   scoper   r   r   r   	get_scope   r#   z&OAuth2AuthorizationCodeMixin.get_scopec                 C   r    r   )r   r   r   r   r   get_auth_time!   r#   z*OAuth2AuthorizationCodeMixin.get_auth_timec                 C   r    r   )noncer   r   r   r   	get_nonce$   r#   z&OAuth2AuthorizationCodeMixin.get_nonceN)__name__
__module____qualname__r   r   code	client_idr   r!   Zresponse_typer%   r(   r   r   Zcode_challengeZcode_challenge_methodr   r"   r&   r'   r)   r   r   r   r   r	   	   s$    r	   c                   @   s   e Zd ZeedZeedZeeddddZeedddZee	dd	Z
eedd	Zeedd
d dZeedddZdd Zdd Zdd Zdd ZdS )OAuth2TokenMixinr   (      TFr   )indexr   r   c                   C   r   r   r   r   r   r   r   r   0   r   zOAuth2TokenMixin.<lambda>r   r   c                 C   r    r   )r.   r   r   r   r   get_client_id4   r#   zOAuth2TokenMixin.get_client_idc                 C   r    r   r$   r   r   r   r   r&   7   r#   zOAuth2TokenMixin.get_scopec                 C   r    r   )
expires_inr   r   r   r   get_expires_in:   r#   zOAuth2TokenMixin.get_expires_inc                 C   s   | j | j S r   )	issued_atr4   r   r   r   r   get_expires_at=   s   zOAuth2TokenMixin.get_expires_atN)r*   r+   r,   r   r   r.   
token_typeZaccess_tokenZrefresh_tokenr   r%   r   Zrevokedr   r6   r4   r3   r&   r5   r7   r   r   r   r   r/   (   s    
r/   )r   Z
sqlalchemyr   r   r   r   r   Zauthlib.oauth2.rfc6749r   r   r	   r/   r   r   r   r   <module>   s
    