+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / AuthenticateUser() throws null reference

AuthenticateUser() throws null reference

6 posts, 0 answered
  1. Balaji
    Balaji avatar
    4 posts
    Registered:
    15 Jun 2015
    09 Mar
    Link to this post

    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?

  2. Velizar Bishurov
    Velizar Bishurov avatar
    143 posts
    Registered:
    01 Dec 2016
    11 Mar
    Link to this post
    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
     
  3. Balaji
    Balaji avatar
    4 posts
    Registered:
    15 Jun 2015
    14 Mar in reply to Velizar Bishurov
    Link to this post

    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.

  4. Velizar Bishurov
    Velizar Bishurov avatar
    143 posts
    Registered:
    01 Dec 2016
    17 Mar
    Link to this post
    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
     
  5. Balaji
    Balaji avatar
    4 posts
    Registered:
    15 Jun 2015
    30 Mar
    Link to this post

    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?

  6. Velizar Bishurov
    Velizar Bishurov avatar
    143 posts
    Registered:
    01 Dec 2016
    04 Apr
    Link to this post
    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
     
6 posts, 0 answered