Integrating external membership

Untra stores all members in Umbraco membership and cache them in a simple memory cache of the Uintra app. To use a external membership provider( f.e. ActiveDirectory, Custom CRM, External Db) there are two possible ways to go explained below:

First scenario:

1. Replace Umbraco membership with another membership

This scenario is the easiest and probably most suitable:

a. First override "IntranetUserServiceBase.cs":

protected virtual T GetFromSql(Guid id)
                var member = _memberService.GetByKey(id);
                return member != null ? Map(member) : default(T);
        protected virtual IEnumerable<T> GetAllFromSql()
                var members = _memberService.GetAllMembers().Select(Map).ToList();
                return members;

b. Continue by replaceing "_memberService" with your custom service which gets members from external storage

c. Create your own Map method using your custom member mode


Second scenario:

2. Get members from external storage and put them in Umbraco membership.
In this scenario you need to write you own service which gets all members from your external storage and use Save(IntranetUserDTO user) from IntranetUserServiceBase.cs

a. But first you need to override it:

public virtual void Save(IntranetUserDTO user)
                var member = _memberService.GetByKey(user.Id);
                member.SetValue(ProfileConstants.FirstName, user.FirstName);
                member.SetValue(ProfileConstants.LastName, user.LastName);
                if (user.NewMedia.HasValue)
                                member.SetValue(ProfileConstants.Photo, user.NewMedia.Value);
                if (user.DeleteMedia)
                                member.SetValue(ProfileConstants.Photo, null);
                _memberService.Save(member, raiseEvents: false);

b. Then create a new member in Umbraco membership:  

        var member = _memberService.CreateMember()

c. Get them and extend with your custom prop:

        var member = _memberService.GetByKey(user.Id);
        member.SetValue(ProfileConstants.FirstName, user.FirstName);
        member.SetValue(ProfileConstants.LastName, user.LastName);
        member.SetValue("your custom ", value );

d. Then put the member Id in the cache "
e. Also you need provide mapping between you external member model to

You also able to extend
IntranetUserDTO with your custom properties by creating derived model from IntranetUserDTO


Didn't find what you were looking for?

Our site is a work in progress and feedback is very much appreciated. If you could not find information regarding your problem please contact or go to our github and create an issue if the problem relates to a bug or otherwise unintended technical functionality.