Commit 505d79df authored by justcoding121's avatar justcoding121

rename proxy authenticate variables with Proxy prefix

Avoid confusion with WinAuth to server.
parent 1c73d08d
......@@ -21,7 +21,7 @@ namespace Titanium.Web.Proxy
private async Task<bool> checkAuthorization(SessionEventArgsBase session)
{
// If we are not authorizing clients return true
if (AuthenticateUserFunc == null && AuthenticateSchemeFunc == null)
if (ProxyBasicAuthenticateFunc == null && ProxySchemeAuthenticateFunc == null)
{
return true;
}
......@@ -46,14 +46,14 @@ namespace Titanium.Web.Proxy
return false;
}
if (AuthenticateUserFunc != null)
if (ProxyBasicAuthenticateFunc != null)
{
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)
{
......@@ -98,7 +98,7 @@ namespace Titanium.Web.Proxy
string username = decoded.Substring(0, colonIndex);
string password = decoded.Substring(colonIndex + 1);
bool authenticated = await AuthenticateUserFunc(username, password);
bool authenticated = await ProxyBasicAuthenticateFunc(username, password);
if (!authenticated)
{
session.WebSession.Response = createAuthentication407Response("Proxy Authentication Invalid");
......@@ -126,14 +126,14 @@ namespace Titanium.Web.Proxy
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);
}
......
......@@ -199,7 +199,7 @@ namespace Titanium.Web.Proxy
/// <summary>
/// Realm used during Proxy Basic Authentication.
/// </summary>
public string ProxyRealm { get; set; } = "TitaniumProxy";
public string ProxyAuthenticationRealm { get; set; } = "TitaniumProxy";
/// <summary>
/// List of supported Ssl versions.
......@@ -263,23 +263,24 @@ namespace Titanium.Web.Proxy
}
/// <summary>
/// A callback to authenticate clients.
/// A callback to authenticate proxy clients via basic authentication.
/// Parameters are username and password as provided by client.
/// Should return true for successful authentication.
/// </summary>
public Func<string, string, Task<bool>> AuthenticateUserFunc { get; set; }
public Func<string, string, Task<bool>> ProxyBasicAuthenticateFunc { get; set; }
/// <summary>
/// A pluggable callback to authenticate clients by scheme instead of requiring basic auth.
/// 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.
/// 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.
/// Should return success for successful authentication, continuation if the package requests, or failure.
/// </summary>
public Func<SessionEventArgsBase, string, string, Task<ProxyAuthenticationContext>> AuthenticateSchemeFunc { get; set; }
public Func<SessionEventArgsBase, string, string, Task<ProxyAuthenticationContext>> ProxySchemeAuthenticateFunc { get; set; }
/// <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>
public IEnumerable<string> SupportedAuthenticationSchemes { get; set; } = new string[0];
public IEnumerable<string> ProxyAuthenticationSchemes { get; set; } = new string[0];
/// <summary>
/// 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