I have a custom IdentityProvidersProcessor
for federated user authentication for a front-end user facing site. I would like to also Identify the user as a Contact when they log in. When is the best time / place to Identify the Contact? I tried it in the SecurityTokenValidated
notification but the Tracker is not available at this point in the middleware.
-
If performance is not a big concern , you could try initlialize tracker on successfull auth– Abhay DharCommented Aug 31, 2020 at 13:24
-
I tried, it didn't work– Mark GibbonsCommented Aug 31, 2020 at 22:54
-
Were there any exceptions raised ? The tracker can get initialized from anywhere , not sure if its throwing an exception which is not logged. maybe try debugging the starttracker() to see if its not throwing an exception ?– Abhay DharCommented Sep 1, 2020 at 11:01
-
No exceptions, just Tracker.Current is still null. I think it makes sense that there would not be the tracker and session available at that point.– Mark GibbonsCommented Sep 1, 2020 at 23:40
Add a comment
|
1 Answer
The method I went with in the end is to have a httpRequestProcessed
pipeline processor that does the following
- Check if the tracker contact is not null and the context user is authenticated
- Check a custom session variable is set of whether this pipeline has run
- Identify the contact and then set the custom session variable is set of whether this pipeline has run