jira-cli
jira-cli copied to clipboard
Add cookie-based authentication support
What does this PR solve?
Adds cookie-based authentication (auth_type: cookie) for on-premise Jira installations that use SSO, reverse proxy, or client certificate authentication.
This is useful when:
- Your Jira is behind an enterprise proxy that handles authentication (e.g., with YubiKey/smart card)
- You authenticate via SSO/certificates and get a session cookie
- Basic auth or PAT aren't available options
Changes:
- Add
AuthTypeCookieconstant topkg/jira/types.go - Add JSESSIONID cookie handling in
pkg/jira/client.go - Add
cookieoption to auth type selection in config generator - Add
configureCookie()function that validates and stores session cookie in keychain - Add
jira refreshcommand for easy session cookie renewal (no need to re-run fulljira init) - Update README with cookie auth documentation
How to test?
- Run
jira initand select "Local" installation - Select "cookie" as authentication type
- Enter your Jira server URL
- Sign in to Jira in browser (via SSO/certificate)
- Copy JSESSIONID cookie from browser DevTools
- Paste when prompted - cookie is validated and stored in keychain
- Use CLI normally. When session expires, run
jira refresh
Checklist
- [x] I have added/updated enough tests related to my changes.
- [x] I have also manually checked and verified that my changes fix the issue and doesn't break any other functionalities.
- [x] My changes are backwards compatible.
Note: I noticed #870 also adds cookie support. My PR was developed independently for a different use case, but there's overlap.
Key differences in this PR:
- Focused on on-premise installations with SSO/reverse proxy/client certificate auth (where the browser handles auth and you get a session cookie)
- Adds
jira refreshcommand for easy cookie renewal without re-running fulljira init - Validates the cookie via
/myselfendpoint before storing - Stores cookie securely in system keychain
- Includes README documentation
Happy to coordinate with @johanneslarsson or defer to maintainer preference on how to proceed. The implementations could potentially be merged or one chosen over the other.