Skip to content

Commit 108878c

Browse files
DerekTBrownclaude
andcommitted
Add OAuth 1.0 authentication support with CLI integration tests
This commit implements complete OAuth 1.0 (RFC 5849) authentication support for Bruno, bringing it to feature parity with OAuth 2.0 implementation. Features implemented: - OAuth 1.0 signature methods: HMAC-SHA1, HMAC-SHA256, HMAC-SHA512, RSA-SHA256, PLAINTEXT - Parameter transmission modes: authorization header, query params, request body - 2-legged OAuth (consumer credentials only) - 3-legged OAuth (full authorization flow with request tokens, authorization, and access tokens) - OAuth 1.0 credential management and storage - Variable interpolation for all OAuth 1.0 configuration fields Core implementation: - packages/bruno-requests/src/auth/oauth1-helper.ts: OAuth 1.0 signing and token management - packages/bruno-cli/src/runner/run-single-request.js: CLI OAuth 1.0 signing integration - packages/bruno-cli/src/runner/interpolate-vars.js: OAuth 1.0 variable interpolation - packages/bruno-cli/src/runner/prepare-request.js: OAuth 1.0 request preparation - packages/bruno-electron/src/ipc/network/prepare-request.js: Electron OAuth 1.0 support - packages/bruno-app/src/components/RequestPane/Auth/OAuth1/: UI components for OAuth 1.0 configuration Test infrastructure: - packages/bruno-tests/src/auth/oauth1/: OAuth 1.0 test server with signature validation - utils.js: Signature validation for all methods and parameter transmission modes - twoLegged.js: 2-legged OAuth endpoints - threeLegged.js: 3-legged OAuth authorization flow endpoints - packages/bruno-tests/collection_oauth1/: 8 integration test files - 2-legged tests for all signature methods and transmission modes - 3-legged full authorization flow test - packages/bruno-tests/collection_level_oauth1/: Collection-level OAuth 1.0 configuration tests - packages/bruno-requests/src/auth/oauth1-helper.spec.ts: Unit tests for OAuth 1.0 helper Parser and converter support: - packages/bruno-lang/v2/: .bru file format support for OAuth 1.0 auth blocks - packages/bruno-converters/: Postman OAuth 1.0 import support Documentation: - Updated bruno-tests README with OAuth 1.0 test documentation Bug fixes: - Fixed OAuth 1.0 HMAC algorithm bug (shasha1 -> sha1) - Fixed oauth_callback parameter handling for 3-legged flow - Added OAuth 1.0 callback URL support to signature generation Test results: All 7 integration tests passing (100% success rate) - 6 two-legged OAuth tests (various signature methods and transmission modes) - 1 three-legged OAuth flow test (complete authorization flow) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent f3cb0d4 commit 108878c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+4697
-115
lines changed

package-lock.json

Lines changed: 93 additions & 96 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/bruno-app/src/components/RequestPane/Auth/AuthMode/index.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,15 @@ const AuthMode = ({ item, collection }) => {
8888
>
8989
OAuth 2.0
9090
</div>
91+
<div
92+
className="dropdown-item"
93+
onClick={() => {
94+
dropdownTippyRef?.current?.hide();
95+
onModeChange('oauth1');
96+
}}
97+
>
98+
OAuth 1.0
99+
</div>
91100
<div
92101
className="dropdown-item"
93102
onClick={() => {
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
import styled from 'styled-components';
2+
3+
const StyledWrapper = styled.div`
4+
label {
5+
font-size: 0.8125rem;
6+
font-weight: 600;
7+
}
8+
9+
.single-line-editor-wrapper {
10+
padding: 0.15rem 0.4rem;
11+
border-radius: 3px;
12+
border: solid 1px ${(props) => props.theme.input.border};
13+
background-color: ${(props) => props.theme.input.bg};
14+
15+
&.is-secret input {
16+
-webkit-text-security: disc;
17+
}
18+
19+
&:focus-within {
20+
border: solid 1px ${(props) => props.theme.input.focusBorder} !important;
21+
}
22+
}
23+
24+
.signature-method-selector,
25+
.parameter-transmission-selector {
26+
display: flex;
27+
align-items: center;
28+
justify-content: space-between;
29+
padding: 0.5rem 0;
30+
31+
label {
32+
flex: 1;
33+
}
34+
35+
.dropdown {
36+
width: 250px;
37+
}
38+
}
39+
40+
.get-access-token-btn {
41+
margin-top: 1rem;
42+
}
43+
44+
.token-display {
45+
margin-top: 1rem;
46+
padding: 0.75rem;
47+
background-color: ${(props) => props.theme.bg};
48+
border: 1px solid ${(props) => props.theme.input.border};
49+
border-radius: 3px;
50+
font-family: monospace;
51+
font-size: 0.8125rem;
52+
53+
.token-label {
54+
font-weight: 600;
55+
margin-bottom: 0.25rem;
56+
}
57+
58+
.token-value {
59+
word-break: break-all;
60+
color: ${(props) => props.theme.colors.text.muted};
61+
}
62+
}
63+
64+
.help-text {
65+
font-size: 0.75rem;
66+
color: ${(props) => props.theme.colors.text.muted};
67+
margin-top: 0.25rem;
68+
}
69+
`;
70+
71+
export default StyledWrapper;

0 commit comments

Comments
 (0)