Posted on 09/11/2016 23:53:16
Hi Morten,
You know if someone descovers your IP, than they will have full access to your solution?
Be sure to consider security seriously.
But if you stil must implement this (customer insists) here is my suggestion on how to solve this:
1) First you need a place in API where your logic is going to run and where you are going to identify for IP adress.
I would suggest doing it in page load event
[Subscribe(Dynamicweb.Notifications.Standard.Page.Loaded)]
public class PageLoaded : NotificationSubscriber
{
public override void OnNotify(string notification, Dynamicweb.Extensibility.NotificationArgs args)
{
if (args == null)
return;
//TODO: Step 1) Check your IP
//TODO: Step 2) Authenticate user via API
}
}
2) Check your IP
var IP = HttpContext.Current.Request.Headers.Get("HTTP_X_FORWARDED_FOR")
3) If IP is right - than you can authenticate user by using API
http://doc.dynamicweb.com/forum?M=BasicForum&PID=1605&ThreadID=44540
Please be sure to consider security measures.
/Dmitrij