Odata 1-3 custom authentication and odata

Source: Internet
Author: User

Compared with Windows authenticationProgramThe app is more about user-defined identity authentication.

1. perform authentication in the WCF Service

Code

  Public     Class  Odatabaseservice  <  T  >  : Dataservice  <  T  > //  , Iserviceprovider  
{
Public Odatabaseservice ()
{
This . Processingpipeline. processingrequest + = New Eventhandler < Dataserviceprocessingpipelineeventargs > (Processingpipeline_processingrequest );
}
Void Processingpipeline_processingrequest ( Object Sender, dataserviceprocessingpipelineeventargs E)
{
If (Authenticate (httpcontext. Current )) // Here, we use HTTP header or other HTTP request content to determine the user and permissions.
Throw New Dataserviceexception ( 401 , " 401 unauthorized " );
}

Here I still have some questions. For example, the client data is unstructured, although the method name column has everything,

However, you need to implement your own analysis.CodeIt is always troublesome to determine what permissions the customer accesses (for example, what tables and columns ).

I hope there will be official Microsoft implementations or third-party implementations (I have not found them yet)

 

2. Use httpmodule for verification.

In fact, the implementation of this method is the same as that in WCF... it's just a different place.

 

3. oauth wrap

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.