I’ve made a custom auth repository modeled off of other auth repositories. I’m using it in combination with the credentials auth provider and found an issue today regarding the PopulateSession
method.
Seems this provider (and perhaps all the providers?) require an integer user auth id now?
Even though my auth repository is using the correct string Id for my user DTOs - the credentials auth provider is forcing the use of the IUserAuth.Id
to get auth details (which already exist) for the session information.
public void PopulateSession(IUserAuthRepository authRepo, IUserAuth userAuth, IAuthSession session)
{
if (authRepo == null)
return;
var holdSessionId = session.Id;
session.PopulateWith(userAuth); //overwrites session.Id
session.Id = holdSessionId;
session.IsAuthenticated = true;
session.UserAuthId = userAuth.Id.ToString(CultureInfo.InvariantCulture);
session.ProviderOAuthAccess = authRepo.GetUserAuthDetails(session.UserAuthId)
.ConvertAll(x => (IAuthTokens)x);
}
in my case I am using string ids for users so userAuth.Id
is 0 - causing issues with everything that uses session.UserAuthId
I am assuming in order for this to work I’ll need to write a subclass of AuthProvider
which populates session.UserAuthId
differently?