Introduction to WCF Role services

Source: Internet
Author: User

The WCF role service is able to access the role of a user from any application that can send and use SOAP messages. This can include applications that do not use the. NET framework. As a result, users of these different applications can have the same role in each application. In general, you can check the user's role to determine what permissions the user has to perform.

The role service provides only a subset of the features that are available through asp.net role management. You can retrieve the role of a user through the role service or check whether a user is in a specific role. The user must be authenticated to read the user's role. The role service can use any type of asp.net authentication.

System.Web.ApplicationServices.RoleService is a role service implementation provided by. NET, and the RoleService class exposes two methods that should only be accessed through WCF services:

Getrolesforcurrentuser method (returns all roles for logged-in user)

Iscurrentuserinrole method (determines whether the user belongs to the specified role)

The RoleService object raises the Selectingprovider event. Create an event handler for the Selectingprovider event to select the role provider to use at run time. The following code demonstrates how to enable the role service in a configuration file:

<system.web.extensions>
    
  <scripting>
    
    <webServices>
    
      <roleservice enabled= "true"/ >
    
    </webServices>
    
  </scripting>
    
</system.web.extensions>

The use of role services is basically similar to the WCF authentication Service, which is no longer an example, please refer to the contents of the WCF authentication Service on the previous blog.

In addition, you can implement client-side validation by requesting the WCF role service via Ajax on the client side.

----------------------Note: This part of the content is adapted from the. NET Security Revelation "

Author: Hyun-Soul

Source: http://www.cnblogs.com/xuanhun/

See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/Programming/net/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.