Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,6 @@ The package for Azure Functions V3+ In-Proc mode is now called `DarkLoop.Azure.F

- #### Remove Functions bult-in JwtBearer configuration by default
Azure Functions recently [added configuration](https://github.com/Azure/azure-functions-host/pull/9678) for issuer and audience validation for the default authentication flows, not the one supported by this package through `FunctionAuthorizeAttribute`, which interferes with token validation when using our own Bearer scheme token configuration.
In prior versions, this package has functionality to clear Functions built-in configuration, but it was not enabled by default when using `AddJwtBearer(Action<JwtBearerOptions> configure, bool removeBuiltInConfig = false)`. Since the use of this package is commonly used for custom JWT token, the default value of `removeBuiltInConfig` is now `true`.
In prior versions, this package has functionality to clear Functions built-in configuration, but it was not enabled by default when using `AddJwtBearer(Action<JwtBearerOptions> configure, bool removeBuiltInConfig = false)`. Since the use of this package is commonly used for custom JWT token, the default value of `removeBuiltInConfig` is now `true`.
> This functionality is now deprecated and no longer supported starting in version 4.1.0. It will be removed in future versions.
> Bearer scheme is now used by the Functions runtime and another one should be used for your functions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ Extension bringing AuthorizeAttribute Behavior to Azure Functions In-Proc and Is

It hooks into .NET Core dependency injection container to enable authentication and authorization in the same way ASP.NET Core does.

> **Breaking for current package consumers** <br/>
> Starting with version 4.1.0, due to security changes made on the Functions runtime, the Bearer scheme is no longer supported for your app functions.<br/>
> Use `AddJwtFunctionsBearer(Action<JwtBearerOptions>)` instead of `AddJwtBearer(Action<JwtBearerOptions>)` when setting up authentication.
Using `AddJwtBearer` will generate a compilation error when used against `FunctionsAuthenticationBuilder`.
We are introducing `JwtFunctionsBearerDefaults` to refer to the suggested new custom scheme name.<br/>
No changes should be required if already using a custom scheme name.<br/>
> Refer to respective README documentation for isolated and in-process for more information.

## Getting Started
- [Azure Functions V3+ In-Proc mode](./src/in-proc/README.md)
- [Azure Functions V4 Isolated mode with ASPNET Core integration](./src/isolated/README.md)
Expand Down
10 changes: 9 additions & 1 deletion src/in-proc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ Bringing AuthorizeAttribute Behavior to Azure Functions v3 and v4 (In-Process)

It hooks into .NET Core dependency injection container to enable authentication and authorization in the same way ASP.NET Core does.

> **Breaking for current package consumers** <br/>
> Starting with version 4.1.0, due to security changes made on the Functions runtime, the Bearer scheme is no longer supported for your app functions.<br/>
> Use `AddJwtFunctionsBearer(Action<JwtBearerOptions>)` instead of `AddJwtBearer(Action<JwtBearerOptions>)` when setting up authentication.
Using `AddJwtBearer` will generate a compilation error when used against `FunctionsAuthenticationBuilder`.
We are introducing `JwtFunctionsBearerDefaults` to refer to the suggested new custom scheme name.<br/>
No changes should be required if already using a custom scheme name.

## Using the package
### Installing the package
`dotnet add package DarkLoop.Azure.Functions.Authorize`
Expand Down Expand Up @@ -31,7 +38,8 @@ namespace MyFunctionAppNamespace
options.ClientId = "<my-client-id>";
// ... more options here
})
// This is important as Bearer scheme is used by the platform
// This is important as Bearer scheme is used by the runtime
// and no longer supported by this framework.
.AddJwtFunctionsBearer(options =>
{
options.Audience = "<my-audience>";
Expand Down
10 changes: 9 additions & 1 deletion src/isolated/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ Bringing AuthorizeAttribute Behavior to Azure Functions v4 in Isolated mode.

It hooks into .NET Core dependency injection container to enable authentication and authorization in the same way ASP.NET Core does.

> **Breaking for current package consumers** <br/>
> Starting with version 4.1.0, due to security changes made on the Functions runtime, the Bearer scheme is no longer supported for your app functions.<br/>
> Use `AddJwtFunctionsBearer(Action<JwtBearerOptions>)` instead of `AddJwtBearer(Action<JwtBearerOptions>)` when setting up authentication.
Using `AddJwtBearer` will generate a compilation error when used against `FunctionsAuthenticationBuilder`.
We are introducing `JwtFunctionsBearerDefaults` to refer to the suggested new custom scheme name.<br/>
No changes should be required if already using a custom scheme name.

## Using the package
### Installing the package
`dotnet add package DarkLoop.Azure.Functions.Authorization.Isolated`
Expand All @@ -28,7 +35,8 @@ var host = new HostBuilder()
{
services
.AddFunctionsAuthentication(JwtBearerDefaults.AuthenticationScheme)
// This is important as Bearer scheme is used by the platform
// This is important as Bearer scheme is used by the runtime
// and no longer supported by this framework.
.AddJwtFunctionsBearer(options =>
{
options.Authority = "https://login.microsoftonline.com/your-tenant-id";
Expand Down