-
Notifications
You must be signed in to change notification settings - Fork 50
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
SM-1082: Add SM State to Go SDK Wrapper #559
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #559 +/- ##
=======================================
Coverage ? 57.76%
=======================================
Files ? 168
Lines ? 9912
Branches ? 0
=======================================
Hits ? 5726
Misses ? 4186
Partials ? 0 ☔ View full report in Codecov by Sentry. |
No New Or Fixed Issues Found |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should make sure to update the README.md in the Go folder to include the new parameter to AccessTokenLogin too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're missing a reference to the old AccessTokenLogin without statepath in the Readme:
Also it still has the old return type, while now it just returns an error, so we should change that too
Good call. I've updated the README and added a very small description regarding using |
// Configuring the statePath is optional, pass nil | ||
// in AccessTokenLogin() to not use state |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this comment is more descriptive.
// Configuring the statePath is optional, pass nil | |
// in AccessTokenLogin() to not use state | |
// Optional state file to persist access tokens between runs. |
@@ -36,10 +36,12 @@ bitwardenClient, _ := sdk.NewBitwardenClient(&apiURL, &identityURL) | |||
|
|||
### Login | |||
|
|||
To login using an access token: | |||
To login using an access token. Define some `statePath` and pass it to use state, or pass `nil` instead to not use state. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fairly cryptic, can we rewrite it to something like
Login using an access token, accepts an optional
statePath
which allows you to persist login sessions across multiple runs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Colton is out, I'm going to merge this PR now to get it in the hands of our vendor and and create a separate PR with these comment updates.
## 🎟️ Tracking <!-- Paste the link to the Jira or GitHub issue or otherwise describe / point to where this change is coming from. --> https://bitwarden.atlassian.net/browse/SM-1096 ## 📔 Objective <!-- Describe what the purpose of this PR is, for example what bug you're fixing or new feature you're adding. --> The naming around state files and paths is inconsistent. This PR aims to make the usage consistent. Every mention of state for access token auth should follow this naming logic: `state_dir` <- This refers to the state directory, where state files are stored. The sdk is currently only aware of state files, directory handling is still being done in bws. `state_file` <- This refers to a specific state file. In our code we don't append naming to variables to indicate the type (Hungarian Notation), so I thought it pertinent to truncate `_path` from these, preferring more descriptive `state_dir` and `state_file` for the names. Thanks @dani-garcia for pointing this out [here](#559 (comment)).⚠️ **Note**⚠️ This also simplifies the `state_file_dir` key in the `bws` config file to `state_dir`. There will be more changes to this functionality with SM-1174, so I will wait to update the changelog for the next bws version until all this is completed. ## ⏰ Reminders before review - Contributor guidelines followed - All formatters and local linters executed and passed - Written new unit and / or integration tests where applicable - Protected functional changes with optionality (feature flags) - Used internationalization (i18n) for all UI strings - CI builds passed - Communicated to DevOps any deployment requirements - Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team ## 🦮 Reviewer guidelines <!-- Suggested interactions but feel free to use (or not) as you desire! --> - 👍 (`:+1:`) or similar for great changes - 📝 (`:memo:`) or ℹ️ (`:information_source:`) for notes or general info - ❓ (`:question:`) for questions - 🤔 (`:thinking:`) or 💭 (`:thought_balloon:`) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion - 🎨 (`:art:`) for suggestions / improvements - ❌ (`:x:`) or⚠️ (`:warning:`) for more significant problems or concerns needing attention - 🌱 (`:seedling:`) or ♻️ (`:recycle:`) for future improvements or indications of technical debt - ⛏ (`:pick:`) for minor or nitpick changes
Type of change
Objective
Add the ability to easily use SM state in Go to the
bitwarden_client.go
.Code changes
statePath
parameterBefore you submit