ServiceAuthentication(ServiceAuthenticationType type, SymmetricKeyAuthentication symmetricKey, X509ThumbprintAuthentication x509Thumbprint) { Preconditions.CheckArgument(type != ServiceAuthenticationType.SymmetricKey || symmetricKey != null, $"{nameof(SymmetricKeyAuthentication)} should not be null when type is {ServiceAuthenticationType.SymmetricKey}"); Preconditions.CheckArgument(type != ServiceAuthenticationType.CertificateThumbprint || x509Thumbprint != null, $"{nameof(X509ThumbprintAuthentication)} should not be null when type is {ServiceAuthenticationType.CertificateThumbprint}"); this.Type = type; this.SymmetricKey = Option.Maybe(symmetricKey); this.X509Thumbprint = Option.Maybe(x509Thumbprint); }
public ServiceAuthentication(ServiceAuthenticationType type) : this(type, null, null) { }