HEX
Server: LiteSpeed
System: Linux kapuas.iixcp.rumahweb.net 5.14.0-427.42.1.el9_4.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Nov 1 14:58:02 EDT 2024 x86_64
User: mirz4654 (1666)
PHP: 8.1.33
Disabled: system,exec,escapeshellarg,escapeshellcmd,passthru,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,popen,pclose,dl,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setsid,posix_setuid,posix_setpgid,ini_alter,show_source,define_syslog_variables,symlink,syslog,openlog,openlog,closelog,ocinumcols,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dll,ftp,myshellexec,socket_bind,mail,posix_getwpuid
Upload Files
File: //usr/lib/python3.9/site-packages/ansible/galaxy/__pycache__/token.cpython-39.pyc
a

�)g�@s�ddlmZmZmZeZddlZddlZddlZddl	m
Z
mZddlm
ZddlmZddlmZmZmZddlmZmZddlmZdd	lmZe�ZGd
d�de�ZGdd
�d
e�ZGdd�de�Z Gdd�de�Z!dS)�)�absolute_import�division�print_functionN)�S_IRUSR�S_IWUSR)�	constants)�
user_agent)�to_bytes�	to_native�to_text)�	yaml_dump�	yaml_load)�open_url)�Displayc@seZdZdZdd�ZdS)�NoTokenSentinelze Represents an ansible.cfg server with not token defined (will ignore cmdline and GALAXY_TOKEN_PATH. cOs|S�N�)�cls�args�kwargsrr�8/usr/lib/python3.9/site-packages/ansible/galaxy/token.py�__new__)szNoTokenSentinel.__new__N)�__name__�
__module__�__qualname__�__doc__rrrrrr'src@s6eZdZdZdZd
dd�Zdd�Zd	d
�Zdd�ZdS)�
KeycloakTokenzpA token granted by a Keycloak server.

    Like sso.redhat.com as used by cloud.redhat.com
    ie Automation HubZBearerNTcCs2||_||_d|_||_||_|jdur.d|_dS)Nzcloud-services)�access_token�auth_url�_token�validate_certs�	client_id)�selfrrr r!rrr�__init__5s
zKeycloakToken.__init__cCsd|j|jfS)Nz6grant_type=refresh_token&client_id=%s&refresh_token=%s)r!r�r"rrr�
_form_payload>s�zKeycloakToken._form_payloadcCsX|jr|jS|��}tt|j�||jdt�d�}t�t	|�
�dd��}|�d�|_|jS)NZPOST)�datar �methodZ
http_agent�surrogate_or_strict��errorsr)rr%rr
rr r�json�loadsr�read�get)r"ZpayloadZrespr&rrrr.Bs

�zKeycloakToken.getcCsi}d|j|��f|d<|S�N�%s %sZ
Authorization��
token_typer.�r"�headersrrrr4_szKeycloakToken.headers)NNTN)	rrrrr2r#r%r.r4rrrrr-s
	rc@sReZdZdZdZddd�Zedd��Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�ZdS)�GalaxyTokenz4 Class to storing and retrieving local galaxy token �TokenNcCs ttjdd�|_d|_||_dS)Nr(r))r	�CZGALAXY_TOKEN_PATH�b_file�_configr�r"�tokenrrrr#jszGalaxyToken.__init__cCs:|jdur|��|_|jr4|jtur(dn|j|jd<|jS�Nr;)r9�_readrrr$rrr�configps


zGalaxyToken.configcCs�d}tj�|j�s8t|jd���t�|jttB�d}t|jd��}t	|�}Wd�n1sb0Yt
�d|t|j�f�|r�t
|t�s�t
�dt|j��iS|p�iS)NZOpened�wZCreated�rr0z1Galaxy token file %s malformed, unable to read it)�os�path�isfiler8�open�close�chmodrrr
�displayZvvvr�
isinstance�dict)r"�action�fr>rrrr={s&zGalaxyToken._readcCs||_|��dSr)r�saver:rrr�set�szGalaxyToken.setcCs|j�dd�Sr<)r>r.r$rrrr.�szGalaxyToken.getcCs@t|jd�� }t|j|dd�Wd�n1s20YdS)Nr?F)Zdefault_flow_style)rDr8rr>)r"rKrrrrL�szGalaxyToken.savecCs*i}|��}|r&d|j|��f|d<|Sr/)r.r2)r"r4r;rrrr4�s
zGalaxyToken.headers)N)
rrrrr2r#�propertyr>r=rMr.rLr4rrrrr5es


r5c@s6eZdZdZddd�Zedd��Zdd�Zd	d
�ZdS)�BasicAuthTokenZBasicNcCs||_||_d|_dSr)�username�passwordr)r"rPrQrrrr#�szBasicAuthToken.__init__cCs>dt|dd�t|ddd�pdf}t�t|ddd��}t|�S)	Nz%s:%sr(r)Zpassthru)r*Z	nonstring�zutf-8)�encodingr*)r�base64Z	b64encoder	)rPrQr;Zb64_valrrr�
_encode_token�s
�zBasicAuthToken._encode_tokencCs$|jr|jS|�|j|j�|_|jSr)rrUrPrQr$rrrr.�szBasicAuthToken.getcCsi}d|j|��f|d<|Sr/r1r3rrrr4�szBasicAuthToken.headers)N)	rrrr2r#�staticmethodrUr.r4rrrrrO�s

rO)"Z
__future__rrr�typeZ
__metaclass__rTrAr+�statrrZansiblerr7Zansible.galaxy.user_agentrZansible.module_utils._textr	r
rZ ansible.module_utils.common.yamlrr
Zansible.module_utils.urlsrZansible.utils.displayrrG�objectrrr5rOrrrr�<module>s 8<