#1 2025-09-24 09:17:31

testgary
Member
Registered: 2025-02-06
Posts: 38

TAuthGroup

// I don't know whether it's a mistake on my part or something else. Here, "HOST" can only be in uppercase; lowercase doesn't yield any data.
Host := Ctxt.Call^.Header('HOST:')

Also, are there any examples of TAuthGroup + TAuthUser + MongoDB

Offline

#2 2025-09-24 10:21:47

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 15,247
Website

Re: TAuthGroup

It is documented as such.
This is part of the optimization of header names lookup.

Offline

#3 2025-09-24 10:33:36

testgary
Member
Registered: 2025-02-06
Posts: 38

Re: TAuthGroup

ab wrote:

It is documented as such.
This is part of the optimization of header names lookup.


This is truly perplexing and very prone to causing mistakes.

Could we make a change so that friends who come later won't waste time checking for mistakes at this place?

Offline

#4 2025-09-24 10:52:25

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 15,247
Website

Re: TAuthGroup

You just called the wrong method.
You used the low level method from Ctxt.Call^.

The method to use is Ctxt.InHeader['host'] and here you don't need to write anything in upper case.

Offline

#5 2025-10-14 10:55:13

koraycayiroglu
Member
Registered: 2017-02-03
Posts: 79

Re: TAuthGroup

testgary wrote:

Also, are there any examples of TAuthGroup + TAuthUser + MongoDB

What are you looking for exactly?

Offline

#6 2025-10-18 04:42:59

testgary
Member
Registered: 2025-02-06
Posts: 38

Re: TAuthGroup

koraycayiroglu wrote:
testgary wrote:

Also, are there any examples of TAuthGroup + TAuthUser + MongoDB

What are you looking for exactly?

I'm looking to see how others write related code so I can learn from it.
Thank you very much for your reply.

Offline

#7 2025-10-21 11:42:37

koraycayiroglu
Member
Registered: 2017-02-03
Posts: 79

Re: TAuthGroup

this is how i create my TRestServerDB:

constructor TCoreServiceRestServer.Create;
var Model: TOrmModel;
  Cli: TMongoClient;
begin
  Model := TOrmModel.Create([TAuthUser, TAuthGroup, ...], 'app'); 

  inherited Create(Model, True);

  SessionClass :=TAuthSession; // Custom TAuthSession

  Cli := TMongoClient.Create(DB_ADDRESS, DB_PORT);
  Cli.ConnectionTimeOut := 0;
  Cli.GracefulReconnect := True;
  Cli.OpenAuth('admin', DB_USER, DB_PASSWORD);

  OrmMapMongoDBAll(Self.OrmInstance, Cli.Open('core')); // 'core' is my collection's name
  Server.CreateMissingTables;
end;

Offline

Board footer

Powered by FluxBB