mORMot and Open Source friends
Check-in [16c4551627]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:{5086} fix compilation if NOSSPIAUTH/NOGSSAPIAUTH is defined
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:16c45516278502cb1e7d05fd4892c91b4779df07
User & Date: ab 2019-03-05 10:55:14
Context
2019-03-05
10:59
{5087} small TSynDictionary refactoring check-in: 0713b309c6 user: ab tags: trunk
10:55
{5086} fix compilation if NOSSPIAUTH/NOGSSAPIAUTH is defined check-in: 16c4551627 user: ab tags: trunk
2019-03-04
09:56
{5085} introducing LIBCURLMULTI conditional (raw API definition only - not yet used) check-in: be6ae9a9c0 user: ab tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to SQLite3/mORMot.pas.

20659
20660
20661
20662
20663
20664
20665




20666
20667
20668
20669
20670
20671
20672
.....
38760
38761
38762
38763
38764
38765
38766
38767
38768
38769
38770
38771
38772
38773
38774
38775
38776
38777
38778
38779
38780
38781
38782
38783
38784
38785
38786
38787
38788
38789
38790
38791
38792
38793
38794
38795
38796
38797
38798
38799
38800
38801
.....
38878
38879
38880
38881
38882
38883
38884
38885
38886
38887
38888
38889
38890
38891
38892
  // - you can override this value to follow your own application expectations
  AuthSupervisorDefaultPassword: RawUTF8 = DEFAULT_HASH_SYNOPSE;
  /// default hashed password set by TSQLAuthGroup.InitializeTable for 'User' user
  // - you can override this value to follow your own application expectations
  AuthUserDefaultPassword: RawUTF8 = DEFAULT_HASH_SYNOPSE;

const




  /// timer identifier which indicates we must refresh the current Page
  // - used for User Interface generation
  // - is associated with the TSQLRibbonTabParameters.AutoRefresh property,
  // and is handled in TSQLRibbon.RefreshClickHandled
  WM_TIMER_REFRESH_SCREEN = 1;
  /// timer identifier which indicates we must refresh the Report content
  // - used for User Interface generation
................................................................................
    end;
  end;
end;

{$ifdef DOMAINAUTH}
const
  SSPI_DEFINITION_USERNAME = '***SSPI***';
{$endif}

constructor TSQLRestClientURI.RegisteredClassCreateFrom(aModel: TSQLModel;
  aDefinition: TSynConnectionDefinition);
begin
  if fModel=nil then // if not already created with a reintroduced constructor
    Create(aModel);
  if fModel<>nil then
    fOnIdle := fModel.OnClientIdle; // allow UI interactivity during SetUser()
  if aDefinition.User<>'' then begin
    {$ifdef DOMAINAUTH}
    if aDefinition.User=SSPI_DEFINITION_USERNAME then
      SetUser('',aDefinition.PasswordPlain) else
    {$endif}
      SetUser(aDefinition.User,aDefinition.PasswordPlain,true);
  end;
end;

procedure TSQLRestClientURI.DefinitionTo(Definition: TSynConnectionDefinition);
begin
  if Definition=nil then
    exit;
  inherited DefinitionTo(Definition); // save Kind
  if (fSessionAuthentication<>nil) and (fSessionUser<>nil) then begin
    {$ifdef DOMAINAUTH}
    if fSessionAuthentication.InheritsFrom(TSQLRestServerAuthenticationSSPI) then
      Definition.User := SSPI_DEFINITION_USERNAME else
    {$endif}
       Definition.User := fSessionUser.LogonName;
     Definition.PasswordPlain := fSessionUser.fPasswordHashHexa;
  end;
end;

