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

Adding token authentication to Bitbucket server (Stash). 2017.2.x #35

Open
wants to merge 3 commits into
base: Indore-2017.2.x
Choose a base branch
from

Conversation

maksar
Copy link

@maksar maksar commented Dec 13, 2017

BitBucket 5.5 introduced personal user tokens authentication: https://confluence.atlassian.com/bitbucketserver/bitbucket-server-5-5-release-notes-938037662.html

I made changed to the Stash configuration similar to GitHub (dropdown with auth type selection). Preview: https://www.dropbox.com/s/8vbppp0rvx1jxrr/Screenshot%202017-10-27%2017.02.12.png?dl=0

@maksar maksar changed the title Adding token authentication to Bitbucket server (Stash). Adding token authentication to Bitbucket server (Stash). Indore-2017.2.x Dec 13, 2017
@maksar maksar changed the title Adding token authentication to Bitbucket server (Stash). Indore-2017.2.x Adding token authentication to Bitbucket server (Stash). 2017.2.x Dec 13, 2017
@dtretyakov dtretyakov removed their assignment Dec 14, 2017
@karanagai
Copy link
Contributor

karanagai commented Dec 21, 2017

Hi @maksar, thanks for submitting this feature and excuse me for not responding promptly. There is a number of issues with this PR though, mostly related to user/password authentication:

  • When StashPublisher::vote(String, String, String) calls postAsync it assumes there is a non-null token, which is not the case when user/password mode is chosen. It causes an NPE;

  • For existing configurations that do not have authentication type explicitly set, corresponding edit build feature form in the admin UI assumes the mode is token, does not show username and password fields with current values, but displays an empty token field. To address that with as little effort as possible you must make the username and password option first there, and then the token option;

  • By modifying CommitStatusPublisher.xml you have altered our Kotlin DSL syntax, introducing new compound authType property, but making old simple userName and password properties in existing configuration scripts invalid. To maintain backward compatibility with old DSL would you mind to add something like that just after the new compound property definition:

            <param name="stashUsername" dslName="userName" deprecated="true">
                <description>
                  A username for Bitbucket Server connection
                </description>
              </param>
              <param name="secure:stashPassword" dslName="password" deprecated="true">
                <description>
                  A password for Bitbucket Server connection
                </description>
              </param>
    

The important thing here is the deprecated attribute.

Thanks!

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.

3 participants