You are not logged in.
Pages: 1
I created a custom authentication class based on TRestServerAuthenticationDefault (to avoid re-implementing CheckPassword). My Auth() override is similar to the TRestServerAuthenticationDefault version but different enough that I can't use OnAuthenticationUserRetrieve. To get access to fSessionOS and AuthenticationFailed, which are both protected, I use the following hack:
TXAUriContext = class(TRestServerUriContext);
I then just cast CTxt to get to the protected members. This works fine on Windows but gives me a 216 runtime error on Linux/FPC (Invalid Typecast).
I'm no FPC expert so am not sure if there's a workaround, but would it be possible to have a setter for SessionOS and have AuthenticationFailed made public?
Thanks, Bob
Offline
Fixed on FPC by using the "as" cast rather than a hard one, i.e. this:
(Ctxt as TXAUriContext).fSessionOS := os;
Rather than this:
TXAUriContext(Ctxt).fSessionOS := os;
It would still be useful to have SessionOS and AuthenticationFailed accessible from other units though.
Cheers, Bob
Offline
I have committed
https://github.com/synopse/mORMot2/commit/f75ad22c
Online
Pages: 1