by adrien » Aug 22 12 12:05 pm
Hi
there are 2 ways to get WinGate to require authentication.
The main complexity is because authentication is optional. It needs to be optional because some clients can't deal with it very well.
HTTP authentication works by the server or proxy challenging a client request (if auth is required for that request). At that point the client knows it needs to provide authentication credentials.
This can be done in WinGate in 2 ways, either using Web Access Control (WAC) rules, or the flow-chart policy.
For WAC, you just need to have a rule that requires knowledge of the user. This means the "who" tab must not be "Everybody", and the where, when and what must also match the request.
For flow-chart policy, there needs to be a decision made whether to challenge for auth or not, then if the decision is made to challenge, a result which is set to "Auth". This can be done in most WWW proxy events, but depending on the type of request, different events will be fired. The sequence of events for the WWW proxy are:
1. Client connects to proxy => fire the ClientConnect event
2. Client sends a request => fire the Request event
the request can be of 3 forms.
a) a normal proxy request for an upstream resource => fire the ProxyRequest event
b) a CONNECT request to make a tunnel through the proxy (e.g. for https, or other protocols) => fire the ConnectRequest event
c) a server-style request, where the client is treating the proxy like a server. This is used for things like reverse proxying, or when you use WinGate as a web server => fire the ServerRequest event
3. Request is completed => fire the RequestComplete event.
Steps 2 / 3 may happen a number of times for any particular connection.
4. Client or proxy disconnects => fire the ClientDisconnect event
The sample policies that ship with WinGate 7 have an auth policy, in the sample policy hooked to the WWW Proxy : Request event, there is an item that calls another policy which performs authentication. If you open this policy, you can see that there is a switch to turn it on or off (auth at all or not) which is controlled on the dashboard, or in the Data -> Global Data -> Boolean -> AuthRequired setting, and there is also a list of sites that don't require auth.
Adrien