Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
T
Titanium-Web-Proxy
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Titanium-Web-Proxy
Commits
505d79df
Commit
505d79df
authored
May 20, 2018
by
justcoding121
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rename proxy authenticate variables with Proxy prefix
Avoid confusion with WinAuth to server.
parent
1c73d08d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
18 deletions
+19
-18
ProxyAuthorizationHandler.cs
Titanium.Web.Proxy/ProxyAuthorizationHandler.cs
+9
-9
ProxyServer.cs
Titanium.Web.Proxy/ProxyServer.cs
+10
-9
No files found.
Titanium.Web.Proxy/ProxyAuthorizationHandler.cs
View file @
505d79df
...
@@ -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
&&
AuthenticateSchem
eFunc
==
null
)
if
(
ProxyBasicAuthenticateFunc
==
null
&&
ProxySchemeAuthenticat
eFunc
==
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
(
AuthenticateUser
Func
!=
null
)
if
(
ProxyBasicAuthenticate
Func
!=
null
)
{
{
return
await
authenticateUserBasic
(
session
,
headerValueParts
);
return
await
authenticateUserBasic
(
session
,
headerValueParts
);
}
}
if
(
AuthenticateSchem
eFunc
!=
null
)
if
(
ProxySchemeAuthenticat
eFunc
!=
null
)
{
{
var
result
=
await
AuthenticateSchem
eFunc
(
session
,
headerValueParts
[
0
],
headerValueParts
[
1
]);
var
result
=
await
ProxySchemeAuthenticat
eFunc
(
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
AuthenticateUser
Func
(
username
,
password
);
bool
authenticated
=
await
ProxyBasicAuthenticate
Func
(
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
(
AuthenticateUser
Func
!=
null
)
if
(
ProxyBasicAuthenticate
Func
!=
null
)
{
{
response
.
Headers
.
AddHeader
(
KnownHeaders
.
ProxyAuthenticate
,
$"Basic realm=\"
{
ProxyRealm
}
\""
);
response
.
Headers
.
AddHeader
(
KnownHeaders
.
ProxyAuthenticate
,
$"Basic realm=\"
{
Proxy
Authentication
Realm
}
\""
);
}
}
if
(
AuthenticateSchem
eFunc
!=
null
)
if
(
ProxySchemeAuthenticat
eFunc
!=
null
)
{
{
foreach
(
var
scheme
in
Supported
AuthenticationSchemes
)
foreach
(
var
scheme
in
Proxy
AuthenticationSchemes
)
{
{
response
.
Headers
.
AddHeader
(
KnownHeaders
.
ProxyAuthenticate
,
scheme
);
response
.
Headers
.
AddHeader
(
KnownHeaders
.
ProxyAuthenticate
,
scheme
);
}
}
...
...
Titanium.Web.Proxy/ProxyServer.cs
View file @
505d79df
...
@@ -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
Proxy
Authentication
Realm
{
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
>>
AuthenticateUser
Func
{
get
;
set
;
}
public
Func
<
string
,
string
,
Task
<
bool
>>
ProxyBasicAuthenticate
Func
{
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
>>
AuthenticateSchem
eFunc
{
get
;
set
;
}
public
Func
<
SessionEventArgsBase
,
string
,
string
,
Task
<
ProxyAuthenticationContext
>>
ProxySchemeAuthenticat
eFunc
{
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
>
Supported
AuthenticationSchemes
{
get
;
set
;
}
=
new
string
[
0
];
public
IEnumerable
<
string
>
Proxy
AuthenticationSchemes
{
get
;
set
;
}
=
new
string
[
0
];
/// <summary>
/// <summary>
/// Dispose the Proxy instance.
/// Dispose the Proxy instance.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment