Skip to content
This repository was archived by the owner on Jul 9, 2023. It is now read-only.

Commit 174fea1

Browse files
committed
rename proxy authenticate variables with Proxy prefix
Avoid confusion with WinAuth to server.
1 parent 6365d98 commit 174fea1

File tree

2 files changed

+19
-18
lines changed

2 files changed

+19
-18
lines changed

Titanium.Web.Proxy/ProxyAuthorizationHandler.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public partial class ProxyServer
2121
private async Task<bool> checkAuthorization(SessionEventArgsBase session)
2222
{
2323
// If we are not authorizing clients return true
24-
if (AuthenticateUserFunc == null && AuthenticateSchemeFunc == null)
24+
if (ProxyBasicAuthenticateFunc == null && ProxySchemeAuthenticateFunc == null)
2525
{
2626
return true;
2727
}
@@ -46,14 +46,14 @@ private async Task<bool> checkAuthorization(SessionEventArgsBase session)
4646
return false;
4747
}
4848

49-
if (AuthenticateUserFunc != null)
49+
if (ProxyBasicAuthenticateFunc != null)
5050
{
5151
return await authenticateUserBasic(session, headerValueParts);
5252
}
5353

54-
if (AuthenticateSchemeFunc != null)
54+
if (ProxySchemeAuthenticateFunc != null)
5555
{
56-
var result = await AuthenticateSchemeFunc(session, headerValueParts[0], headerValueParts[1]);
56+
var result = await ProxySchemeAuthenticateFunc(session, headerValueParts[0], headerValueParts[1]);
5757

5858
if (result.Result == ProxyAuthenticationResult.ContinuationNeeded)
5959
{
@@ -98,7 +98,7 @@ private async Task<bool> authenticateUserBasic(SessionEventArgsBase session, str
9898

9999
string username = decoded.Substring(0, colonIndex);
100100
string password = decoded.Substring(colonIndex + 1);
101-
bool authenticated = await AuthenticateUserFunc(username, password);
101+
bool authenticated = await ProxyBasicAuthenticateFunc(username, password);
102102
if (!authenticated)
103103
{
104104
session.WebSession.Response = createAuthentication407Response("Proxy Authentication Invalid");
@@ -126,14 +126,14 @@ private Response createAuthentication407Response(string description, string cont
126126
return createContinuationResponse(response, continuation);
127127
}
128128

129-
if (AuthenticateUserFunc != null)
129+
if (ProxyBasicAuthenticateFunc != null)
130130
{
131-
response.Headers.AddHeader(KnownHeaders.ProxyAuthenticate, $"Basic realm=\"{ProxyRealm}\"");
131+
response.Headers.AddHeader(KnownHeaders.ProxyAuthenticate, $"Basic realm=\"{ProxyAuthenticationRealm}\"");
132132
}
133133

134-
if (AuthenticateSchemeFunc != null)
134+
if (ProxySchemeAuthenticateFunc != null)
135135
{
136-
foreach (var scheme in SupportedAuthenticationSchemes)
136+
foreach (var scheme in ProxyAuthenticationSchemes)
137137
{
138138
response.Headers.AddHeader(KnownHeaders.ProxyAuthenticate, scheme);
139139
}

Titanium.Web.Proxy/ProxyServer.cs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ public ProxyServer(string rootCertificateName, string rootCertificateIssuerName,
199199
/// <summary>
200200
/// Realm used during Proxy Basic Authentication.
201201
/// </summary>
202-
public string ProxyRealm { get; set; } = "TitaniumProxy";
202+
public string ProxyAuthenticationRealm { get; set; } = "TitaniumProxy";
203203

204204
/// <summary>
205205
/// List of supported Ssl versions.
@@ -263,23 +263,24 @@ public ExceptionHandler ExceptionFunc
263263
}
264264

265265
/// <summary>
266-
/// A callback to authenticate clients.
266+
/// A callback to authenticate proxy clients via basic authentication.
267267
/// Parameters are username and password as provided by client.
268268
/// Should return true for successful authentication.
269269
/// </summary>
270-
public Func<string, string, Task<bool>> AuthenticateUserFunc { get; set; }
270+
public Func<string, string, Task<bool>> ProxyBasicAuthenticateFunc { get; set; }
271271

272272
/// <summary>
273-
/// A pluggable callback to authenticate clients by scheme instead of requiring basic auth.
274-
/// Parameters are current working session, schemeType, and token as provided by a calling client.
275-
/// Should return success for successful authentication, continuation if the package requests, or failure.
273+
/// A pluggable callback to authenticate clients by scheme instead of requiring basic authentication through ProxyBasicAuthenticateFunc.
274+
/// Parameters are current working session, schemeType, and token as provided by a calling client.
275+
/// Should return success for successful authentication, continuation if the package requests, or failure.
276276
/// </summary>
277-
public Func<SessionEventArgsBase, string, string, Task<ProxyAuthenticationContext>> AuthenticateSchemeFunc { get; set; }
277+
public Func<SessionEventArgsBase, string, string, Task<ProxyAuthenticationContext>> ProxySchemeAuthenticateFunc { get; set; }
278278

279279
/// <summary>
280-
/// A collection of scheme types, e.g. basic, NTLM, Kerberos, Negotiate, to return if authentication is required.
280+
/// A collection of scheme types, e.g. basic, NTLM, Kerberos, Negotiate, to return if scheme authentication is required.
281+
/// Works in relation with ProxySchemeAuthenticateFunc.
281282
/// </summary>
282-
public IEnumerable<string> SupportedAuthenticationSchemes { get; set; } = new string[0];
283+
public IEnumerable<string> ProxyAuthenticationSchemes { get; set; } = new string[0];
283284

284285
/// <summary>
285286
/// Dispose the Proxy instance.

0 commit comments

Comments
 (0)