Commit 2cca3d4
authored
Only allow one auth method on the server bindings (#589)
## 🎟️ Tracking
<!-- Paste the link to the Jira or GitHub issue or otherwise describe /
point to where this change is coming from. -->
## 📔 Objective
The server bindings template iterates over all auth methods of all the
servers and generates code for each of them. This means that if the
schema has two servers defined (like the US and EU servers) it will
generate code like this:
```rust
if let Some(ref token) = config.oauth_access_token {
request = request.bearer_auth(token.to_owned());
};
// This one is just duplicate
if let Some(ref token) = config.oauth_access_token {
request = request.bearer_auth(token.to_owned());
};
```
This won't break anything and is safe to do, but it's kind of wasteful.
Instead, we can just use the first auth method only.
The change doesn't have any effect on the bindings for the moment as
we're only ever defining one server and one auth method, but
bitwarden/server#6653 will add the US and EU
servers to the server API schema, which will result in the above shown
duplication.
## 🚨 Breaking Changes
<!-- Does this PR introduce any breaking changes? If so, please describe
the impact and migration path for clients.
If you're unsure, the automated TypeScript compatibility check will run
when you open/update this PR and provide feedback.
For breaking changes:
1. Describe what changed in the client interface
2. Explain why the change was necessary
3. Provide migration steps for client developers
4. Link to any paired client PRs if needed
Otherwise, you can remove this section. -->
## ⏰ 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 1 parent bf4f26f commit 2cca3d4
1 file changed
+2
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
353 | 353 | | |
354 | 354 | | |
355 | 355 | | |
| 356 | + | |
356 | 357 | | |
357 | 358 | | |
358 | 359 | | |
| |||
391 | 392 | | |
392 | 393 | | |
393 | 394 | | |
| 395 | + | |
394 | 396 | | |
395 | 397 | | |
396 | 398 | | |
| |||
0 commit comments