Browse Source

[Authentication] Added more logs for token validation error

develop
Robin Thoni 9 years ago
parent
commit
99a183d7a7
1 changed files with 7 additions and 0 deletions
  1. 7
    0
      Authentication/Business/JWT/TokenValidationHandler.cs

+ 7
- 0
Authentication/Business/JWT/TokenValidationHandler.cs View File

89
                 var salt = ((ClaimsIdentity)claim.Identity).Claims.FirstOrDefault(x => x.Type == ClaimTypes.Authentication);
89
                 var salt = ((ClaimsIdentity)claim.Identity).Claims.FirstOrDefault(x => x.Type == ClaimTypes.Authentication);
90
 
90
 
91
                 if (name == null || salt == null)
91
                 if (name == null || salt == null)
92
+                {
93
+                    OpResult<bool>.Error(ResultStatus.LoginError, string.Format("Incomplete token; username is present: {0}; salt is present {1}", name != null, salt != null)).Log();
92
                     statusCode = HttpStatusCode.Unauthorized;
94
                     statusCode = HttpStatusCode.Unauthorized;
95
+                }
93
                 else
96
                 else
94
                 {
97
                 {
95
                     var user = GetUserDbo(name.Value, salt.Value);
98
                     var user = GetUserDbo(name.Value, salt.Value);
96
                     if (user == null)
99
                     if (user == null)
100
+                    {
101
+                        OpResult<bool>.Error(ResultStatus.LoginError,
102
+                            string.Format("Username {0} not found", name.Value)).Log();
97
                         statusCode = HttpStatusCode.Unauthorized;
103
                         statusCode = HttpStatusCode.Unauthorized;
104
+                    }
98
                     else
105
                     else
99
                     {
106
                     {
100
                         UserStorage.BasicUserDbo = user;
107
                         UserStorage.BasicUserDbo = user;

Loading…
Cancel
Save