pycontribs / jenkinsapi

A Python API for accessing resources and configuring Hudson & Jenkins continuous-integration servers
http://pypi.python.org/pypi/jenkinsapi
MIT License
857 stars 485 forks source link

Auth when password has special characters fails. #862

Open joelandersen89 opened 3 months ago

joelandersen89 commented 3 months ago
ISSUE TYPE
Jenkinsapi VERSION

All

Jenkins VERSION

All

SUMMARY

Auth to Jenkins fails when password has special characters. Example: server = Jenkins(instance_endpoint, username="testuser", password="zzzzzz6@Y74(K.xxxxxxx", timeout=10)

EXPECTED RESULTS

Authentication works regardless of special charters or a way to pass base64 encoded auth to work around.

ACTUAL RESULTS

401 is thrown " Failed request at https://jenkins-endpointapi/python with params: {'tree': 'jobs[name,color,url]'} jobs[name,color,url] Failed to auth Failed to log into instance with error 401 Client Error: Unauthorized for url: https://jenkins-endpoint/api/python?tree=jobs%5Bname%2Ccolor%2Curl%5D "

USEFUL INFORMATION

The above example shows how to reproduce.

username="testuser",
password="zzzzzz6@Y74(K.xxxxxxx"
            try:
                print("Connecting")
                server = Jenkins(instance_endpoint, username=user_jaas, password=pass_jaas, timeout=10)
            except Exception as e:
                print("Failed to auth")
                print("Failed to log into instance %s with error %s" % (instance, e))