Commit 174fea14 authored by justcoding121's avatar justcoding121

rename proxy authenticate variables with Proxy prefix

Avoid confusion with WinAuth to server.
parent 6365d982
...@@ -21,7 +21,7 @@ namespace Titanium.Web.Proxy ...@@ -21,7 +21,7 @@ namespace Titanium.Web.Proxy
private async Task<bool> checkAuthorization(SessionEventArgsBase session) private async Task<bool> checkAuthorization(SessionEventArgsBase session)
{ {
// If we are not authorizing clients return true // If we are not authorizing clients return true
if (AuthenticateUserFunc == null && AuthenticateSchemeFunc == null) if (ProxyBasicAuthenticateFunc == null && ProxySchemeAuthenticateFunc == null)
{ {
return true; return true;
} }
...@@ -46,14 +46,14 @@ namespace Titanium.Web.Proxy ...@@ -46,14 +46,14 @@ namespace Titanium.Web.Proxy
return false; return false;
} }
if (AuthenticateUserFunc != null) if (ProxyBasicAuthenticateFunc != null)
{ {
return await authenticateUserBasic(session, headerValueParts); return await authenticateUserBasic(session, headerValueParts);
} }
if (AuthenticateSchemeFunc != null) if (ProxySchemeAuthenticateFunc != null)
{ {
var result = await AuthenticateSchemeFunc(session, headerValueParts[0], headerValueParts[1]); var result = await ProxySchemeAuthenticateFunc(session, headerValueParts[0], headerValueParts[1]);
if (result.Result == ProxyAuthenticationResult.ContinuationNeeded) if (result.Result == ProxyAuthenticationResult.ContinuationNeeded)
{ {
...@@ -98,7 +98,7 @@ namespace Titanium.Web.Proxy ...@@ -98,7 +98,7 @@ namespace Titanium.Web.Proxy
string username = decoded.Substring(0, colonIndex); string username = decoded.Substring(0, colonIndex);
string password = decoded.Substring(colonIndex + 1); string password = decoded.Substring(colonIndex + 1);
bool authenticated = await AuthenticateUserFunc(username, password); bool authenticated = await ProxyBasicAuthenticateFunc(username, password);
if (!authenticated) if (!authenticated)
{ {
session.WebSession.Response = createAuthentication407Response("Proxy Authentication Invalid"); session.WebSession.Response = createAuthentication407Response("Proxy Authentication Invalid");
...@@ -126,14 +126,14 @@ namespace Titanium.Web.Proxy ...@@ -126,14 +126,14 @@ namespace Titanium.Web.Proxy
return createContinuationResponse(response, continuation); return createContinuationResponse(response, continuation);
} }
if (AuthenticateUserFunc != null) if (ProxyBasicAuthenticateFunc != null)
{ {
response.Headers.AddHeader(KnownHeaders.ProxyAuthenticate, $"Basic realm=\"{ProxyRealm}\""); response.Headers.AddHeader(KnownHeaders.ProxyAuthenticate, $"Basic realm=\"{ProxyAuthenticationRealm}\"");
} }
if (AuthenticateSchemeFunc != null) if (ProxySchemeAuthenticateFunc != null)
{ {
foreach (var scheme in SupportedAuthenticationSchemes) foreach (var scheme in ProxyAuthenticationSchemes)
{ {
response.Headers.AddHeader(KnownHeaders.ProxyAuthenticate, scheme); response.Headers.AddHeader(KnownHeaders.ProxyAuthenticate, scheme);
} }
......
...@@ -199,7 +199,7 @@ namespace Titanium.Web.Proxy ...@@ -199,7 +199,7 @@ namespace Titanium.Web.Proxy
/// <summary> /// <summary>
/// Realm used during Proxy Basic Authentication. /// Realm used during Proxy Basic Authentication.
/// </summary> /// </summary>
public string ProxyRealm { get; set; } = "TitaniumProxy"; public string ProxyAuthenticationRealm { get; set; } = "TitaniumProxy";
/// <summary> /// <summary>
/// List of supported Ssl versions. /// List of supported Ssl versions.
...@@ -263,23 +263,24 @@ namespace Titanium.Web.Proxy ...@@ -263,23 +263,24 @@ namespace Titanium.Web.Proxy
} }
/// <summary> /// <summary>
/// A callback to authenticate clients. /// A callback to authenticate proxy clients via basic authentication.
/// Parameters are username and password as provided by client. /// Parameters are username and password as provided by client.
/// Should return true for successful authentication. /// Should return true for successful authentication.
/// </summary> /// </summary>
public Func<string, string, Task<bool>> AuthenticateUserFunc { get; set; } public Func<string, string, Task<bool>> ProxyBasicAuthenticateFunc { get; set; }
/// <summary> /// <summary>
/// A pluggable callback to authenticate clients by scheme instead of requiring basic auth. /// A pluggable callback to authenticate clients by scheme instead of requiring basic authentication through ProxyBasicAuthenticateFunc.
/// Parameters are current working session, schemeType, and token as provided by a calling client. /// Parameters are current working session, schemeType, and token as provided by a calling client.
/// Should return success for successful authentication, continuation if the package requests, or failure. /// Should return success for successful authentication, continuation if the package requests, or failure.
/// </summary> /// </summary>
public Func<SessionEventArgsBase, string, string, Task<ProxyAuthenticationContext>> AuthenticateSchemeFunc { get; set; } public Func<SessionEventArgsBase, string, string, Task<ProxyAuthenticationContext>> ProxySchemeAuthenticateFunc { get; set; }
/// <summary> /// <summary>
/// A collection of scheme types, e.g. basic, NTLM, Kerberos, Negotiate, to return if authentication is required. /// A collection of scheme types, e.g. basic, NTLM, Kerberos, Negotiate, to return if scheme authentication is required.
/// Works in relation with ProxySchemeAuthenticateFunc.
/// </summary> /// </summary>
public IEnumerable<string> SupportedAuthenticationSchemes { get; set; } = new string[0]; public IEnumerable<string> ProxyAuthenticationSchemes { get; set; } = new string[0];
/// <summary> /// <summary>
/// Dispose the Proxy instance. /// Dispose the Proxy instance.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment