I’m using the basic CredentialsAuthProvider:
appHost.Plugins.Add(new AuthFeature(() => new CustomUserSession(),
new IAuthProvider[] {
new CredentialsAuthProvider(appSettings),
new JwtAuthProvider(appSettings) {
RequireSecureConnection=false,
AuthKey = AesUtils.CreateKey(),
UseTokenCookie = false
},
})
{
IncludeDefaultLogin = false, IncludeRolesInAuthenticateResponse = true
});
The CustomUserSession
is for future:
public class CustomUserSession : AuthUserSession
{
}
However I have a custom auth repo:
public class ArangoDbAuthRepository : IUserAuthRepositoryAsync, IClearable, IManageRolesAsync, IManageRoles
for which I have implemented the interfaces.
The IManageRoles
was added later as a part of debugging, but haven’t changed anything (for better or worse),
This is setup like normal in the Configure.AuthRepository file:
services.AddSingleton<IAuthRepositoryAsync>(userRepo);
services.AddSingleton<IManageRolesAsync>(userRepo); // for CredentialsAuthProvider to fetch roles from here (inspeced the source)
The strange thing is that in the response from Authenticate, the JWT does contain the roles. So my Auth Repo must be fetching these.
But the session does not have them, and neither does the response body.