Reputation: 2496
I'm using serviceStack for my first api service.
I have my own table "MyApiKeysTable" where I store multiple api key for users. I use Entity Framework.
If I use OrmLiteAuthRepository it create it's own apikey table.
What I have to do to use my own table "MyApiKeysTable"?
(I don't want to use OrmLite but stil continue to use EntityFramework.)
There is some example?
Upvotes: 1
Views: 195
Reputation: 143389
You can't use your own ApiKey
type, ServiceStack's API Key AuthProvider resolves its API Keys from Auth Repositories which implement the IManageApiKeys interface which all ServiceStack Auth Repositories that support API Key persistence implements.
You would need to create your own Auth Repository like the OrmLiteAuthRepository and implement IManageApiKeys
how you like, but it needs to at least return a class that inherits the ApiKey
class.
Implementing your own Auth Repository requires a fair bit of effort, which I'd recommend against as OrmLite is a lightweight code-first POCO ORM that only needs its OrmLiteConnectionFactory configured with a db connection string, you can still use EF for the rest of your App, but I'd be taking advantage of the existing Auth Repositories.
The alternative is to ignore ServiceStack's API Key Auth Provider and implement your own that uses your preferred data access libraries, you can use ApiKeyAuthProvider implementation as a guide.
Upvotes: 1