[Modify] Polish it
This commit is contained in:
parent
1732e8b093
commit
ad38a23eb9
@ -191,17 +191,18 @@ namespace WebSocketSharp.Net
|
||||
internal bool Authenticate ()
|
||||
{
|
||||
var schm = _listener.SelectAuthenticationScheme (_request);
|
||||
|
||||
if (schm == AuthenticationSchemes.Anonymous)
|
||||
return true;
|
||||
|
||||
if (schm == AuthenticationSchemes.None) {
|
||||
_response.Close (HttpStatusCode.Forbidden);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
var realm = _listener.GetRealm ();
|
||||
var user =
|
||||
HttpUtility.CreateUser (
|
||||
var user = HttpUtility.CreateUser (
|
||||
_request.Headers["Authorization"],
|
||||
schm,
|
||||
realm,
|
||||
@ -210,11 +211,14 @@ namespace WebSocketSharp.Net
|
||||
);
|
||||
|
||||
if (user == null || !user.Identity.IsAuthenticated) {
|
||||
_response.CloseWithAuthChallenge (new AuthenticationChallenge (schm, realm).ToString ());
|
||||
var chal = new AuthenticationChallenge (schm, realm).ToString ();
|
||||
_response.CloseWithAuthChallenge (chal);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
_user = user;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user