Doubt on how to publish a method in a web service, hide

0

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

As I spoke I use REST with WCF.

    
asked by anonymous 06.06.2014 / 18:33

1 answer

1

An idea that may be interesting is that you separate your services by client. So each client has reference to your service and the methods it wants to run in specific, for example:

Client A accesses the methods of ServiceA:

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

Client B accesses the ServicoB methods:

[ServiceContract(Namespace="")]
public interface IServicoB
{
    [OperationContract]
    [WebGet(UriTemplate="/ObterAlgo")]
    MetodoB();
}
Another option would be for you to customize how the WCF service authenticates and authorizes the client by analyzing their credentials, verifying that they are valid in a particular repository, and determining whether or not they have the right to perform the operation / method of their service .

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

    
06.06.2014 / 21:47