- Notifications
You must be signed in to change notification settings - Fork 217
Set Access Control for HTTP Functions (v2) #935
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
Changes from 2 commits
601061a ffe16e5 734d6f0 c4fa3b4 4252a52 07f3c1d 97358a8 File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| | @@ -32,12 +32,18 @@ export type CallableRequest<T = any> = common.CallableRequest<T>; | |
| export type FunctionsErrorCode = common.FunctionsErrorCode; | ||
| export type HttpsError = common.HttpsError; | ||
| | ||
| /** | ||
| * Invoker access control type for https functions. | ||
| */ | ||
| export type Invoker = 'public' | 'private' | string; | ||
| | ||
| export interface HttpsOptions extends Omit<options.GlobalOptions, 'region'> { | ||
| region?: | ||
| | options.SupportedRegion | ||
| | string | ||
| | Array<options.SupportedRegion | string>; | ||
| cors?: string | boolean; | ||
| invoker?: Invoker | Invoker[]; | ||
| ||
| } | ||
| | ||
| export type HttpsFunction = (( | ||
| | @@ -81,6 +87,7 @@ export function onRequest( | |
| opts = optsOrHandler as HttpsOptions; | ||
| } | ||
| | ||
| const invoker = 'invoker' in opts ? opts.invoker : 'public'; | ||
| ||
| if ('cors' in opts) { | ||
| const userProvidedHandler = handler; | ||
| handler = (req: Request, res: express.Response) => { | ||
| | @@ -113,6 +120,7 @@ export function onRequest( | |
| httpsTrigger: { | ||
| allowInsecure: false, | ||
| }, | ||
| invoker, | ||
colerogers marked this conversation as resolved. Outdated Show resolved Hide resolved | ||
| }; | ||
| }, | ||
| }); | ||
| | ||
Uh oh!
There was an error while loading. Please reload this page.