Skip to content

Commit 686f59b

Browse files
committed
Revert "Atualização"
This reverts commit ead8f28.
1 parent ead8f28 commit 686f59b

44 files changed

Lines changed: 1618 additions & 51642 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CORE/Extras/AndroidSSL.rar

-5.38 MB
Binary file not shown.

CORE/Extras/AndroidSSL.txt

Lines changed: 0 additions & 3 deletions
This file was deleted.

CORE/Extras/Indy.rar

-8.08 MB
Binary file not shown.

CORE/Extras/Indy.zip

8.93 MB
Binary file not shown.

CORE/Extras/openssl-1.1.1w.zip

-15.2 MB
Binary file not shown.

CORE/Packages/Lazarus/RESTDataWareComponents.lpk

Lines changed: 2 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<PathDelim Value="\"/>
1111
<SearchPaths>
1212
<IncludeFiles Value="..\..\Source;..\..\Source\Basic\Crypto;..\..\Source\Includes;..\..\Source\Plugins\DMDados;..\..\Source\Plugins\JSONViewer;..\..\Source\Plugins\SQLEditor;..\..\Source\Wizards\lazarus"/>
13-
<OtherUnitFiles Value="..\..\Source;..\..\Source\Basic;..\..\Source\Basic\Crypto;..\..\Source\Basic\Dialogs;..\..\Source\Basic\Mechanics;..\..\Source\Consts;..\..\Source\utils;..\..\Source\utils\JSON;..\..\Source\Plugins\DMDados;..\..\Source\Plugins\JSONViewer;..\..\Source\Plugins\Memdataset;..\..\Source\Plugins\SQLEditor;..\..\Source\Wizards\lazarus;..\..\Source\Database_Drivers;..\..\Source\Plugins\SelfSigned;..\..\Source\utils\SSL"/>
13+
<OtherUnitFiles Value="..\..\Source;..\..\Source\Basic;..\..\Source\Basic\Crypto;..\..\Source\Basic\Dialogs;..\..\Source\Basic\Mechanics;..\..\Source\Consts;..\..\Source\utils;..\..\Source\utils\JSON;..\..\Source\Plugins\DMDados;..\..\Source\Plugins\JSONViewer;..\..\Source\Plugins\Memdataset;..\..\Source\Plugins\SQLEditor;..\..\Source\Wizards\lazarus;..\..\Source\Database_Drivers;..\..\Source\Plugins\SelfSigned"/>
1414
<UnitOutputDirectory Value="..\..\compiledlaz"/>
1515
</SearchPaths>
1616
<CodeGeneration>
@@ -32,7 +32,7 @@
3232
<Description Value="The proposal was fulfilled. REST DW was created to facilitate the creation of CRUDs in the same model that we created applications for Client / Server Database. Today, being able to write data to a bank via WebService is too complex for simple operations, making scheduling of simple screens time-consuming. With REST Dataware, you no longer have to worry about creating SQL Insertion, Deletion, Read, and Execution methods via Webservice; Simply add a RESTDataBase connection component and add a RESTClientSQL component that will already have your SQL solution fully functional as you did back in the day and with all the power of modern REST / JSON technology with data compression and everything the language can offer. Have fun."/>
3333
<License Value="GPL- 3.0"/>
3434
<Version Major="2" Minor="1"/>
35-
<Files Count="91">
35+
<Files Count="82">
3636
<Item1>
3737
<Filename Value="RESTDataWareComponents.lrs"/>
3838
<Type Value="LRS"/>
@@ -362,42 +362,6 @@
362362
<Filename Value="..\..\Source\Basic\uRESTDWStorageBin.pas"/>
363363
<UnitName Value="uRESTDWStorageBin"/>
364364
</Item82>
365-
<Item83>
366-
<Filename Value="..\..\Source\utils\SSL\OpenSSL.Api_11.pas"/>
367-
<UnitName Value="OpenSSL.Api_11"/>
368-
</Item83>
369-
<Item84>
370-
<Filename Value="..\..\Source\utils\SSL\uRESTDW.BinaryCoding.pas"/>
371-
<UnitName Value="uRESTDW.BinaryCoding"/>
372-
</Item84>
373-
<Item85>
374-
<Filename Value="..\..\Source\utils\SSL\uRESTDW.Bson.IO.pas"/>
375-
<UnitName Value="uRESTDW.Bson.IO"/>
376-
</Item85>
377-
<Item86>
378-
<Filename Value="..\..\Source\utils\SSL\uRESTDW.Bson.pas"/>
379-
<UnitName Value="uRESTDW.Bson"/>
380-
</Item86>
381-
<Item87>
382-
<Filename Value="..\..\Source\utils\SSL\uRESTDW.DateUtils.pas"/>
383-
<UnitName Value="uRESTDW.DateUtils"/>
384-
</Item87>
385-
<Item88>
386-
<Filename Value="..\..\Source\utils\SSL\uRESTDW.OAuth2.pas"/>
387-
<UnitName Value="uRESTDW.OAuth2"/>
388-
</Item88>
389-
<Item89>
390-
<Filename Value="..\..\Source\utils\SSL\uRESTDW.OpenSsl_11.pas"/>
391-
<UnitName Value="uRESTDW.OpenSsl_11"/>
392-
</Item89>
393-
<Item90>
394-
<Filename Value="..\..\Source\utils\SSL\uRESTDW.System.pas"/>
395-
<UnitName Value="uRESTDW.System"/>
396-
</Item90>
397-
<Item91>
398-
<Filename Value="..\..\Source\utils\SSL\uRESTDW.SysUtils.pas"/>
399-
<UnitName Value="uRESTDW.SysUtils"/>
400-
</Item91>
401365
</Files>
402366
<CompatibilityMode Value="True"/>
403367
<RequiredPkgs Count="3">

