Hi,
I am creating a test application to demonstrate the authentication in the TMS XData implementation.
I have followed the examples in documentation and have the following questions:
I have implemented a "LoginService" and "ServerStats".
Login does not contain [Authorize]
I have included the required attribute in the "ServerStats" as follow:
[ServiceContract]
[Authorize]
IServerStatsService = interface(IInvokable)
['{A5D58D26-D6DE-4E00-86B9-3617BCA97794}']
function EchoString(Value: string): string;
end;
When starting my modules, I have implemented logic as follow:
...
RegisterOpenAPIService;
RegisterSwaggerUIService;
fXDataModule.SwaggerOptions.AuthMode := TSwaggerAuthMode.Jwt;
...
fXDataModule.AddMiddleware(TJwtMiddleware.Create(DEFAULT_SECRET));
- I am able to execute "EchoString" even though I am not authenticated.
- Having a look at the TJwtMiddleware.ProcessRequest checks for ForbidAnonymousAccess, but when I enable this, I cant even open Swagger or execute my Login.
e.g fXDataModule.AddMiddleware(TJwtMiddleware.Create(DEFAULT_SECRET,true));
Am I missing something else in the implementation?
Regards,
Jacques