Skip to content

Commit ed61473

Browse files
committed
Adicionado um novo método para retornar o response na autenticação do usuário e mandar algum conteúdo atualizado ou token para o cliente como resposta, ou até mesmo uma excessão tratada
1 parent 04ee87d commit ed61473

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/Horse.BasicAuthentication.pas

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ THorseBasicAuthenticationConfig = class(TInterfacedObject, IHorseBasicAuthenti
5353
end;
5454

5555
type
56-
THorseBasicAuthentication = {$IF NOT DEFINED(FPC)} reference to {$ENDIF} function(const AUsername, APassword: string): Boolean;
56+
THorseBasicAuthentication = {$IF NOT DEFINED(FPC)} reference to {$ENDIF} function(const AUsername, APassword: string; ARes: THorseResponse): Boolean;
5757

5858
procedure Middleware(Req: THorseRequest; Res: THorseResponse; Next: {$IF DEFINED(FPC)} TNextProc {$ELSE} TProc {$ENDIF});
5959
function HorseBasicAuthentication(const AAuthenticate: THorseBasicAuthentication): THorseCallback; overload;
@@ -126,7 +126,7 @@ procedure Middleware(Req: THorseRequest; Res: THorseResponse; Next: {$IF DEFINED
126126
LBasicAuthenticationDecode.DelimitedText := {$IF DEFINED(FPC)}DecodeStringBase64(LBase64String){$ELSE}TBase64Encoding.base64.Decode(LBase64String){$ENDIF};
127127

128128
try
129-
LIsAuthenticated := Authenticate(LBasicAuthenticationDecode.Strings[0], LBasicAuthenticationDecode.Strings[1]);
129+
LIsAuthenticated := Authenticate(LBasicAuthenticationDecode.Strings[0], LBasicAuthenticationDecode.Strings[1], Res);
130130
except
131131
on E: exception do
132132
begin

0 commit comments

Comments
 (0)