diff --git a/Constants/XAuthenticationScheme.cs b/Constants/XAuthenticationScheme.cs
index 32be81b..c5c19e4 100644
--- a/Constants/XAuthenticationScheme.cs
+++ b/Constants/XAuthenticationScheme.cs
@@ -6,5 +6,7 @@ namespace xIdentityService.Constants {
XToken,
[StringValue ("introspection")]
XIntrospection,
+ [StringValue("XApiKey")]
+ XApiKey,
}
}
\ No newline at end of file
diff --git a/Constants/XHeader.cs b/Constants/XHeader.cs
index ddceaa6..642f557 100644
--- a/Constants/XHeader.cs
+++ b/Constants/XHeader.cs
@@ -12,5 +12,11 @@ namespace xIdentityService.Constants
///
[StringValue("requestID")]
ConnectionId,
+
+ ///
+ /// Api Key Header Key ...
+ ///
+ [StringValue("X-Api-Key")]
+ ApiKey,
}
}
\ No newline at end of file
diff --git a/Extensions/XRequestExtensions.cs b/Extensions/XRequestExtensions.cs
new file mode 100644
index 0000000..a73070b
--- /dev/null
+++ b/Extensions/XRequestExtensions.cs
@@ -0,0 +1,34 @@
+using xCommons.Extensions;
+using Microsoft.AspNetCore.Http;
+using xIdentityService.Constants;
+
+namespace xIdentityService.Extensions
+{
+ public static class XRequestExtensions
+ {
+ ///
+ /// Extract ApiKey from Request Headers ...
+ ///
+ ///
+ ///
+ public static string ExtractApiKey(HttpRequest source)
+ {
+ //
+ var key = XHeader.ApiKey.GetStringValue();
+ var result = source?.Headers?[key] ?? string.Empty;
+ return result;
+ }
+
+ ///
+ /// Extract Client Id of Specified Request ....
+ ///
+ ///
+ ///
+ public static string ExtractClientIP(HttpRequest source)
+ {
+ //
+ var result = source?.HttpContext.Connection.RemoteIpAddress?.ToString();
+ return result;
+ }
+ }
+}
\ No newline at end of file