Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

Is there a way to force clients of REST service to use their sessionId to access a REST service ? I can currently access this URL without any sessionId https://ddddddd.force.com/services/apexrest/contacts/00sddd5/employees

I did add the Rest service class RESTClass... to the Public Access Settings of the tools Sites -> Apex Class Access.

http://www.salesforce.com/us/developer/docs/apexcode/index_Left.htm#CSHID=apex_rest_code_sample_basic.htm%7CStartTopic=Content%2Fapex_rest_code_sample_basic.htm%7CSkinName=webhelp

Apex class methods that are exposed through the Apex REST API don't enforce object permissions and field-level security by default. We recommend that you make use of the appropriate object or field describe result methods to check the current user’s access level on the objects and fields that the Apex REST API method is accessing. See Schema.DescribeSObjectResult and Schema.DescribeFieldResult. - Exposing Data with Apex REST Web Service Methods

Schema.DescribeFieldResult F = Employee_c.Termination_Date__c.getDescribe();

F.isAccessible() returns true if user is allowed to see this field

Boy-if we have to do this for all fields even if we use a utility, that is a pain.

TIA

share|improve this question
9  
If you want to force authenticated access, don't add it to the public site. –  superfell Nov 5 '12 at 15:46
1  
@superfell Also, will proxying access via a Remote App help ? salesforce.com/us/developer/docs/api_rest/… –  techtrekker Nov 5 '12 at 16:12
add comment

1 Answer

The issue is that you would like to authenticate users before allowing access to the web service, but you are exposing the web service with public access. You will need to reduce the security to only internal users.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.