New project to interface with the Microsoft Windows SSPI integration authentication API.

This commit is contained in:
antiduh
2014-06-18 21:26:43 +00:00
commit 87692b3cc6
9 changed files with 329 additions and 0 deletions

53
SSPIException.cs Normal file
View File

@@ -0,0 +1,53 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
namespace NSspi
{
[Serializable]
public class SSPIException : Exception
{
private int errorCode;
private string message;
public SSPIException( SerializationInfo info, StreamingContext context )
: base( info, context )
{
this.message = info.GetString( "messsage" );
this.errorCode = info.GetInt32( "errorCode" );
}
public SSPIException( string message, int errorCode )
{
this.message = message;
this.errorCode = errorCode;
}
public override void GetObjectData( SerializationInfo info, StreamingContext context )
{
base.GetObjectData( info, context );
info.AddValue( "message", this.message );
info.AddValue( "errorCode", this.errorCode );
}
public int ErrorCode
{
get
{
return this.errorCode;
}
}
public override string Message
{
get
{
return string.Format( "{0}. Error Code = '{1:X}'.", this.message, this.errorCode );
}
}
}
}