public static ClientPolicyContext GetClientPolicy(ISettings settings, ILogger logger) { if (settings == null) { throw new ArgumentNullException(nameof(settings)); } if (logger == null) { throw new ArgumentNullException(nameof(logger)); } var policy = SettingsUtility.GetSignatureValidationMode(settings); var allowList = TrustedSignersProvider.GetAllowListEntries(settings, logger); return(new ClientPolicyContext(policy, allowList)); }
/// <summary> /// Gives the appropriate configuration depending on the user specified settings. /// </summary> /// <param name="settings">Loaded settings used to get user data</param> public static SignedPackageVerifierSettings GetClientPolicy(ISettings settings, ILogger logger) { if (settings == null) { throw new ArgumentNullException(nameof(settings)); } var policy = SettingsUtility.GetSignatureValidationMode(settings); var allowList = TrustedSignersProvider.GetAllowListEntries(settings, logger); if (policy == SignatureValidationMode.Require) { return(GetRequireModeDefaultPolicy(clientAllowListEntries: allowList)); } return(GetAcceptModeDefaultPolicy(clientAllowListEntries: allowList)); }