applicationId uz neni povinne

This commit is contained in:
JiriUhlir
2026-06-15 08:42:56 +02:00
parent b01c09006a
commit cadfdaef1b
7 changed files with 127 additions and 10 deletions
+2 -2
View File
@@ -28,12 +28,12 @@ public sealed class RequestCredentialsProvider
var clientId = HeaderOrDefault(headers, CredentialConstants.ClientIdHeader, _settings.ClientId);
var clientSecret = HeaderOrDefault(headers, CredentialConstants.ClientSecretHeader, _settings.ClientSecret);
// ApplicationId is optional: iDoklad's standard client_credentials grant does not require it.
var applicationId = HeaderOrDefault(headers, CredentialConstants.ApplicationIdHeader, _settings.ApplicationId);
var missing = new List<string>();
if (string.IsNullOrWhiteSpace(clientId)) missing.Add(CredentialConstants.ClientIdHeader);
if (string.IsNullOrWhiteSpace(clientSecret)) missing.Add(CredentialConstants.ClientSecretHeader);
if (string.IsNullOrWhiteSpace(applicationId)) missing.Add(CredentialConstants.ApplicationIdHeader);
if (missing.Count > 0)
{
throw new MissingCredentialsException(missing);
@@ -43,7 +43,7 @@ public sealed class RequestCredentialsProvider
{
ClientId = clientId!,
ClientSecret = clientSecret!,
ApplicationId = applicationId!,
ApplicationId = string.IsNullOrWhiteSpace(applicationId) ? null : applicationId,
Language = ResolveLanguage(headers),
};
}