Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Tim C 161 posts 528 karma points
    Jun 01, 2016 @ 12:22
    Tim C
    0

    Cookie - umb_context

    [update]

    Apparently the table is no longer used. Found a way to get user name and if logged in

    @using Umbraco.Core.Security
    ...
    
    var ticket = wrapper.GetUmbracoAuthTicket();
                isLoggedIn = 0;
                if (ticket!=null){
                    if(ticket.GetRemainingAuthSeconds() > 0){
                        isLoggedIn = 1;
                    }
                    loggedInUsername = ticket.Name.ToString();
                }else{
                    loggedInUsername = "";
                }
    

    I have developed a web service to update some non Umbraco data (in a new table in the Umbraco SQL db).

    Although it doesn't have to be secure, I would like to perform some basic checks that the person calling the web service is logged in as an Umbraco User (note even though the web service is called from the front end, the person would be logged in as a back end user, not a front end member).

    I notice Umbraco writes a cookie

    UMB_CONTEXT
    

    which according to http://www.theoutfield.co.uk/blog/2013/03/umbraco-cookies

    Stores a Guid reference to the current logged in user. Randomly generated at login and stored in the umbracoUserLogins database table, it allows you access the current user, without having to store any user specific data in the cookie.

    This would be ideal : my web service could sql query the umbracoUserLogins table with the value of the cookie confirming the user is logged in and who the user is.

    (yes, someone could simulate this with their own cookies, but guessing a 1,088 character string is unlikely!)

    However, I am using Umbraco 7.4 and can't find this table in the SQL database - is this now gone?

    If so, has anyone any ideas on validating a user session on a web service call?

    Thanks

Please Sign in or register to post replies

Write your reply to:

Draft