What does it take to implement authentication provider for ServiceStack with RavenDB datastore?

I've been looking at the ServiceStack's SocialBootstrapAPI example app and it seems most of the wiring is done inside the AppHost class. That is the wiring.

Looking at this page, there are some clues and I might just start coding away but I fear I might miss some points along the way: https://github.com/ServiceStack/ServiceStack/wiki/Authentication-and-authorization

I know I have to inherit CredentialsAuthProvider and override TryAuthenticate but I guess I also have to implement IUserAuthRepository to work with RavenDB database.

So I came up with just one class, someone please tell me if this will work (if anyone has done it before):

public sealed class RavenDBAuthProvider : CredentialsAuthProvider, IUserAuthRepository

will this be enough or is there anything else ?

Answers


You only need to implement IUserAuthRepository which is what all the built-in Auth providers use to persist the UserAuth Info.

If you want to change the data models used i.e. use something other than UserAuth / UserOAuthProvider POCOs then you want to implement your own AuthProviders as well. CredentialsAuthProvider just allows the standard User/Password form authentication.

The existing IUserAuthRepositoryimplementations should be a good reference on how to go about implementing it:

If you would like, we would welcome the addition to the ServiceStack.Contrib project, and we can include it in the deployment cycle of ServiceStack's NuGet packages.


Need Your Help


About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.