Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jira server log in not work with a Token #11383

Open
1 of 3 tasks
sasirven opened this issue Dec 6, 2024 · 0 comments
Open
1 of 3 tasks

Jira server log in not work with a Token #11383

sasirven opened this issue Dec 6, 2024 · 0 comments
Labels

Comments

@sasirven
Copy link

sasirven commented Dec 6, 2024

Be informative
We are unable to log in through JIRA with a Token.

Bug description
Because the Username is mandatory and you only use basic auth in the jira connect method:

def connect_to_jira(jira_server, jira_username, jira_password):
    return JIRA(
        server=jira_server,
        basic_auth=(jira_username, jira_password),
        max_retries=0,
        options={
            "verify": settings.JIRA_SSL_VERIFY,
            "headers": settings.ADDITIONAL_HEADERS,
        })

We are unable to log in through Token.

Steps to reproduce
Steps to reproduce the behavior:

  1. Go to 'Config / Jira'
  2. Click on 'Add Jira Instance (Advanced)'
  3. Fill in 'all the needed information (put TOKEN in the password field)'
  4. Click on 'Submit'
  5. See error

Expected behavior
The connection to JIRA should work.

Deployment method (select with an X)

  • Docker Compose
  • Kubernetes
  • GoDojo

Environment information

  • DefectDojo version: 2.40.3

Additional context (optional)
For me, I see two solutions:

  1. Do not make the Username mandatory and if only the password is filled, use the token for JIRA connection instead of Basic auth.
  2. Add a third field named Token and if it's filled, ignore the username and Basic auth and use Token auth.

How to connect to JIRA with token (with the second solution):

def connect_to_jira(jira_server, jira_username, jira_password, jira_token):
    if jira_token:
        return JIRA(
            server=jira_server,
            token_auth=jira_token,
            max_retries=0,
            options={
                "verify": settings.JIRA_SSL_VERIFY,
                "headers": settings.ADDITIONAL_HEADERS,
            })
    
    return JIRA(
        server=jira_server,
        basic_auth=(jira_username, jira_password),
        max_retries=0,
        options={
            "verify": settings.JIRA_SSL_VERIFY,
            "headers": settings.ADDITIONAL_HEADERS,
        })
@sasirven sasirven added the bug label Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant