We have a requirement to restrict login for users of a specific partner account to a portal by IP addresses. All the other partners should be unaffected. I know I can use SourceIp from User Sessions to restrict it by Apex, but I wonder if it's possible to do with OOTB functionality?


If you can assign the users of this specific partner to a unique profile, then you can use the OOTB profile feature that allows restricting login by IP. Without a profile to use as your decision point, your fallback option is a custom login flow. The Conditional Two–Factor login flow sample provided by Salesforce shows how you can make a decision based on an IP address; here's another example.

Last but not least if your org is licensed for Shield or Event Monitoring you can define transaction security policies. Doing so does require Apex but it's still worth a mention for the sake of completeness. Salesforce docs have a ready-made example that shows IP-based login restriction.

| improve this answer | |
  • Thank you for the comment. Specific profile is not an option for us, other partners may ask for the same feature. But everything else seems promising. We may end up using custom apex. Will mark your answer as correct for others to refer to – nchursin Jun 19 '19 at 15:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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