Procházet zdrojové kódy

[Authentication] Added more logs for token validation error

develop
Robin Thoni před 9 roky
rodič
revize
99a183d7a7

+ 7
- 0
Authentication/Business/JWT/TokenValidationHandler.cs Zobrazit soubor

@@ -89,12 +89,19 @@ namespace iiie.Authentication.Business.JWT
89 89
                 var salt = ((ClaimsIdentity)claim.Identity).Claims.FirstOrDefault(x => x.Type == ClaimTypes.Authentication);
90 90
 
91 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 94
                     statusCode = HttpStatusCode.Unauthorized;
95
+                }
93 96
                 else
94 97
                 {
95 98
                     var user = GetUserDbo(name.Value, salt.Value);
96 99
                     if (user == null)
100
+                    {
101
+                        OpResult<bool>.Error(ResultStatus.LoginError,
102
+                            string.Format("Username {0} not found", name.Value)).Log();
97 103
                         statusCode = HttpStatusCode.Unauthorized;
104
+                    }
98 105
                     else
99 106
                     {
100 107
                         UserStorage.BasicUserDbo = user;

Načítá se…
Zrušit
Uložit