Skip to content

ServiceStack UserAuthRepository implementation using Marten Document Store

Notifications You must be signed in to change notification settings

migajek/ServiceStack.Authentication.Marten

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ServiceStack.Authentication.Marten

This project provides an implementation of ServiceStack's UserAuthRepository using Marten for storage.

Key features

  • .NET 6 +
  • it's generic: supports custom implementations of UserAuth and UserAuthDetails
  • handles user & role/permission management (implements IUserAuthRepository, IManageRoles)
  • handles API Key management (implements IManageApiKeys)

Release Notes

  • 0.8.0 updated to Marten >= 6.0.5, ServiceStack >= 6.5.0
  • 0.6.0 updated hashing to reflect changes in ServiceStack 5. Extacted public CreateUser method to be used with event store projections
  • 0.5.0 implemented IManageApiKeys
  • 0.4.0 support for ServiceStack >= 5.0
  • 0.3.0 support for Marten >= 2.0

Getting started

  1. install it via nuget Install-Package ServiceStack.Authentication.Marten

  2. when configuring Marten, use an AuthRepository() extension method to configure the storage for both UserAuth and UserAuthDetails types (or your own implementations, when using generic version)

    DocumentStore.For(opts =>
             {      
                 opts.AuthRepository()
                     .UseAuth<UserAuth>()
                     .UseAuthDetails<UserAuthDetails>();
             });
  3. register the auth repository in the container

    // ex.: container.Register<IDocumentStore>(c => new DocumentStoreBuilder().Build())
    //            .ReusedWithin(ReuseScope.Hierarchy);
    container.RegisterAutoWiredAs<MartenAuthRepository, IUserAuthRepository>()
                .ReusedWithin(ReuseScope.Hierarchy);

Missing features / roadmap

  • no support for Marten as Event Store (yet ..) provide demo of Event Store approach
  • optional StoreChanges call when re-using IDocumentSession
  • full test coverage

About

ServiceStack UserAuthRepository implementation using Marten Document Store

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published