Skip to content

Commit

Permalink
Add Susi Policy Id parameter for Code Update (#2035)
Browse files Browse the repository at this point in the history
* Add default project description if none is found

* Add susi policy ID parameter to code update
  • Loading branch information
zahalzel committed Oct 5, 2022
1 parent 63216b1 commit 08199aa
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ public ProjectDescriptionReader(IEnumerable<string> files)
}
}

return null;
// If projectDescription cannot be inferred, default to Web App
return ProjectDescriptions.FirstOrDefault(p => string.Equals(ProjectTypes.WebApp, p.Identifier));
}

static readonly JsonSerializerOptions serializerOptionsWithComments = new JsonSerializerOptions
Expand All @@ -52,17 +53,11 @@ public List<ProjectDescription> ProjectDescriptions
{
get
{
if (_projectDescriptions == null)
{
_projectDescriptions = AppProvisioningTool.Properties
_projectDescriptions ??= AppProvisioningTool.Properties
.Where(p => p.Name.StartsWith("dotnet") && p.PropertyType == typeof(byte[]))
.Select(p => GetProjectDescription(p))
.ToList();

// TODO: provide an extension mechanism to add such files outside the tool.
// In that case the validation would not be an exception? but would need to provide error messages
}

return _projectDescriptions;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,10 @@ private ProjectAuthenticationSettings InferApplicationParameters(
{
projectSettings.ApplicationParameters.AppIdUri = provisioningToolOptions.HostedAppIdUri;
}
if (!string.IsNullOrEmpty(provisioningToolOptions.SusiPolicyId))
{
projectSettings.ApplicationParameters.SusiPolicy = provisioningToolOptions.SusiPolicyId;
}

return projectSettings;
}
Expand Down
2 changes: 1 addition & 1 deletion tools/dotnet-msidentity/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ internal static Command UpdateProjectCommand() =>
"\n\t- Updates the Startup.cs file." +
"\n\t- Updates the user secrets.\n")
{
TenantOption(), UsernameOption(), ClientIdOption(), JsonOption(), ProjectFilePathOption(), ConfigUpdateOption(), CodeUpdateOption(), PackagesUpdateOption(), CallsGraphOption(), CallsDownstreamApiOption(), UpdateUserSecretsOption(), RedirectUriOption()
TenantOption(), UsernameOption(), ClientIdOption(), JsonOption(), ProjectFilePathOption(), ConfigUpdateOption(), CodeUpdateOption(), PackagesUpdateOption(), CallsGraphOption(), CallsDownstreamApiOption(), UpdateUserSecretsOption(), RedirectUriOption(), SusiPolicyIdOption()
};

internal static Command UpdateAppRegistrationCommand() =>
Expand Down

0 comments on commit 08199aa

Please sign in to comment.