Why is IManageApiKeys not allowed using the ServiceStack ApiKeyAuthProvider?

Here is my auth config

Plugins.Add(new AuthFeature(() => new AuthUserSession(), new IAuthProvider[] {
   new ApiKeyAuthProvider(AppSettings) { RequireSecureConnection = false, InitSchema = true},
   new CredentialsAuthProvider(AppSettings)
   })
   {
      IncludeRegistrationService = true,

   });
container.Register<IAuthRepository>(c => new OrmLiteAuthRepository(dbFactory));
   container.Resolve<IAuthRepository>().InitSchema();

When trying to resolve the dependency of IManageApiKeys in service, it throws an exception. Cannot cast an object of type "ServiceStack.Auth.OrmLiteAuthRepository" to type "ServiceStack.Auth.IManageApiKeys

var apiRepo = (IManageApiKeys)base.TryResolve<IAuthRepository>();

I cannot figure out how to resolve the IManageApiKeys dependency, and it does not create the ApiKey table via InitSchema (), however, UserAuth, UserAuthDetails and UserAuthRole are created.

+4
source share
1 answer

OrmLiteAuthRepository IManageApiKeys , OrmLiteAuthRepository, ServiceStack.Server NuGet - , ServiceStack NuGet.

/packages , ServiceStack , , .

+2

Source: https://habr.com/ru/post/1670031/


All Articles