#1 2017-12-20 05:58:01

keinn
Member
Registered: 2014-10-20
Posts: 100

Is there a way of adding extra params while sending login request?

Is there a way of adding extra params while sending login request?
and process it on the server side ?

eg:l'd like to send the client version and recapcha code along with the client.setuser() method.

thks.

Offline

#2 2017-12-20 13:20:22

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,242
Website

Re: Is there a way of adding extra params while sending login request?

You can define your own authentication class then:
- override the TSQLRestServerAuthenticationDefault.ClientComputeSessionKey() method on the client side;
- override TSQLRestServerAuthenticationDefault.Auth() for the server side.

Offline

#3 2017-12-21 06:52:25

keinn
Member
Registered: 2014-10-20
Posts: 100

Re: Is there a way of adding extra params while sending login request?

i thought that too~~ thks.
another thing , when registered my own Auth class , it won't work , because the server already have a TSQLRestServerAuthenticationDefault and a TSQLRestServerAuthenticationNone auth classes registered by default , but the Server Auth method process the auth only use the FIRST one in the auth scheme list . the other has NO changce to perform . 
but if you UnRegester all the old sheme (make yours the first) , it will work fine.  BUT!!!~~ then che CrossClient wrapper will NOT generate the auth code . since it only check if there is a TSQLRestServerAuthenticationDefault or TSQLRestServerAuthenticationNONE .
this kind of logic is a little buggy~

Offline

#4 2017-12-21 08:16:07

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,242
Website

Re: Is there a way of adding extra params while sending login request?

Of course, as documented, you have to unregister first the other uneeded authentication (and also note that TSQLRestServerAuthenticationNone  is not registered, IIRC).

By design, cross-platform clients don't share code with the main mORMot.pas so you need to change also the cross-platform client code with another custom TSQLRestServerAuthenticationClass.

Instead of messing with the authentication classes, I would use default auth, and provide additional service interface methods for your recapcha logic, or put the recapcha info in the user name field.

Offline

#5 2017-12-23 15:48:11

keinn
Member
Registered: 2014-10-20
Posts: 100

Re: Is there a way of adding extra params while sending login request?

Thks for the reply , i will use the "Override the TSQLRestServerAuthenticationDefault Class " approche.

Offline

Board footer

Powered by FluxBB