Java 应用程序间身份验证的建议(Salesforce->;Heroku)
在过去的一周里,我一直在努力为我的实现获得理想的配置。基本上,我有一个Salesforce页面,该页面生成一个REST调用,其中包含一些要计算的数据,Heroku服务器然后计算这些数据,然后在响应中将计算出的数据发送回SF。这一切都发生在后台,因此不存在Heroku前端 我想用oAuth2保护此调用,但我不确定最好的方法: 数据本身并不重要,重要的是访问heroku应用程序 如果我使用salesforce进行身份验证,这意味着callout结构不起作用(我必须为Heroku实现一个系统,以便在返回SF之前从SF中获取数据),这并不理想,我也看不到使用Heroku身份验证的方法,因为它允许访问api,但不允许在单个结构中访问应用程序脚本。我想我必须在Heroku中创建自己的身份验证服务器,但我不确定这是否是正确的方法。 任何提示都将不胜感激 这是我的SF编号:Java 应用程序间身份验证的建议(Salesforce->;Heroku),java,rest,heroku,oauth,salesforce,Java,Rest,Heroku,Oauth,Salesforce,在过去的一周里,我一直在努力为我的实现获得理想的配置。基本上,我有一个Salesforce页面,该页面生成一个REST调用,其中包含一些要计算的数据,Heroku服务器然后计算这些数据,然后在响应中将计算出的数据发送回SF。这一切都发生在后台,因此不存在Heroku前端 我想用oAuth2保护此调用,但我不确定最好的方法: 数据本身并不重要,重要的是访问heroku应用程序 如果我使用salesforce进行身份验证,这意味着callout结构不起作用(我必须为Heroku实现一个系统,以便在返
Http http = new Http();
HttpRequest request = new HttpRequest();
//Sets the url to heroku
request.setEndpoint('My App URL');
request.setMethod('POST');
request.setHeader('Content-Type', 'application/json');
//places the content into the body
request.setBody(content);
//Extends the read timeout
request.setTimeout('120000');
//Sends the request and waits for a response
HttpResponse response;
response = http.send(request);
希罗库方面:
post("/", (req, res) -> {
//creates a local var for the JSON string
String data = req.body();
//--** The server then computes this data and calculates output
String computedData = compute(data);
return computedData;
});
我需要一种验证这种连接类型的方法,谢谢 你读了给OAuth的信了吗?这很有帮助。流程将是:-
GEThttps://id.heroku.com/oauth/authorize?client_id={client id}&response_type=code&scope={scopes}&state={anti-forgery-token}
由于您需要的是身份验证,而不是授权,因此您可以采取几种方法,具体取决于您需要投入的工作量和安全性(您必须对此进行调用)
你读到OAuthe了吗?这很有帮助。流程将是:-
GEThttps://id.heroku.com/oauth/authorize?client_id={client id}&response_type=code&scope={scopes}&state={anti-forgery-token}
由于您需要的是身份验证,而不是授权,因此您可以采取几种方法,具体取决于您需要投入的工作量和安全性(您必须对此进行调用)