Doubt on how to post a method to a web service, hide

Asked

Viewed 295 times

0

What I’m going to ask I don’t know if it’s possible or how to do it. Well, I have a REST that so far is ok. There, they changed a rule here that directly affects the REST API. I have a method that generates ID for partners. Until then is good, but now I need to continue generating the Ids, but in the following way. If you meet a rule here, the ID is generated only for our support. They interfere with the POS and try to solve it. If the remote access they do, can not meet, then they use the partner that will be consumed via REST API. Is there any way I can create a method that can be visible only to a particular application and etc, or there is no way to do this?

As I said use REST with WCF.

1 answer

1

One idea that can be interesting is you separate your services by customer. So each customer has reference to his service and the methods he wants to perform in specific, example:

Client A accesses Servicoa methods:

[ServiceContract(Namespace="")]
public interface IServicoA
{
    [OperationContract]
    [WebGet(UriTemplate="/ObterId")]
    MetodoGeraId()
}

Client B accesses Servicob methods:

[ServiceContract(Namespace="")]
public interface IServicoB
{
    [OperationContract]
    [WebGet(UriTemplate="/ObterAlgo")]
    MetodoB();
}

Another option would be to customize as the WCF service to authenticate and authorize the client, analyzing their credentials, verifying whether these are valid in a given repository and determining whether or not they have the right to perform the operation/method of their service.

Then, when calling a method from your service, the user would pass the credentials (user/password) for you to validate in your WCF service whether or not he can perform that method.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.