Class SmtpOAuthElement
Represents a configuration element providing the SMTP XOAuth2 authentication settings.
Implements
Inherited Members
Namespace: Nevatech.Vsb.Repository.Configuration
Assembly: Nevatech.Vsb.Repository.dll
Syntax
public sealed class SmtpOAuthElement : ConfigurationElement, IValidator
Constructors
SmtpOAuthElement()
Declaration
public SmtpOAuthElement()
Properties
Authority
Gets or sets the OAuth2 authority (issuer) URI. Default is "https://login.microsoftonline.com/common/".
Declaration
[ConfigurationProperty("authority")]
public string Authority { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Remarks
Use "https://login.microsoftonline.com/{tenantId}/v2.0" for Microsoft Azure.
ClientCertificate
Gets the OAuth2 client X.509 certificate (optional).
Declaration
[ConfigurationProperty("clientCertificate")]
public X509DefaultServiceCertificateElement ClientCertificate { get; }
Property Value
| Type | Description |
|---|---|
| X509DefaultServiceCertificateElement |
ClientId
Gets or sets the OAuth2 client ID (required).
Declaration
[ConfigurationProperty("clientId")]
public string ClientId { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
ClientSecret
Gets or sets the OAuth2 client secret (optional).
Declaration
[ConfigurationProperty("clientSecret")]
public string ClientSecret { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
ErrorMessage
When implemented, gets the message indicating the errors found during validation process.
Declaration
public string ErrorMessage { get; }
Property Value
| Type | Description |
|---|---|
| string |
Remarks
This property should be checked only if Validate() method returns False. If Validate() method returns True, this property should return Null.
Properties
Gets collection of configuration element properties.
Declaration
protected override ConfigurationPropertyCollection Properties { get; }
Property Value
| Type | Description |
|---|---|
| ConfigurationPropertyCollection |
Overrides
Scopes
Gets or sets the space-separated OAuth2 scopes. Default is "https://outlook.office365.com/.default".
Declaration
[ConfigurationProperty("scopes")]
public string Scopes { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Remarks
Use "https://outlook.office365.com/.default" for Microsoft 365. Use "https://communication.azure.com/.default" for Azure Communication Services.
Methods
Copy(SmtpOAuthElement)
Copies the content of the specified configuration element to this configuration element.
Declaration
public void Copy(SmtpOAuthElement from)
Parameters
| Type | Name | Description |
|---|---|---|
| SmtpOAuthElement | from | The configuration element to be copied. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | thrown if the specified |
Validate()
When implemented, evaluates the state of the object.
Declaration
public bool Validate()
Returns
| Type | Description |
|---|---|
| bool | True if state is valid; otherwise, false. |