Jira: add SSL client certificate support for authentication (#9753)

* jira: add ssl client certificate support for authentification

* fix code bugs from first CI run

* fix fstring not compatible with older python and chhange urlopen module call

* removed duplicated post,put,get method

* fix urllib module detection Python2/ Python3

* edit HTTP Request back to fetch_url

* add changelog fragment

* fix python line spacing

* Update plugins/modules/jira.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update plugins/modules/jira.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* edit documentation certificate auth not mutually exclusive

* Update changelogs/fragments/9753-jira-add-client-certificate-auth.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

* edit documentation for client certificate auth and token

* add no_log for client_cert and client_key

* removed no_log for client_cert and client_key

---------

Co-authored-by: domin <domin@MacBookPro.fritz.box>
Co-authored-by: Felix Fontein <felix@fontein.de>
pull/9775/head
Dominik 2025-02-16 21:24:46 +01:00 committed by GitHub
parent b80fa80c90
commit fa7876bb40
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 34 additions and 0 deletions

View File

@ -0,0 +1,2 @@
minor_changes:
- jira - adds ``client_cert`` and ``client_key`` parameters for supporting client certificate authentification when connecting to Jira (https://github.com/ansible-collections/community.general/pull/9753).

View File

@ -59,6 +59,18 @@ options:
- The personal access token to log-in with.
- Mutually exclusive with O(username) and O(password).
version_added: 4.2.0
client_cert:
type: path
description:
- Client certificate if required.
- In addition to O(username) and O(password) or O(token). Not mutually exclusive.
version_added: 10.4.0
client_key:
type: path
description:
- Client certificate key if required.
- In addition to O(username) and O(password) or O(token). Not mutually exclusive.
version_added: 10.4.0
project:
type: str
@ -446,6 +458,23 @@ EXAMPLES = r"""
operation: attach
attachment:
filename: topsecretreport.xlsx
# Use username, password and client certificate authentification
- name: Create an issue
community.general.jira:
uri: '{{ server }}'
username: '{{ user }}'
password: '{{ pass }}'
client_cert: '{{ path/to/client-cert }}'
client_key: '{{ path/to/client-key }}'
# Use token and client certificate authentification
- name: Create an issue
community.general.jira:
uri: '{{ server }}'
token: '{{ token }}'
client_cert: '{{ path/to/client-cert }}'
client_key: '{{ path/to/client-key }}'
"""
import base64
@ -480,6 +509,8 @@ class JIRA(StateModuleHelper):
username=dict(type='str'),
password=dict(type='str', no_log=True),
token=dict(type='str', no_log=True),
client_cert=dict(type='path'),
client_key=dict(type='path'),
project=dict(type='str', ),
summary=dict(type='str', ),
description=dict(type='str', ),
@ -511,6 +542,7 @@ class JIRA(StateModuleHelper):
],
required_together=[
['username', 'password'],
['client_cert', 'client_key']
],
required_one_of=[
['username', 'token'],