accept objects, functions and promises for headers

Signed-off-by: Abhinav Rastogi <abhinav.rastogi@harness.io>
This commit is contained in:
Abhinav Rastogi
2022-12-12 16:29:35 +05:30
parent 6c9fbd1957
commit 0548ef8ed8
4 changed files with 115 additions and 49 deletions
+1 -26
View File
@@ -2,29 +2,4 @@
'@backstage/core-components': patch
---
Added option to pass additional headers to `<ProxiedSignInPage />`
The <ProxiedSignInPage /> supports signing into Backstage with a Sign Page coming from an external provider e.g. Google IAP, AWS ALB, etc. The component makes requests to a single endpoint `/refresh` on the auth backend to fetch the logged in user session.
If the provider in auth backend expects additional headers such as `x-provider-token`, there is now a way to configure that in `ProxiedSignInPage` using the optional `getHeaders` prop.
Example -
```tsx
const app = createApp({
// ...
components: {
SignInPage: props => (
<ProxiedSignInPage
{...props}
provider="my-custom-provider"
getHeaders={async () => {
const someValue = await someFn();
return { 'x-some-key': someValue };
}}
/>
),
},
// ...
});
```
Added option to pass additional headers to `<ProxiedSignInPage />`, which are passed along with the request to the underlying provider