procedure TSQLRestClientURI.Commit(SessionID: cardinal; RaiseException: boolean);
begin
................................................................................
    exit;
  end;
  {$ifdef DOMAINAUTH} // try Windows/GSSAPI authentication with the current logged user
  result := true;
  if ((trim(aUserName)='') or (PosEx({$ifdef GSSAPIAUTH}'@'{$else}'\'{$endif},aUserName)>0)) and
    TSQLRestServerAuthenticationSSPI.ClientSetUser(self,aUserName,aPassword,passKerberosSPN) then
      exit;
  {$endif}
  result := TSQLRestServerAuthenticationDefault.
    ClientSetUser(self,aUserName,aPassword,HASH[aHashedPassword]);
end;

procedure TSQLRestClientURI.SetLastException(E: Exception; ErrorCode: integer;
  Call: PSQLRestURIParams);
begin







>
>
>
>







 







|












|













|







 







|







20659
20660
20661
20662
20663
20664
20665
20666
20667
20668
20669
20670
20671
20672
20673
20674
20675
20676
.....
38764
38765
38766
38767
38768
38769
38770
38771
38772
38773
38774
38775
38776
38777
38778
38779
38780
38781
38782
38783
38784
38785
38786
38787
38788
38789
38790
38791
38792
38793
38794
38795
38796
38797
38798
38799
38800
38801
38802
38803
38804
38805
.....
38882
38883
38884
38885
38886
38887
38888
38889
38890
38891
38892
38893
38894
38895
38896
  // - you can override this value to follow your own application expectations
  AuthSupervisorDefaultPassword: RawUTF8 = DEFAULT_HASH_SYNOPSE;
  /// default hashed password set by TSQLAuthGroup.InitializeTable for 'User' user
  // - you can override this value to follow your own application expectations
  AuthUserDefaultPassword: RawUTF8 = DEFAULT_HASH_SYNOPSE;

const
  {$ifndef DOMAINAUTH} // fallback is no SSPI library was made available
  TSQLRestServerAuthenticationSSPI = nil;
  {$endif DOMAINAUTH}

  /// timer identifier which indicates we must refresh the current Page
  // - used for User Interface generation
  // - is associated with the TSQLRibbonTabParameters.AutoRefresh property,
  // and is handled in TSQLRibbon.RefreshClickHandled
  WM_TIMER_REFRESH_SCREEN = 1;
  /// timer identifier which indicates we must refresh the Report content
  // - used for User Interface generation
................................................................................
    end;
  end;
end;

{$ifdef DOMAINAUTH}
const
  SSPI_DEFINITION_USERNAME = '***SSPI***';
{$endif DOMAINAUTH}

constructor TSQLRestClientURI.RegisteredClassCreateFrom(aModel: TSQLModel;
  aDefinition: TSynConnectionDefinition);
begin
  if fModel=nil then // if not already created with a reintroduced constructor
    Create(aModel);
  if fModel<>nil then
    fOnIdle := fModel.OnClientIdle; // allow UI interactivity during SetUser()
  if aDefinition.User<>'' then begin
    {$ifdef DOMAINAUTH}
    if aDefinition.User=SSPI_DEFINITION_USERNAME then
      SetUser('',aDefinition.PasswordPlain) else
    {$endif DOMAINAUTH}
      SetUser(aDefinition.User,aDefinition.PasswordPlain,true);
  end;
end;

procedure TSQLRestClientURI.DefinitionTo(Definition: TSynConnectionDefinition);
begin
  if Definition=nil then
    exit;
  inherited DefinitionTo(Definition); // save Kind
  if (fSessionAuthentication<>nil) and (fSessionUser<>nil) then begin
    {$ifdef DOMAINAUTH}
    if fSessionAuthentication.InheritsFrom(TSQLRestServerAuthenticationSSPI) then
      Definition.User := SSPI_DEFINITION_USERNAME else
    {$endif DOMAINAUTH}
       Definition.User := fSessionUser.LogonName;
     Definition.PasswordPlain := fSessionUser.fPasswordHashHexa;
  end;
end;

procedure TSQLRestClientURI.Commit(SessionID: cardinal; RaiseException: boolean);
begin
................................................................................
    exit;
  end;
  {$ifdef DOMAINAUTH} // try Windows/GSSAPI authentication with the current logged user
  result := true;
  if ((trim(aUserName)='') or (PosEx({$ifdef GSSAPIAUTH}'@'{$else}'\'{$endif},aUserName)>0)) and
    TSQLRestServerAuthenticationSSPI.ClientSetUser(self,aUserName,aPassword,passKerberosSPN) then
      exit;
  {$endif DOMAINAUTH}
  result := TSQLRestServerAuthenticationDefault.
    ClientSetUser(self,aUserName,aPassword,HASH[aHashedPassword]);
end;

procedure TSQLRestClientURI.SetLastException(E: Exception; ErrorCode: integer;
  Call: PSQLRestURIParams);
begin

Changes to SQLite3/mORMotHttpServer.pas.

1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197

constructor TSQLHttpServer.Create(aServer: TSQLRestServer;
  aDefinition: TSQLHttpServerDefinition; aForcedKind: TSQLHttpServerOptions;
  aWebSocketsLoopDelay: integer);
const AUTH: array[TSQLHttpServerRestAuthentication] of TSQLRestServerAuthenticationClass = (
  // adDefault, adHttpBasic, adWeak, adSSPI
  TSQLRestServerAuthenticationDefault, TSQLRestServerAuthenticationHttpBasic,
  TSQLRestServerAuthenticationNone,
  {$ifdef MSWINDOWS}TSQLRestServerAuthenticationSSPI{$else}nil{$endif});
var a: TSQLHttpServerRestAuthentication;
    thrdCnt: integer;
    websock: TWebSocketServerRest;
begin
  if aDefinition=nil then
    raise EHttpServerException.CreateUTF8('%.Create(aDefinition=nil)',[self]);
  if aDefinition.WebSocketPassword<>'' then







|
<







1182
1183
1184
1185
1186
1187
1188
1189

1190
1191
1192
1193
1194
1195
1196

constructor TSQLHttpServer.Create(aServer: TSQLRestServer;
  aDefinition: TSQLHttpServerDefinition; aForcedKind: TSQLHttpServerOptions;
  aWebSocketsLoopDelay: integer);
const AUTH: array[TSQLHttpServerRestAuthentication] of TSQLRestServerAuthenticationClass = (
  // adDefault, adHttpBasic, adWeak, adSSPI
  TSQLRestServerAuthenticationDefault, TSQLRestServerAuthenticationHttpBasic,
  TSQLRestServerAuthenticationNone,TSQLRestServerAuthenticationSSPI{may be nil});

var a: TSQLHttpServerRestAuthentication;
    thrdCnt: integer;
    websock: TWebSocketServerRest;
begin
  if aDefinition=nil then
    raise EHttpServerException.CreateUTF8('%.Create(aDefinition=nil)',[self]);
  if aDefinition.WebSocketPassword<>'' then

Changes to SynopseCommit.inc.

1
'1.18.5085'
|
1
'1.18.5086'