Introduce X-Forwarded-For for login
Change-Id: I327fde4c35d27af8a04be3fe975f7dc9197a7cad
diff --git a/lib/Kalamar/Plugin/KalamarUser.pm b/lib/Kalamar/Plugin/KalamarUser.pm
index 88de452..3465b1d 100644
--- a/lib/Kalamar/Plugin/KalamarUser.pm
+++ b/lib/Kalamar/Plugin/KalamarUser.pm
@@ -124,8 +124,15 @@
$c->app->log->debug("Login from user $user:$pwd");
my $url = Mojo::URL->new($plugin->api)->path('auth/apiToken');
+
+ # Find client ip
+ my $client = $c->client_ip;
+ my %add;
+ %add = ('X-Forwarded-For' => $client) if $client;
+
my $tx = $plugin->ua->get($url => {
- Authorization => 'Basic ' . b($user . ':' . $pwd)->b64_encode->trim
+ Authorization => 'Basic ' . b($user . ':' . $pwd)->b64_encode->trim,
+ %add
});
# Login successful