Browse Source

added user password related methods

tags/v0.6.0
Robin Thoni 7 years ago
parent
commit
133b8703a3

+ 12
- 2
Luticate2.Auth/Business/LuUsersBusiness.cs View File

27
             return LuResult<UsersToken>.Ok(new UsersToken());//TODO
27
             return LuResult<UsersToken>.Ok(new UsersToken());//TODO
28
         }
28
         }
29
 
29
 
30
-        public LuResult<bool> IsTokenValid(UsersToken token)
30
+        public bool IsTokenValid(UsersToken token)
31
         {
31
         {
32
-            return LuResult<bool>.Ok(true);
32
+            return true;
33
         }
33
         }
34
 
34
 
35
         public LuResult<UsersDbo> GetSingleById(string id)
35
         public LuResult<UsersDbo> GetSingleById(string id)
40
                 Username = "user-" + id.Split('-')[0]
40
                 Username = "user-" + id.Split('-')[0]
41
             });//TODO
41
             });//TODO
42
         }
42
         }
43
+
44
+        public string HashPassword(string password, string salt)
45
+        {
46
+            return "";//TODO
47
+        }
48
+
49
+        public bool VerifyPasswordHash(string password, string hash, string salt)
50
+        {
51
+            return true;//TODO
52
+        }
43
     }
53
     }
44
 }
54
 }

+ 5
- 1
Luticate2.Auth/Interfaces/Users/ILuUsersBusiness.cs View File

11
 
11
 
12
         LuResult<UsersToken> UnRegisterToken(string token);
12
         LuResult<UsersToken> UnRegisterToken(string token);
13
 
13
 
14
-        LuResult<bool> IsTokenValid(UsersToken token);
14
+        bool IsTokenValid(UsersToken token);
15
 
15
 
16
         LuResult<UsersDbo> GetSingleById(string id);
16
         LuResult<UsersDbo> GetSingleById(string id);
17
+
18
+        string HashPassword(string password, string salt);
19
+
20
+        bool VerifyPasswordHash(string password, string hash, string salt);
17
     }
21
     }
18
 }
22
 }

+ 2
- 2
Luticate2.Auth/Middlewares/LuLoggedUserMiddleware.cs View File

32
                     LuResult<object>.Error(LuStatus.LoginError, $"token: {token}", "Invalid session").Throw();
32
                     LuResult<object>.Error(LuStatus.LoginError, $"token: {token}", "Invalid session").Throw();
33
                 }
33
                 }
34
                 tokenRes.ThrowIfNotSuccess();
34
                 tokenRes.ThrowIfNotSuccess();
35
-                var tokenValidityRes = _luUsersBusiness.IsTokenValid(tokenRes.Data).ThrowIfNotSuccess();
36
-                if (!tokenValidityRes.Data)
35
+                var tokenValid = _luUsersBusiness.IsTokenValid(tokenRes.Data);
36
+                if (!tokenValid)
37
                 {
37
                 {
38
                     LuResult<object>.Error(LuStatus.LoginError, $"token: {token}", "Invalid session").Throw();
38
                     LuResult<object>.Error(LuStatus.LoginError, $"token: {token}", "Invalid session").Throw();
39
                 }
39
                 }

Loading…
Cancel
Save