Try our conversational search powered by Generative AI!

ID as username with OpenId Connect

Vote:
 

Hi,

I've implemented OpenId Connect in EPi with our Entity Server solution. Everything seems to work. What I would like to do now is to take the users id, for example "12345", and use that id as the username. If i set the NameClaimType to the claim containing the id this works fine but in edit mode it looks kinda sad. Everywhere where users are displayed all you see is this id. For example if you look at a page under "alternative" it says "Last changed by 12345". In the claims I also have the users GivenName and SurName which is successfully synchronized and stored in the DB (tblSynchedUser). 

Now to the question: Can i tell EPi to display the GivenName and SurName in edit mode instead of the username? So it, for example, says "Last changed by John Doe"?

We are on version 11.

#261442
Sep 01, 2021 17:19
Vote:
 

Yes, it is possible. You need to register a custom transformer like this:

    [ServiceConfiguration(typeof(IModelTransform), Lifecycle = ServiceInstanceScope.Singleton)]
    public class ContentDataStoreModelTransform : TransformBase<ContentDataStoreModel>
    {
        public override TransformOrder Order => TransformOrder.TransformEnd;

        public override void TransformInstance(IContent source, ContentDataStoreModel target, IModelTransformContext context)
        {
            target.ChangedBy = GetRealUserFullName(target.ChangedBy);
            target.CreatedBy = GetRealUserFullName(target.CreatedBy);
            target.DeletedBy = GetRealUserFullName(target.DeletedBy);
            target.PublishedBy = GetRealUserFullName(target.PublishedBy);
        }

        public string GetRealUserFullName(string username)
        {
            // convert username to fullname
            return "FOO";
        }
    }
#265060
Oct 14, 2021 8:10
Vote:
 

That worked great. Thank you very much!

#266283
Nov 05, 2021 13:24
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.