diff --git a/packages/bruno-app/src/components/RequestPane/Auth/AuthMode/index.js b/packages/bruno-app/src/components/RequestPane/Auth/AuthMode/index.js index 8eb4fee90..aa25ebfef 100644 --- a/packages/bruno-app/src/components/RequestPane/Auth/AuthMode/index.js +++ b/packages/bruno-app/src/components/RequestPane/Auth/AuthMode/index.js @@ -35,6 +35,15 @@ const AuthMode = ({ item, collection }) => {
} placement="bottom-end"> +
{ + dropdownTippyRef.current.hide(); + onModeChange('inherit'); + }} + > + Inherit +
{ diff --git a/packages/bruno-app/src/components/RequestPane/Auth/StyledWrapper.js b/packages/bruno-app/src/components/RequestPane/Auth/StyledWrapper.js index e49220854..e1283ea42 100644 --- a/packages/bruno-app/src/components/RequestPane/Auth/StyledWrapper.js +++ b/packages/bruno-app/src/components/RequestPane/Auth/StyledWrapper.js @@ -1,5 +1,11 @@ import styled from 'styled-components'; -const Wrapper = styled.div``; +const Wrapper = styled.div` + .inherit-mode-text { + color: ${(props) => props.theme.colors.text.yellow}; + } + .inherit-mode-label { + } +`; export default Wrapper; diff --git a/packages/bruno-app/src/components/RequestPane/Auth/index.js b/packages/bruno-app/src/components/RequestPane/Auth/index.js index bd388737e..b13c6b097 100644 --- a/packages/bruno-app/src/components/RequestPane/Auth/index.js +++ b/packages/bruno-app/src/components/RequestPane/Auth/index.js @@ -6,10 +6,14 @@ import BearerAuth from './BearerAuth'; import BasicAuth from './BasicAuth'; import DigestAuth from './DigestAuth'; import StyledWrapper from './StyledWrapper'; +import { humanizeRequestAuthMode } from 'utils/collections/index'; const Auth = ({ item, collection }) => { const authMode = item.draft ? get(item, 'draft.request.auth.mode') : get(item, 'request.auth.mode'); + const collectionRoot = get(collection, 'root', {}); + const collectionAuth = get(collectionRoot, 'request.auth'); + const getAuthView = () => { switch (authMode) { case 'awsv4': { @@ -24,6 +28,14 @@ const Auth = ({ item, collection }) => { case 'digest': { return ; } + case 'inherit': { + return ( +
+
Auth inherited from the Collection:
+
{humanizeRequestAuthMode(collectionAuth?.mode)}
+
+ ); + } } }; diff --git a/packages/bruno-app/src/utils/collections/index.js b/packages/bruno-app/src/utils/collections/index.js index 216d74a4d..92f85a099 100644 --- a/packages/bruno-app/src/utils/collections/index.js +++ b/packages/bruno-app/src/utils/collections/index.js @@ -489,6 +489,10 @@ export const humanizeRequestBodyMode = (mode) => { export const humanizeRequestAuthMode = (mode) => { let label = 'No Auth'; switch (mode) { + case 'inherit': { + label = 'Inherit'; + break; + } case 'awsv4': { label = 'AWS Sig V4'; break; diff --git a/packages/bruno-cli/src/runner/prepare-request.js b/packages/bruno-cli/src/runner/prepare-request.js index 65405eced..3a45575e5 100644 --- a/packages/bruno-cli/src/runner/prepare-request.js +++ b/packages/bruno-cli/src/runner/prepare-request.js @@ -36,7 +36,7 @@ const prepareRequest = (request, collectionRoot) => { // But it cannot override the collection auth with no auth // We will provide support for disabling the auth via scripting in the future const collectionAuth = get(collectionRoot, 'request.auth'); - if (collectionAuth) { + if (collectionAuth && request.auth.mode == 'inherit') { if (collectionAuth.mode === 'basic') { axiosRequest.auth = { username: get(collectionAuth, 'basic.username'), diff --git a/packages/bruno-electron/src/ipc/network/prepare-request.js b/packages/bruno-electron/src/ipc/network/prepare-request.js index d793ad938..2fe7df4f3 100644 --- a/packages/bruno-electron/src/ipc/network/prepare-request.js +++ b/packages/bruno-electron/src/ipc/network/prepare-request.js @@ -35,7 +35,7 @@ const parseFormData = (datas, collectionPath) => { // We will provide support for disabling the auth via scripting in the future const setAuthHeaders = (axiosRequest, request, collectionRoot) => { const collectionAuth = get(collectionRoot, 'request.auth'); - if (collectionAuth) { + if (collectionAuth && request.auth.mode == 'inherit') { switch (collectionAuth.mode) { case 'awsv4': axiosRequest.awsv4config = { diff --git a/packages/bruno-schema/src/collections/index.js b/packages/bruno-schema/src/collections/index.js index 5f7dc1237..cabb76eaf 100644 --- a/packages/bruno-schema/src/collections/index.js +++ b/packages/bruno-schema/src/collections/index.js @@ -120,7 +120,7 @@ const authDigestSchema = Yup.object({ .strict(); const authSchema = Yup.object({ - mode: Yup.string().oneOf(['none', 'awsv4', 'basic', 'bearer', 'digest']).required('mode is required'), + mode: Yup.string().oneOf(['inherit', 'none', 'awsv4', 'basic', 'bearer', 'digest']).required('mode is required'), awsv4: authAwsV4Schema.nullable(), basic: authBasicSchema.nullable(), bearer: authBearerSchema.nullable(),