Explorar el Código

added user password related methods

tags/v0.6.0
Robin Thoni hace 7 años
padre
commit
133b8703a3

+ 12
- 2
Luticate2.Auth/Business/LuUsersBusiness.cs Ver fichero

@@ -27,9 +27,9 @@ namespace Luticate2.Auth.Business
27 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 35
         public LuResult<UsersDbo> GetSingleById(string id)
@@ -40,5 +40,15 @@ namespace Luticate2.Auth.Business
40 40
                 Username = "user-" + id.Split('-')[0]
41 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 Ver fichero

@@ -11,8 +11,12 @@ namespace Luticate2.Auth.Interfaces.Users
11 11
 
12 12
         LuResult<UsersToken> UnRegisterToken(string token);
13 13
 
14
-        LuResult<bool> IsTokenValid(UsersToken token);
14
+        bool IsTokenValid(UsersToken token);
15 15
 
16 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 Ver fichero

@@ -32,8 +32,8 @@ namespace Luticate2.Auth.Middlewares
32 32
                     LuResult<object>.Error(LuStatus.LoginError, $"token: {token}", "Invalid session").Throw();
33 33
                 }
34 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 38
                     LuResult<object>.Error(LuStatus.LoginError, $"token: {token}", "Invalid session").Throw();
39 39
                 }

Loading…
Cancelar
Guardar