Click here to Skip to main content
15,888,254 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
Hi, i am new to WCF Services.

I have created 2 methods in wcf services like this:

[OperationContract]
string GetEmployee(int i);

[OperationContract]
string GetEmployeeDetails(int i);

After i successfully build the project and used the service reference, i am able to see both the methods (GetEmployee & GetEmployeeDetails).

Suppose if i need to provide this Service method "GetEmployee" to outside of my organization, how can i prevent others from accessing "GetEmployeeDetails" method which resides in the same service?

Hope, everyone understand my requirement. Please suggest me how to
achive this

Regards,
Veerendranadh
Posted

Hi Veerendranadh,
I'd say that if both methods are in the same endpoint/interface they will have the same security configuration (certificate, credentials or whatever). Then, what the calls from inside the company would have an authentication with more rights than a user from outside. You could implement this with user roles.
Another option is to create two interfaces, one to be accessed from inside and the other from outside. You could require a certificate for internal access, so it could be very secure.

Note that there are many ways to implement this. From here you can study both directions.

Regards,

Francesc
 
Share this answer
 
Both methods will share the same security configuration as they are in the same service with the same endpoint configuration. You would have to either seperate the methods into different services or provide additional security checks to one of the methods, such as passing a username and password to validate authorization.
 
Share this answer
 
Thanks Nischalke and Castells.

Your answers helped me to go further.
Thanks again.

Veerendranadh
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900