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
ab36896e
Unverified
Commit
ab36896e
authored
Oct 05, 2019
by
honfika
Committed by
GitHub
Oct 05, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #640 from justcoding121/master
Support EnableWinAuth per session #633
parents
d0a7738b
b88a11b3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
5 deletions
+21
-5
SessionEventArgsBase.cs
...Titanium.Web.Proxy/EventArguments/SessionEventArgsBase.cs
+19
-0
RequestHandler.cs
src/Titanium.Web.Proxy/RequestHandler.cs
+1
-4
ResponseHandler.cs
src/Titanium.Web.Proxy/ResponseHandler.cs
+1
-1
No files found.
src/Titanium.Web.Proxy/EventArguments/SessionEventArgsBase.cs
View file @
ab36896e
...
...
@@ -20,6 +20,8 @@ namespace Titanium.Web.Proxy.EventArguments
/// </summary>
public
abstract
class
SessionEventArgsBase
:
EventArgs
,
IDisposable
{
private
static
bool
isWindowsAuthenticationSupported
=>
RunTime
.
IsWindows
;
internal
readonly
CancellationTokenSource
CancellationTokenSource
;
internal
TcpServerConnection
ServerConnection
=>
HttpClient
.
Connection
;
...
...
@@ -28,6 +30,7 @@ namespace Titanium.Web.Proxy.EventArguments
protected
readonly
IBufferPool
BufferPool
;
protected
readonly
ExceptionHandler
ExceptionFunc
;
private
bool
enableWinAuth
;
/// <summary>
/// Relative milliseconds for various events.
...
...
@@ -53,6 +56,7 @@ namespace Titanium.Web.Proxy.EventArguments
ProxyClient
=
new
ProxyClient
();
HttpClient
=
new
HttpWebClient
(
request
);
LocalEndPoint
=
endPoint
;
EnableWinAuth
=
server
.
EnableWinAuth
&&
isWindowsAuthenticationSupported
;
HttpClient
.
ProcessId
=
new
Lazy
<
int
>(()
=>
ProxyClient
.
Connection
.
GetProcessId
(
endPoint
));
}
...
...
@@ -72,6 +76,21 @@ namespace Titanium.Web.Proxy.EventArguments
set
=>
HttpClient
.
UserData
=
value
;
}
/// <summary>
/// Enable/disable Windows Authentication (NTLM/Kerberos) for the current session.
/// </summary>
public
bool
EnableWinAuth
{
get
=>
enableWinAuth
;
set
{
if
(!
isWindowsAuthenticationSupported
)
throw
new
Exception
(
"Windows Authentication is not supported"
);
enableWinAuth
=
value
;
}
}
/// <summary>
/// Does this session uses SSL?
/// </summary>
...
...
src/Titanium.Web.Proxy/RequestHandler.cs
View file @
ab36896e
...
...
@@ -27,9 +27,6 @@ namespace Titanium.Web.Proxy
/// </summary>
public
partial
class
ProxyServer
{
private
bool
isWindowsAuthenticationEnabledAndSupported
=>
EnableWinAuth
&&
RunTime
.
IsWindows
;
/// <summary>
/// This is the core request handler method for a particular connection from client.
/// Will create new session (request/response) sequence until
...
...
@@ -158,7 +155,7 @@ namespace Titanium.Web.Proxy
// if win auth is enabled
// we need a cache of request body
// so that we can send it after authentication in WinAuthHandler.cs
if
(
isWindowsAuthenticationEnabledAndSupported
&&
request
.
HasBody
)
if
(
args
.
EnableWinAuth
&&
request
.
HasBody
)
{
await
args
.
GetRequestBody
(
cancellationToken
);
}
...
...
src/Titanium.Web.Proxy/ResponseHandler.cs
View file @
ab36896e
...
...
@@ -39,7 +39,7 @@ namespace Titanium.Web.Proxy
args
.
ReRequest
=
false
;
// check for windows authentication
if
(
isWindowsAuthenticationEnabledAndSupported
)
if
(
args
.
EnableWinAuth
)
{
if
(
response
.
StatusCode
==
(
int
)
HttpStatusCode
.
Unauthorized
)
{
...
...
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