How to set EPiServer.Community.CommunitySystem.CurrentContext.DefaultSecurity.CurrentUser after OpenId Connect authentication?

Vote:
 
We changed the authentication from Forms based to OpenId Connect authentication in our legacy solution which still use EPiServer.Community.xx.

We used to have SecurityHandler.Instance.AuthenticateUser(LoginUnameBox.Text, LoginPasswBox.Text, out user)on login, which sets EPiServer.Community.CommunitySystem.CurrentContext.DefaultSecurity.CurrentUser and it is heavily used all over the code.

Now after new OpenId Connect login, we can't do the same because we don't have Username and Password. I tried to get IUser by uniqueID and get Username & Password from DB and authenticate, but it fails.

However, we have System.Web.HttpContext.Current.User.Identity is set correctly. And EPiServer.Community.CommunitySystem.CurrentContext.DefaultSecurity.CurrentUser is NULL and we need to set it accordinly. Because we need the legacy code to continue to work as it is without putting much effort to change the code.

#229731
Oct 22, 2020 8:33
* 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.