Skip to content

Add the bearer authentication#313

Closed
marek-veber wants to merge 1 commit intoankitpokhrel:mainfrom
marek-veber:issue-312
Closed

Add the bearer authentication#313
marek-veber wants to merge 1 commit intoankitpokhrel:mainfrom
marek-veber:issue-312

Conversation

@marek-veber
Copy link
Contributor

Closes 312

@marek-veber marek-veber force-pushed the issue-312 branch 2 times, most recently from 9c591bc to ffe9be5 Compare February 23, 2022 21:48
@ankitpokhrel
Copy link
Owner

Hi @marek-veber, thank you for the PR. I added some comments.

Instead of asking for auth type from the UI, I think It might be better to introduce a new env JIRA_AUTH_TYPE which could specify what authentication method to use: bearer or basic (basic by default). Majority of the users seem to use basic auth and we could reduce one additional steps for them if we go with environment variable approach.

Also, we need to make sure this works for both cloud and on-premises jira server.

return nil
},
})
if !c.value.bearer {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we need similar logic for cloud server too?

Server string
Login string
APIToken string
Bearer *bool
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Enum types would be better for this usecase instead of a boolean flag. This will make it easy to introduce other auth types if needed.

type AuthType string

const (
	AuthTypeBasic  AuthType = "basic"
	AuthTypeBearer AuthType = "bearer"
)

And the config and client struct downstream can have AuthType field

@marek-veber
Copy link
Contributor Author

Thanks for your comments, I will implement the introduced changes.

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.

Implement bearer authentication with personal access tokens

2 participants