Skip to content

Instantly share code, notes, and snippets.

@hastef88
Last active August 21, 2018 09:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hastef88/116d46ec66c2957a9820624c344e5d8f to your computer and use it in GitHub Desktop.
Save hastef88/116d46ec66c2957a9820624c344e5d8f to your computer and use it in GitHub Desktop.
function onInitialRequest(context) {
executeStep(1, {
onSuccess: function (context) {
Log.info('First Authentication success');
var subject = context.steps[1].subject;
var requestIP = "" + context.request.headers["x-forwarded-for"];
var knownIPs = "" + subject.localClaims['http://wso2.org/claims/identity/trustedips'];
Log.info('Request IP: ' + requestIP);
Log.info('KnownIPs: ' + knownIPs);
if (knownIPs != requestIP) {
executeStep(2);
}
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment