I have a custom credentials auth provider that overrides the built in CredentialsAuthProvider.
In the TryAuthenticateAsync method I want to check if it is an inprocess request.
What I have found is that IRequest.IsInProcessRequest() initially returns true, but after calling await authRepo.GetUserAuthByUserNameAsync(userName).ConfigAwait(); the result of IRequest.IsInProcessRequest() is false. I can also see that authService.Request.RequestAttributes changes from
Localhost | Secure | HttpPost | Reply | Json | Http | InProcess
to
Localhost | Secure | HttpPost | Reply | Json | Http
I am not sure this is a ServiceStack issue, but maybe you have an idea what could be happening?
Any help would be greatly appreciated!
The code (ServiceStack 6.02. Dotnet 6):
public override async Task<bool> TryAuthenticateAsync(IServiceBase authService, string userName, string password, CancellationToken token = default)
{
IUserAuth userAuth;
var authRepo = GetUserAuthRepositoryAsync(authService.Request);
await using (authRepo as IAsyncDisposable)
{
Debug.WriteLine(authService.Request.IsInProcessRequest()); //=>True
userAuth = await authRepo.GetUserAuthByUserNameAsync(userName).ConfigAwait();
Debug.WriteLine(authService.Request.IsInProcessRequest()); //=>False
}
}