Skip to content

Change default auth provider to AppService from StaticWebApps #2644

Open
@JerryNixon

Description

@JerryNixon

Ensure AppService is identical to StaticWebApp

The goal is to ensure AppService is identical to StaticWebApp because we want to stop using StaticWebApp and start using AppService.

public enum EasyAuthType
{
StaticWebApps,
AppService
}

⚠️ None of this should be done if they are not identical.

Modify the Engine default references to StaticWebApps

These references are scattered throughout the codebase. We're shifting to AppService as the default, so wherever StaticWebApps appears in code or comments, it should be updated. We're not removing support for StaticWebApps, just removing it as the default.

Comment example:

/// <param name="Provider">Identity Provider. Default is StaticWebApps.

Code example:

public record AuthenticationOptions(string Provider = nameof(EasyAuthType.StaticWebApps), JwtOptions? Jwt = null)

Modify the CLI default references to StaticWebApps

This primarily applies to dab init. The goal is to ensure the CLI no longer defaults to StaticWebApps as the auth provider but to AppService. Users can still configure StaticWebApps, but they must do so manually.

Modify the JSON Schema

Update the schema to change the default value to AppService.

"authentication": {
"type": ["object", "null"],
"additionalProperties": false,
"properties": {
"provider": {
"type": "string",
"description": "The name of authentication provider",
"default": "StaticWebApps"
},

Also update the schema to restrict the provider property to only supported values (including StaticWebApps).

Modify DAB Validate

Update ValidateAuthenticationOptions to log a warning if the runtime host is set to StaticWebApps.

if (Enum.TryParse<EasyAuthType>(runtimeConfig.Runtime.Host.Authentication.Provider, ignoreCase: true, out var provider) &&
    provider == EasyAuthType.StaticWebApps)
{
    _logger.LogWarning("The 'StaticWebApps' authentication provider is deprecated.");
}

private void ValidateAuthenticationOptions(RuntimeConfig runtimeConfig)

Modify DAB Init

Ensure dab init generates a config functionally identical to before. However, the default provider should now be AppService instead of StaticWebApps.

[Option("auth.provider", Default = "StaticWebApps", Required = false, HelpText = "Specify the Identity Provider.")]
public string AuthenticationProvider { get; }

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions