Add more properties to authentication response

Hi,
i want to add more information to my authentication response.

Today it returns

But i have some more properties in my session object, in example CustomerId

{  
  "UserId": "00000000-0000-0000-0000-000000000010",
  "SessionId": "8M62mSYLC3ADR4eSDcCl",
  "UserName": "demo@xxxx.se",
  "DisplayName": "demo@xxxxxx.se",
  "BearerToken": "xxxxxxxxxxxx",
  "ResponseStatus": {}
}

Thx!

The AuthenticateResponse DTO is fixed but you add additional info in its Meta Dictionary using a Response Filter or if you’re using a Custom Provider you can implement IAuthResponseFilter

Hi Mythz,
thx for your response.
I tried to use a response filter but dont get any DTO returned.
The res.Dto i null

   public class AuthenticationResponseFilter
{
    public AuthenticationResponseFilter(IDbConnectionFactory dbFactory)
    {
        _dbFactory = dbFactory;
    }

    private IDbConnectionFactory _dbFactory { get; set; }

    public void AddProperties(IRequest req, IResponse res, object dto)
    {

        if (res.Dto.GetType() == typeof(AuthenticateResponse))
        {
            AspnetMembershipAuthSession cs = req.GetSession() as AspnetMembershipAuthSession;
            Dictionary<string, string> otherData = new Dictionary<string, string>();
            otherData.Add("CustomerId", cs.CustomerId.ToString());
            ((AuthenticateResponse)res.Dto).Meta = otherData;
        }



    }

 
}

This is only if you’re using a Custom AuthProvider, you can have it implement IAuthResponseFilter which will register a callback.