o
    PDi1                     @   s   d dl Z d dlZd dlZd dlZd dlZddlmZ ddlm	Z	m
Z
 dd Ze
de dd	 Ze
d
e e
de dd Ze	de dS )    N   )errors)register_password_typeregister_protocolc                 C   s   | d}|dk r|}d}n|d| }tj||d d }|d}|dur-|d }tj|sF|jdu r>t	
t	j tj|j|}tt|}|durU|| }|| dS )a  
    Hook for "config-file://". The protocol_arg is expected to be the name of a
    file containing one or more configurations. An optional "key" parameter is
    allowed which will choose a configuration from a set of configurations
    stored in the file.
    ?r   Nr   key)findurllibparseparse_qsgetospathisabs
config_dirr   
_raise_errERR_NO_CONFIG_DIRjoinjsonloadopenset_from_config)protocolprotocol_argconnect_paramspos	file_namer   argsconfig r   O/var/www/Datamplify/venv/lib/python3.10/site-packages/oracledb/builtin_hooks.pyconfig_provider_file_hook)   s"   


r!   zconfig-filec                 C   s   d}d| }t |)a  
    Default hook for LDAP which simply points the user to the documentation
    which explains how they can write their own hook for LDAP.
    This hook is needed for python-oracledb Thin mode,or when
    defaults.thick_mode_dsn_passthrough is False in Thick mode.
    zjhttps://python-oracledb.readthedocs.io/en/latest/user_guide/connection_handling.html#ldap-directory-namingzXTo use an LDAP URL in python-oracledb, register an LDAP resolution function as shown in )	Exception)r   argparamsdoc_urlmessager   r   r    	ldap_hookG   s   r'   ldapldapsc                 C   s    t d t| d   S )z~
    Hook for password type "base64". The key "value" in the supplied args is
    expected to be a base64-encoded string.
    z%base64 encoded passwords are insecurevalue)warningswarnbase64	b64decodeencodedecode)r   r   r   r    password_type_base64_hook]   s   
r1   r-   )r-   r   r   urllib.parser	   r+    r   utilsr   r   r!   r'   r1   r   r   r   r    <module>   s   


	