CORE/Packages/Lazarus/RESTDataWareComponents.pas

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@ interface
2828
uRESTDWJSONInterface, uRESTDWSerialize, uRESTDWMimeTypes, uRESTDWAbout,
2929
uRESTDWZlib, uRESTDWMemoryDataset, uRESTDWDesignReg, uRESTDWProtoTypes,
3030
uRESTDWSelfSigned, uRESTDWExprParser, uRESTDWAuthenticators,
31-
uRESTDWStorageBin, OpenSSL.Api_11, uRESTDW.BinaryCoding, uRESTDW.Bson.IO,
32-
uRESTDW.Bson, uRESTDW.DateUtils, uRESTDW.OAuth2, uRESTDW.OpenSsl_11,
33-
uRESTDW.System, uRESTDW.SysUtils, LazarusPackageIntf;
31+
uRESTDWStorageBin, LazarusPackageIntf;
3432

3533
implementation
3634

CORE/Source/Basic/Crypto/DWDCPcrypt2.pas

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ interface
3636

3737
{ ****************************************************************** }
3838
{ The base class from which all hash algorithms are to be derived }
39+
3940
type
4041
EDWDCP_hash = class(Exception);
4142

@@ -105,7 +106,6 @@ TDWDCP_hashclass = class of TDWDCP_hash;
105106
{ Block ciphers will have a further foundation class TDWDCP_blockcipher. }
106107

107108
type
108-
TDWDCP_ciphermode = (cmCBC, cmCFB8bit, cmCFBblock, cmOFB, cmCTR);
109109
EDWDCP_cipher = class(Exception);
110110

111111
TDWDCP_cipher = class(TComponent)
@@ -200,6 +200,7 @@ TDWDCP_cipherclass = class of TDWDCP_cipher;
200200
{ extra class takes care of the different block encryption modes. }
201201

202202
type
203+
TDWDCP_ciphermode = (cmCBC, cmCFB8bit, cmCFBblock, cmOFB, cmCTR);
203204
// cmCFB8bit is equal to DWDCPcrypt v1.xx's CFB mode
204205
EDWDCP_blockcipher = class(EDWDCP_cipher);
205206

@@ -267,7 +268,7 @@ TDWDCP_blockcipher = class(TDWDCP_cipher)
267268

268269
published
269270
property BlockSize: integer read _GetBlockSize write DeadInt;
270-
property CipherMode: TDWDCP_ciphermode read fCipherMode write fCipherMode default TDWDCP_ciphermode.cmCBC;
271+
property CipherMode: TDWDCP_ciphermode read fCipherMode write fCipherMode default cmCBC;
271272
end;
272273

