AuthenticateUser() throws null reference

Posted by Community Admin on 03-Aug-2018 09:40

AuthenticateUser() throws null reference

All Replies

Posted by Community Admin on 09-Mar-2016 00:00

I'm trying to use the below method 

SecurityManager.AuthenticateUser("Default", "username", "password", true);

but it always throws null reference as

"Object reference not set to an instance of an object.

Can anyone explain about this?

Posted by Community Admin on 11-Mar-2016 00:00

Hello,

Please try one of the other overloads of the method:

Telerik.Sitefinity.Security.Model.User user;
SecurityManager.AuthenticateUser("Default", "username", "password", true, out user);

Also confirm that a user with that username exists in Sitefinity by trying to login using the default backend login. Please also let us know on what version of Sitefinity are you experiencing the problem?

Furthermore, if possible, please provide us with the complete stack trace of the exception from the error logs so we can see exactly where the problem happens.

Regards,
Velizar Bishurov
Telerik
 
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
 

Posted by Community Admin on 14-Mar-2016 00:00

Hi Velizar,

Still i'm fighting hard with the same issue, i'm passing a valid credentials and also i can successfully login using the  same one in the back end login page.

Currently i'm working on  Sitefinity 8.0.5710 version.

Below are the Exception details FYR

  • Message : Object reference not set to an instance of an object.
  • Source : Microsoft.IdentityModel
  • Stacktrace :
      at Microsoft.IdentityModel.Web.SessionAuthenticationModule.ValidateSessionToken(SessionSecurityToken sessionSecurityToken)
       at Microsoft.IdentityModel.Web.SessionAuthenticationModule.SetPrincipalFromSessionToken(SessionSecurityToken sessionSecurityToken)
       at Microsoft.IdentityModel.Web.SessionAuthenticationModule.AuthenticateSessionSecurityToken(SessionSecurityToken sessionToken, Boolean writeCookie)
       at Telerik.Sitefinity.Security.Claims.SitefinityClaimsAuthenticationModule.AuthenticatePrincipalWithCurrentToken(IClaimsPrincipal principal, Boolean persistent)
       at Telerik.Sitefinity.Security.SecurityManager.AuthenticateUser(User user, UserManager manager, Boolean persistent)
       at Telerik.Sitefinity.Security.SecurityManager.AuthenticateUser(String membershipProviderName, String userName, String password, Boolean persistent, User& user)
       at BWSitefinity.SitefinityMethods.CreatePage(Guid pageId, String pageName, Boolean isHomePage, Guid parentPageNodeId, String url) in e:\Projects\pages.cs:line 137

 

  • Target site :TargetSite =  Microsoft.IdentityModel.Claims.ClaimsIdentityCollection ValidateSessionToken(Microsoft.IdentityModel.Tokens.SessionSecurityToken)

 

Note : Authenticate() method is being executed in a cs file, i'm calling it from an installer.cs of one of the controls.

Posted by Community Admin on 17-Mar-2016 00:00

Hi,

Unfortunately the stack trace does not really provide enough information on the issue. To investigate further please open a support ticket so we can provide you with a way to get your project to us and debug it.

Regards,
Velizar Bishurov
Telerik

 
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
 

Posted by Community Admin on 30-Mar-2016 00:00

Hi  Velizar,

Actually what i'm trying to do is, creating pages in the installer part of a widget.

It has to happen at the application starts event, at the moment a particular widget is installed using installer.cs (rewriting the config for layout/toolbox).

 

Is it a possible scenario, or is there any way we can achieve it?

Posted by Community Admin on 04-Apr-2016 00:00

Hello,

I am sorry to say that what you are trying to achieve is not possible on the Application_Start event as at this point no manager or provider has initialized yet.

One option to workaround this would be to create a scheduled task for one minute later for example.

Regards,
Velizar Bishurov
Telerik

 
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
 

This thread is closed