source upload
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
SSPI / Windows Authentication Test App for *mORMot*
|
||||
===================================================
|
||||
|
||||
*by Chaa*
|
||||
|
||||
|
||||
This is some code shared in our forum, at http://synopse.info/forum/viewtopic.php?pid=17358#p17358
|
||||
|
||||
Could be used to validate that the SSPI authentication works as expected on your platform.
|
||||
|
||||
Thanks Chaa for sharing!
|
@@ -0,0 +1,53 @@
|
||||
program WindowsAuth;
|
||||
|
||||
{$APPTYPE CONSOLE}
|
||||
|
||||
uses
|
||||
{$I SynDprUses.inc}
|
||||
SysUtils,
|
||||
SynSSPI,
|
||||
SynLZ in 'SynLZ.pas',
|
||||
SynCommons in 'SynCommons.pas',
|
||||
SynSSPIAuth in 'SynSSPIAuth.pas';
|
||||
|
||||
procedure Test;
|
||||
var
|
||||
ClientSecContext: TSecContext;
|
||||
ServerSecContext: TSecContext;
|
||||
InData, OutData: RawByteString;
|
||||
UserName: RawUTF8;
|
||||
begin
|
||||
try
|
||||
InvalidateSecContext(ClientSecContext, 0);
|
||||
InvalidateSecContext(ServerSecContext, 0);
|
||||
|
||||
ClientSSPIAuth(ClientSecContext, InData, '', OutData);
|
||||
|
||||
InData := OutData;
|
||||
|
||||
ServerSSPIAuth(ServerSecContext, InData, OutData);
|
||||
|
||||
InData := OutData;
|
||||
|
||||
ClientSSPIAuth(ClientSecContext, InData, '', OutData);
|
||||
|
||||
InData := OutData;
|
||||
|
||||
ServerSSPIAuth(ServerSecContext, InData, OutData);
|
||||
ServerSSPIAuthUser(ServerSecContext, UserName);
|
||||
|
||||
FreeSecContext(ClientSecContext);
|
||||
FreeSecContext(ServerSecContext);
|
||||
|
||||
Writeln('Authentified as: "',UserName,'"');
|
||||
writeln('Press [Enter] to continue');
|
||||
readln;
|
||||
except
|
||||
on E: Exception do
|
||||
ConsoleShowFatalException(E);
|
||||
end;
|
||||
end;
|
||||
|
||||
begin
|
||||
Test;
|
||||
end.
|
Reference in New Issue
Block a user