273274
TDWDCP_blockcipherclass = class of TDWDCP_blockcipher;
@@ -702,15 +703,15 @@ procedure TDWDCP_blockcipher.GetIV(var Value);
702703
procedure TDWDCP_blockcipher.Encrypt(const Indata; var Outdata; Size: longword);
703704
begin
704705
case fCipherMode of
705-
TDWDCP_ciphermode.cmCBC:
706+
cmCBC:
706707
EncryptCBC(Indata, Outdata, Size);
707-
TDWDCP_ciphermode.cmCFB8bit:
708+
cmCFB8bit:
708709
EncryptCFB8bit(Indata, Outdata, Size);
709-
TDWDCP_ciphermode.cmCFBblock:
710+
cmCFBblock:
710711
EncryptCFBblock(Indata, Outdata, Size);
711-
TDWDCP_ciphermode.cmOFB:
712+
cmOFB:
712713
EncryptOFB(Indata, Outdata, Size);
713-
TDWDCP_ciphermode.cmCTR:
714+
cmCTR:
714715
EncryptCTR(Indata, Outdata, Size);
715716
end;
716717
end;
@@ -749,15 +750,15 @@ function TDWDCP_blockcipher.EncryptString(const Str: DWDCPUnicodeString): DWDCPU
749750
procedure TDWDCP_blockcipher.Decrypt(const Indata; var Outdata; Size: longword);
750751
begin
751752
case fCipherMode of
752-
TDWDCP_ciphermode.cmCBC:
753+
cmCBC:
753754
DecryptCBC(Indata, Outdata, Size);
754-
TDWDCP_ciphermode.cmCFB8bit:
755+
cmCFB8bit:
755756
DecryptCFB8bit(Indata, Outdata, Size);
756-
TDWDCP_ciphermode.cmCFBblock:
757+
cmCFBblock:
757758
DecryptCFBblock(Indata, Outdata, Size);
758-
TDWDCP_ciphermode.cmOFB:
759+
cmOFB:
759760
DecryptOFB(Indata, Outdata, Size);
760-
TDWDCP_ciphermode.cmCTR:
761+
cmCTR:
761762
DecryptCTR(Indata, Outdata, Size);
762763
end;
763764
end;
@@ -813,7 +814,7 @@ procedure TDWDCP_blockcipher.DecryptCTR(const Indata; var Outdata; Size: longwor
813814
constructor TDWDCP_blockcipher.Create(AOwner: TComponent);
814815
begin
815816
inherited Create(AOwner);
816-
fCipherMode := TDWDCP_ciphermode.cmCBC;
817+
fCipherMode := cmCBC;
817818
end;
818819

819820
// Version 2.1 : Partial Stream Read capability.

CORE/Source/Basic/Crypto/DWDCPrijndael.pas

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,4 +367,3 @@ procedure TRESTDWDCP_rijndael.DecryptECB(const InData; var OutData);
367367

368368

369369
end.
370-

CORE/Source/Basic/Mechanics/uRESTDWAuthenticators.pas

Lines changed: 49 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
unit uRESTDWAuthenticators;
1+
unit uRESTDWAuthenticators;
22

33
{$I ..\..\Includes\uRESTDW.inc}
44

@@ -32,20 +32,8 @@ interface
3232

3333
uses
3434
Classes, SysUtils, DateUtils,
35-
uRESTDWConsts, uRESTDWAbout, uRESTDWDataUtils, uRESTDWJSONInterface,
36-
uRESTDWTools, uRESTDWParams, uRESTDWProtoTypes, uRESTDW.OpenSsl_11;
37-
38-
Type
39-
TRESTDWCertOptions = Record
40-
Country,
41-
State,
42-
Locality,
43-
Organization,
44-
OrgUnit,
45-
CommonName,
46-
ServerName : String;
47-
ExpiresDays : Integer;
48-
End;
35+
uRESTDWConsts, uRESTDWAbout, uRESTDWDataUtils, uRESTDWJSONInterface,
36+
uRESTDWTools, uRESTDWParams;
4937

5038
Type
5139
TRESTDWAuthenticatorBase = class(TRESTDWComponent)
@@ -150,63 +138,36 @@ TRESTDWAuthToken = class(TRESTDWServerAuthBase)
150138
property AutoRenewToken: Boolean read FAutoRenewToken write FAutoRenewToken;
151139
end;
152140

153-
TRESTDWAuthOAuth = Class(TRESTDWServerAuthBase)
141+
TRESTDWAuthOAuth = class(TRESTDWServerAuthBase)
154142
private
155-
FTokenType : TRESTDWAuthOptionTypes;
156-
FBeginTime,
157-
FEndTime : TDateTime;
158-
FRSASHA256_Validation,
159-
FServerValidationCert,
160-
FAutoBuildHex : Boolean;
161-
FLifeCycle : Integer;
162-
FToken,
163-
FGrantCodeEvent,
164-
FGrantType,
165-
FGetTokenEvent,
166-
FHeader,
167-
FPayLoad,
168-
FSignature,
169-
FPublicKey,
170-
FPrivateKey,
171-
FRedirectURI : String;
143+
FTokenType: TRESTDWAuthOptionTypes;
144+
FAutoBuildHex: Boolean;
145+
FToken: String;
146+
FGrantCodeEvent: String;
147+
FGrantType: String;
148+
FGetTokenEvent: String;
149+
FClientID: String;
150+
FClientSecret: String;
151+
FRedirectURI: String;
152+
FExpiresIn: TDateTime;
172153
public
173-
Constructor Create (aOwner : TComponent); Override;
174-
Function CreateSelfSignedCert_X509(CertOptions : TRESTDWCertOptions;
175-
Var Certificate,
176-
PrivateKey : TRESTDWBytes) : Boolean;
177-
Function AuthValidate (ADataModuleRESTDW : TObject;
178-
AUrlToExec,
179-
AWelcomeMessage,
180-
AAccessTag,
181-
AAuthUsername,
182-
AAuthPassword : String;
183-
ARawHeaders : TStrings;
184-
ARequestType : TRequestType;
185-
Var ADWParams : TRESTDWParams;
186-
Var AGetToken : Boolean;
187-
Var ATokenValidate : Boolean;
188-
Var AToken : String;
189-
Var AErrorCode : Integer;
190-
Var AErrorMessage : String;
191-
Var AAcceptAuth : Boolean) : Boolean; Override;
154+
constructor Create(aOwner: TComponent); override;
155+
function AuthValidate(ADataModuleRESTDW: TObject;
156+
AUrlToExec, AWelcomeMessage, AAccessTag, AAuthUsername, AAuthPassword: String;
157+
ARawHeaders: TStrings; ARequestType: TRequestType; var ADWParams: TRESTDWParams;
158+
var AGetToken: Boolean; var ATokenValidate: Boolean; var AToken: String;
159+
var AErrorCode: Integer; var AErrorMessage: String; var AAcceptAuth: Boolean): Boolean; override;
192160
published
193-
Property TokenType : TRESTDWAuthOptionTypes Read FTokenType Write FTokenType;
194-
Property AutoBuildHex : Boolean Read FAutoBuildHex Write FAutoBuildHex;
195-
Property RSASHA256_Validation : Boolean Read FRSASHA256_Validation Write FRSASHA256_Validation;
196-
Property LifeCycle : Integer Read FLifeCycle Write FLifeCycle;
197-
Property BeginTime : TDateTime Read FBeginTime Write FBeginTime; //iat
198-
Property EndTime : TDateTime Read FEndTime Write FEndTime;//exp
199-
Property ServerValidationCert : Boolean Read FServerValidationCert Write FServerValidationCert;
200-
Property Token : String Read FToken Write FToken;
201-
Property GrantCodeEvent : String Read FGrantCodeEvent Write FGrantCodeEvent;
202-
Property GrantType : String Read FGrantType Write FGrantType;
203-
Property GetTokenEvent : String Read FGetTokenEvent Write FGetTokenEvent;
204-
Property Header : String Read FHeader;
205-
Property PayLoad : String Read FPayLoad Write FPayLoad;
206-
Property Signature : String Read FSignature Write FSignature;
207-
Property PublicKey : String Read FPublicKey Write FPublicKey;
208-
Property PrivateKey : String Read FPrivateKey Write FPrivateKey;
209-
Property RedirectURI : String Read FRedirectURI Write FRedirectURI;
161+
property TokenType: TRESTDWAuthOptionTypes read FTokenType write FTokenType;
162+
property AutoBuildHex: Boolean read FAutoBuildHex write FAutoBuildHex;
163+
property Token: String read FToken write FToken;
164+
property GrantCodeEvent: String read FGrantCodeEvent write FGrantCodeEvent;
165+
property GrantType: String read FGrantType write FGrantType;
166+
property GetTokenEvent: String read FGetTokenEvent write FGetTokenEvent;
167+
property ClientID: String read FClientID write FClientID;
168+
property ClientSecret: String read FClientSecret write FClientSecret;
169+
property RedirectURI: String read FRedirectURI write FRedirectURI;
170+
property ExpiresIn: TDateTime read FExpiresIn;
210171
end;
211172

212173
TOnUserBasicAuth = Procedure(Welcomemsg, AccessTag,
@@ -216,14 +177,14 @@ TRESTDWAuthToken = class(TRESTDWServerAuthBase)
216177
Var ErrorMessage : String;
217178
Var Accept : Boolean) Of Object;
218179

219-
TOnGetToken = Procedure(Welcomemsg,
220-
AccessTag : String;
221-
Params : TRESTDWParams;
222-
AuthOptions : TRESTDWAuthToken;
223-
Var ErrorCode : Integer;
224-
Var ErrorMessage : String;
225-
Var TokenID : String;
226-
Var Accept : Boolean) Of Object;
180+
TOnGetToken = Procedure(Welcomemsg,
181+
AccessTag : String;
182+
Params : TRESTDWParams;
183+
AuthOptions : TRESTDWAuthToken;
184+
Var ErrorCode : Integer;
185+
Var ErrorMessage : String;
186+
Var TokenID : String;
187+
Var Accept : Boolean) Of Object;
227188

228189
TOnUserTokenAuth = Procedure(Welcomemsg,
229190
AccessTag : String;
@@ -965,22 +926,7 @@ procedure TRESTDWAuthToken.SetToken(AValue: String);
965926

966927
{ TRESTDWAuthOAuth }
967928

968-
Function TRESTDWAuthOAuth.CreateSelfSignedCert_X509(CertOptions : TRESTDWCertOptions;
969-
Var Certificate,
970-
PrivateKey : TRESTDWBytes) : Boolean;
971-
begin
972-
Result := TRESTDWOpenSSLHelper.CreateSelfSignedCert_X509(CertOptions.Country,
973-
CertOptions.State,
974-
CertOptions.Locality,
975-
CertOptions.Organization,
976-
CertOptions.OrgUnit,
977-
CertOptions.CommonName,
978-
CertOptions.ServerName,
979-
CertOptions.ExpiresDays,
980-
Certificate, PrivateKey);
981-
End;
982-
983-
Function TRESTDWAuthOAuth.AuthValidate(ADataModuleRESTDW : TObject;
929+
Function TRESTDWAuthOAuth.AuthValidate(ADataModuleRESTDW : TObject;
984930
AUrlToExec,
985931
AWelcomeMessage,
986932
AAccessTag,
@@ -1004,24 +950,16 @@ procedure TRESTDWAuthToken.SetToken(AValue: String);
1004950
Constructor TRESTDWAuthOAuth.Create(aOwner: TComponent);
1005951
Begin
1006952
Inherited;
1007-
FRSASHA256_Validation := True;
1008-
FServerValidationCert := True;
1009-
FToken := '';
1010-
FRedirectURI := '';
1011-
FGrantType := 'client_credentials';
1012-
FGetTokenEvent := 'access-token';
1013-
FGrantCodeEvent := 'authorize';
1014-
FHeader := '{"alg": "RS256", "typ": "JWT"}';
1015-
FLifeCycle := 1800; // 30 Minutos
1016-
FPayLoad := '';
1017-
FSignature := '';
1018-
FPublicKey := '';
1019-
FPrivateKey := '';
1020-
FRedirectURI := '';
1021-
FBeginTime := 0;
1022-
FEndTime := 0;
1023-
FAutoBuildHex := False;
1024-
FTokenType := rdwOATBasic;
953+
FClientID := '';
954+
FClientSecret := '';
955+
FToken := '';
956+
FRedirectURI := '';
957+
FGrantType := 'client_credentials';
958+
FGetTokenEvent := 'access-token';
959+
FGrantCodeEvent := 'authorize';
960+
FAutoBuildHex := False;
961+
FExpiresIn := 0;
962+
FTokenType := rdwOATBasic;
1025963
End;
1026964

1027965
{ TRESTDWAuthenticatorBase }

0 commit comments

Comments
 (0)