TdsAuthenticationResult Class
Represents the result of an authentication attempt.
public sealed class TdsAuthenticationResultProperties
| Name | Description |
|---|---|
| Database | Gets the default database to report after login, if any. |
| ErrorClass | Gets the error class to send on failure. |
| ErrorMessage | Gets the error message to send to the client on failure. |
| ErrorNumber | Gets the SQL Server-style error number to send on failure. |
| ErrorState | Gets the error state to send on failure. |
| IsAuthenticated | Gets a value indicating whether authentication succeeded. |
| IsSspiContinuationNeeded | Gets a value indicating whether the SSPI exchange goes on: the server sends TdsAuthenticationResult.SspiToken to the client and waits for its answer. |
| SspiToken | Gets the SSPI token to send to the client, or an empty value when there is none. |
| UserContext | Gets the authenticated user context that will be propagated to query handlers. |
Database
TdsAuthenticationResult.csErrorClass
TdsAuthenticationResult.csErrorMessage
TdsAuthenticationResult.csErrorNumber
TdsAuthenticationResult.csErrorState
TdsAuthenticationResult.csIsAuthenticated
TdsAuthenticationResult.csIsSspiContinuationNeeded
TdsAuthenticationResult.csGets a value indicating whether the SSPI exchange goes on: the server sends TdsAuthenticationResult.SspiToken to the client and waits for its answer.
public bool IsSspiContinuationNeeded { get; }Property value
SspiToken
TdsAuthenticationResult.csGets the SSPI token to send to the client, or an empty value when there is none.
public ReadOnlyMemory<byte> SspiToken { get; }Property value
UserContext
TdsAuthenticationResult.csGets the authenticated user context that will be propagated to query handlers.
public ClaimsPrincipal? UserContext { get; }Property value
Methods
| Name | Description |
|---|---|
| ContinueSspi(ReadOnlyMemory<byte>) | Creates a result that continues the SSPI exchange: the server sends the token to the client and calls the handler again with the client's answer. |
| Fail(string, uint, byte, byte) | Creates a failed authentication result. |
| Success(ReadOnlyMemory<byte>, string?, ClaimsPrincipal?) | Creates a successful authentication result that ends an SSPI exchange with a last token for the client. |
| Success(string?, ClaimsPrincipal?) | Creates a successful authentication result. |
ContinueSspi(ReadOnlyMemory<byte>)
TdsAuthenticationResult.csCreates a result that continues the SSPI exchange: the server sends the token to the client and calls the handler again with the client's answer.
public static TdsAuthenticationResult ContinueSspi(ReadOnlyMemory<byte> sspiToken)Fail(string, uint, byte, byte)
TdsAuthenticationResult.csCreates a failed authentication result.
public static TdsAuthenticationResult Fail(string message, uint errorNumber = 18456U, byte errorState = 1, byte errorClass = 14)Parameters
Returns
Success overloads
Success(ReadOnlyMemory<byte>, string?, ClaimsPrincipal?)
TdsAuthenticationResult.csCreates a successful authentication result that ends an SSPI exchange with a last token for the client.
public static TdsAuthenticationResult Success(ReadOnlyMemory<byte> sspiToken, string? database = null, ClaimsPrincipal? userContext = null)Parameters
sspiTokenReadOnlyMemory<byte>- The final SSPI token, sent to the client before the login acknowledgment. It can be empty.
databasestring?- The default database to report after login, if any.
userContextClaimsPrincipal?- The authenticated user context that will be propagated to query handlers.
Returns
Success(string?, ClaimsPrincipal?)
TdsAuthenticationResult.csCreates a successful authentication result.
public static TdsAuthenticationResult Success(string? database = null, ClaimsPrincipal? userContext = null)