feat(notifications): OAuth2 authority/scope management + CLI + UI surfaces
Additive UpdateSmtpConfigCommand params (OAuth2Authority/OAuth2Scope), preserve-on-null handler application, CLI --oauth2-authority/--oauth2-scope on smtp update, Central UI text inputs shown only for the OAuth2 auth type, and the Component-NotificationService doc paragraph with M365 defaults. Claude-Session: https://claude.ai/code/session_01MtdgwpEeCUn6cUA5f1LMPj
This commit is contained in:
@@ -142,6 +142,8 @@ public static class NotificationCommands
|
||||
updateCmd.Add(SmtpFromOption);
|
||||
updateCmd.Add(SmtpTlsModeOption);
|
||||
updateCmd.Add(SmtpCredentialsOption);
|
||||
updateCmd.Add(SmtpOAuth2AuthorityOption);
|
||||
updateCmd.Add(SmtpOAuth2ScopeOption);
|
||||
updateCmd.SetAction(async (ParseResult result) =>
|
||||
{
|
||||
return await CommandHelpers.ExecuteCommandAsync(
|
||||
@@ -172,6 +174,18 @@ public static class NotificationCommands
|
||||
Description = "SMTP credentials — 'username:password' for Basic, or client secret " +
|
||||
"for OAuth2 (optional; preserves existing if omitted)",
|
||||
};
|
||||
private static readonly Option<string?> SmtpOAuth2AuthorityOption =
|
||||
new("--oauth2-authority")
|
||||
{
|
||||
Description = "OAuth2 token-endpoint URL (optional; a '{tenant}' placeholder is " +
|
||||
"substituted from the credential; preserves existing / M365 default if omitted)",
|
||||
};
|
||||
private static readonly Option<string?> SmtpOAuth2ScopeOption =
|
||||
new("--oauth2-scope")
|
||||
{
|
||||
Description = "OAuth2 scope requested from the token endpoint " +
|
||||
"(optional; preserves existing / M365 default if omitted)",
|
||||
};
|
||||
|
||||
private static Option<string?> CreateTlsModeOption()
|
||||
{
|
||||
@@ -185,8 +199,9 @@ public static class NotificationCommands
|
||||
|
||||
/// <summary>
|
||||
/// Builds the <see cref="UpdateSmtpConfigCommand"/> from a parsed <c>smtp update</c>
|
||||
/// invocation. The optional <c>--tls-mode</c> / <c>--credentials</c> flags map to
|
||||
/// null when omitted so the server-side handler preserves the existing values.
|
||||
/// invocation. The optional <c>--tls-mode</c> / <c>--credentials</c> /
|
||||
/// <c>--oauth2-authority</c> / <c>--oauth2-scope</c> flags map to null when omitted
|
||||
/// so the server-side handler preserves the existing values.
|
||||
/// </summary>
|
||||
/// <param name="result">The parsed command-line result from the <c>smtp update</c> invocation.</param>
|
||||
/// <returns>An <see cref="UpdateSmtpConfigCommand"/> populated from the parsed result.</returns>
|
||||
@@ -199,7 +214,9 @@ public static class NotificationCommands
|
||||
var from = result.GetValue(SmtpFromOption)!;
|
||||
var tlsMode = result.GetValue(SmtpTlsModeOption);
|
||||
var credentials = result.GetValue(SmtpCredentialsOption);
|
||||
return new UpdateSmtpConfigCommand(id, server, port, authMode, from, tlsMode, credentials);
|
||||
var oauth2Authority = result.GetValue(SmtpOAuth2AuthorityOption);
|
||||
var oauth2Scope = result.GetValue(SmtpOAuth2ScopeOption);
|
||||
return new UpdateSmtpConfigCommand(id, server, port, authMode, from, tlsMode, credentials, oauth2Authority, oauth2Scope);
|
||||
}
|
||||
|
||||
private static Command BuildSms(Option<string> urlOption, Option<string> formatOption, Option<string> usernameOption, Option<string> passwordOption)
|
||||
|
||||
Reference in New Issue
Block a user