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

feat: added support for personal-access-tokens #422

Merged
merged 3 commits into from Dec 21, 2021

Conversation

evilnerd
Copy link
Contributor

@evilnerd evilnerd commented Nov 23, 2021

  • added a new PATAuthTransport type that has a 'Token' attribute to hold your unique PAT
  • setting the Authorization header with the bearer token in the RoundTrip function.
  • added test to prove to the token gets passed via the header
  • bonus: fixed typo in existing test name

Resolves #421

Description

This PR adds support for authentication using Personal Access Tokens on Jira Data Center.

Information that is useful here:

  • The What: It adds a new PATAuthTransport type which can be used to create a client that uses PATs to authenticate.
  • The Why: Using PATs make it easier to run jobs on Jira automatically, without having to maintain usernames/passwords to get access to the on-premise Jira.
  • Type of change: New feature
  • Breaking change: No
  • Related to an issue: This PR fixes issue 421
  • Jira Version + Type: Jira DataCenter v8.20.1

Example:

// Create transport using the PersonalAccessToken specified in the password.
tp := client.PATAuthTransport {
		Token: password,
		Transport: &http.Transport{
			TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
		},
	}

// Open the connection to Jira
jiraClient, err := jira.NewClient(tp.Client(), url)

Checklist

@evilnerd evilnerd changed the title feat: added support for personal-access-tokens draft: feat: added support for personal-access-tokens Nov 23, 2021
- added a new PATAuthTransport type that has a 'Token' attribute to hold your unique PAT
- setting the Authorization header with the bearer token in the RoundTrip function.
- added test to prove to the token gets passed via the header
- bonus: fixed typo in existing test name
@evilnerd evilnerd changed the title draft: feat: added support for personal-access-tokens feat: added support for personal-access-tokens Nov 23, 2021
jira.go Show resolved Hide resolved
@benjivesterby benjivesterby merged commit 92a5749 into andygrunwald:master Dec 21, 2021
@evilnerd evilnerd deleted the feature/421 branch December 21, 2021 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for authenticating with Personal Access Tokens on Jira Data Center
2 participants