mk-5 / fjira

The golang fuzzy-find cli jira interface 🚀
GNU Affero General Public License v3.0
131 stars 3 forks source link

Support on-premise installations #48

Open jneidel opened 1 year ago

jneidel commented 1 year ago

Authentication via API token is only gonna work for cloud hosted instances. For supporting on-premise installations an Personal Access Token would need to be used. Ref Also see the SSO for auth edgecase ref

Describe the solution you'd like

Implement auth via PAT

mk-5 commented 1 year ago

@jneidel I will have a look! thanks for that issue! :)

mk-5 commented 1 year ago

just checked the docs - https://confluence.atlassian.com/enterprise/using-personal-access-tokens-1026032365.html - it looks pretty straightforward. Access tokens are used via Basic auth like Authroization: Basic base64(user:token) which fjira have in place at the moment.

Personal tokens are used via Bearer token auth. Authorization: Bearer <yourToken>

mk-5 commented 1 year ago

@jneidel it's coming https://github.com/mk-5/fjira/pull/49

jneidel commented 1 year ago

Cool 🚀 I've subscribed to the PR and will test it once it's done/merged :+1:

mk-5 commented 1 year ago

Cool 🚀 I've subscribed to the PR and will test it once it's done/merged 👍

@jneidel it's available in version 0.11.0 https://github.com/mk-5/fjira/releases/tag/0.11.0

CI failed because of chocolatey deployment - the first package version is still in review. / all should be fine except that one :)

jneidel commented 1 year ago

Login works :+1:

When opening a board and selecting an assignee to filter by I get 400 and 404 respectively.

And scrolling down with arrow and not vim keys is sacrilege :church:

mk-5 commented 1 year ago

@jneidel I will have a look .. 400, and 404 - I guess some api-version problems.

Which version of jira-server do you have? What do you mean by "vim keys"? 🤔

mk-5 commented 1 year ago

okay @jneidel I can also confirm that issue. I tried it with dockerized jira server version (https://hub.docker.com/r/atlassian/jira-software). The fix is on the way

mk-5 commented 1 year ago

fix ready in 0.11.2

jneidel commented 1 year ago

vim keys are the superior hjkl (j/k down/up, h/l left/right). They are widely supported in interactive cli apps. Interactive GNU apps (e.g. less), lf, ranger, newsboat, epr and the namesake vim come to mind right now but there are tons more. I also use them in the browser via a plugin.

They allow for much easier use from the home row (touch typing).

mk-5 commented 1 year ago

@jneidel mhmm, I have no problem with binding another keys as an "arrows" in parallel to arrows, but I would not say that arrows are sacrilege ⛪. I think it's quite problematic to use hjkl in fuzzy finder view - you can use letters h j k l in order to search for some results. IMO it's common practice to use arrows in tools like fzf or regrip or simillar 🤔

mk-5 commented 1 year ago

vim keys are the superior hjkl (j/k down/up, h/l left/right). They are widely supported in interactive cli apps. Interactive GNU apps (e.g. less), lf, ranger, newsboat, epr and the namesake vim come to mind right now but there are tons more. I also use them in the browser via a plugin.

They allow for much easier use from the home row (touch typing).

I'm fully with you - but I cannot see how it should work in a search view. You can use h j k l to type the search term, right?

jneidel commented 1 year ago

For fzf I have tab/shift-tab setup to go through the list, like that I don't need to leave the home row.

Yes, I agree, for the fuzzy finder view it does not make sense to use vim keys for scrolling. But there is the issue view which scrolls only with arrow and not vim keys. That's actually the one I meant, sorry for not being more specific :smile:

jneidel commented 1 year ago

Board view works as expected now! (vim keys would also work here)

I still get errors on:

mk-5 commented 1 year ago

Board view works as expected now! (vim keys would also work here)

I still get errors on:

  • 400: filter by assignee (in project view)
  • 404: assign user (in issue view)

okay, I'll have a look. I think it's similar issue to that one https://github.com/mk-5/fjira/issues/35 . For now .. I have no clue, but I guess it could be something similar to the previous issue. Jira Cloud accept project keys like 'ABC' or project id like 123. Jira Server doesn't like like it, and it needs to be numeric id.

About vim keys - I can adapt boards view to work with both arrows, and vim keys - it's not a problem

mk-5 commented 1 year ago

@jneidel I was not able to reproduce the first issue with 400 error, but I was able to reproduce the second issue with 404 - it should be fixed now. I'm using that simple docker setup to test it: https://github.com/mk-5/fjira/blob/master/scripts/docker-compose-jira-server.yml

You can test - the latest version 0.11.5

jneidel commented 1 year ago

Both errors are still present.

With assigning a user I get:

Screenshot 2023-09-11 at 11 42 30

And nothing changed on the issue.

mk-5 commented 1 year ago

@jneidel okay ... I think I found one small issue already / let's say "typo" 😅 image

there is missing return after error. This is why there is success message above error one. I will fix it right away - we will see at least what kind of error it is.

mk-5 commented 1 year ago

@jneidel okay / there is a new version 0.11.7. I've fixed that incorrect success message issue + I've extended error message a bit.- could be that it will be pretty wide. Would be awesome if you can try it again with new version.

I found that docs via google: https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issues/#api-rest-api-2-issue-issueidorkey-assignee-put

according to that documentation this is how do-assignment request looks like:

Request
curl \
   -D- \
   -u charlie:charlie \
   -X PUT \
   --data {see below} \
   -H "Content-Type: application/json" \
   http://localhost:8080/rest/api/2/issue/QA-31

Input data
{
   "fields": {
       "assignee":{"name":"charlie"}
   }
}

It's a bit different comparing it to the Jira Cloud: https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issues/#api-rest-api-2-issue-issueidorkey-assignee-put

curl --request PUT \
  --url 'https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}/assignee' \
  --user 'email@example.com:<api_token>' \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --data '{
  "accountId": "5b10ac8d82e05b22cc7d4ef5"
}'

fjira is sending accountId as an identifier. The weird thing is that I tried it with dockerized version .. and it was fine. Maybe it depends on Jira Version.

I think we will know more after the next fjira version test.

jneidel commented 1 year ago

Error! -Cannot assign user Jonathan Neidel to ticket ORFDV001-9592. Reason: Jira error, status: 400 - request: AccountId: is what I get as an error.

Our Jira Server version is v9.9.0

mk-5 commented 1 year ago

@jneidel all right - thanks! I will check that version. The weird thing is that AccountId is empty

mk-5 commented 1 year ago

@jneidel hurray! I reproduced that error using some jira server instance. The fix is on a way

mk-5 commented 1 year ago

@jneidel okay - assignment request for on-premise installation is fixed in version 0.11.8

jneidel commented 1 year ago

@jneidel okay - assignment request for on-premise installation is fixed in version 0.11.8

Can confirm that assigment works :+1: