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

Allow import/export of session #398

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

guywithnose
Copy link
Contributor

Description

This adds two functions ImportSession and ExportSession. These functions allow you to cache authentication cookies so you don't have to reauthenticate as often. This is especially useful for CLI apps that don't include a long running process to hold the session. The session is exported as a json byte array, so it is very easy to store in just about any caching mechanism. I'll demonstrate Redis below.

Example:

session, err := redisClient.Get("jiraSession").Bytes()
if err != nil {
    _, err = jiraClient.Authentication.AcquireSessionCookie(jiraUsername, jiraPassword)
    if err != nil {
        return nil, err
    }

    session = jiraClient.Authentication.ExportSession()
    _ = redisClient.Set("jiraSession", session, time.Hour).Err()
} else {
    jiraClient.Authentication.ImportSession(session)
}

Checklist

@andygrunwald
Copy link
Owner

Hey @guywithnose,
thanks for your effort and this PR.
We, the maintainers, are right now quite packed with other work. Hence, the review of this pull request will take a while. Thanks for understanding.

@andygrunwald
Copy link
Owner

Hey,

I am very sorry that this pull request has been open for a long time with no final feedback or merge/decline. We work on this project in our spare time, and sometimes, other priorities take over. This is the typical open source dilemma.

However, there is news: We are kicking off v2 of this library 🚀

To provide visibility, we created the Road to v2 Milestone and calling for your feedback in #489

The development will take some time; however, I hope you can benefit from the changes.
If you seek priority development for your pull request + you like to sponsor it, please contact me.

What does this mean for my pull request?

We will work on this pull request indirectly.
We might merge it during the development or pull parts of it into the new version.
This means that during the development phase, we aim to tackle it.
Maybe in a different way like it is currently handled.
Please understand that this will take a while because we are running this in our spare time.

Final words

Thanks for using and contributing to this library.
If there is anything else you would like to tell us, let us know!

@github-actions github-actions bot added the conflicts Indicates merge conflicts label Sep 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
conflicts Indicates merge conflicts
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants