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

Forums / Developing with Sitefinity / Request and Validate Sitefinity SWT

Request and Validate Sitefinity SWT

6 posts, 0 answered
  1. Walter
    Walter avatar
    1 posts
    Registered:
    14 Apr 2014
    28 Apr 2014
    Link to this post

    Hi SF developers,


    I'm trying to integrate Sitefinity's claims based authentication with our web api. The requirement is quite simple:

    User logs into Sitefinity with a user name and password, when the widget needs to call the backend WebApi, it retrieves a token from Sitefinity and presents it to the api. The Api validates the token and if valid, perform the action, otherwise reject it.


    Does this sound like a simple and reasonable scenario with Sitefinity?


    I've configured sitefinity 6.3 to use Claims Based Authentication and added a replying party for the web api host.


    What I need some help with is sample code on how to request and validate the token.


    Thanks in advance.

    Walter
  2. Vassil Vassilev
     Vassil Vassilev avatar
    308 posts
    Registered:
    21 Jan 2015
    08 May 2014
    Link to this post
    Hello Walter,

    Actually once a user has been susscessfully logged you could perform the following:
    var user = ClaimsManager.GetCurrentIdentity();
    var isAuthenticated = user.IsAuthenticated;
    var isBackend = user.IsBackendUser;
    var isUnrestricted = user.IsUnrestricted;

    Hope this helps

    Regards,
    Vassil
     
  3. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    08 May 2014 in reply to Vassil Vassilev
    Link to this post

    @Vassil

     ..."IsUnrestricted" is that a combination of backend and admin or something?....

  4. Vassil Vassilev
     Vassil Vassilev avatar
    308 posts
    Registered:
    21 Jan 2015
    09 May 2014
    Link to this post
    Hi,

    A role is unrestricted when it is granted ultimate permissions.

    Regards,
    Vassil Vassilev
  5. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    09 May 2014 in reply to Vassil Vassilev
    Link to this post

    Well there's no Ultimate Permission button :) ...so is it just Administrator or...?

     Do you know what I mean?

  6. Vassil Vassilev
     Vassil Vassilev avatar
    308 posts
    Registered:
    21 Jan 2015
    09 May 2014
    Link to this post
    Hi Steve,

    Correct, IsUnrestricted returns a bool value if the user belongs to an Administrators role.

    Regards,
    Vassil Vassilev
    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