public virtual ITokenRespons Authentiacte(object user, string audiance, string domain, AddClaimsMethod method) { try { var useracc = (UserAccount)user; var userdb = GetAuthFromDB("select * from getuser(@UserName)", useracc); ValidateAccount(useracc, userdb); var claims = FetchClaims(method, userdb.Id); var tokenRespons = Jwt.CreateJwtToken(claims, audiance, domain); AddRefreshToken(tokenRespons.RefreshToken, userdb.Id); return(tokenRespons); } catch { throw; } }
public virtual ITokenRespons Authentiacte(object token, string audiance, string domain, AddClaimsMethod method) { try { var tokendb = GetAuthFromDB("select * from gettoken(@Token)", (TokenKey)token); var claims = FetchClaims(method, tokendb.Id); var tokenRespons = Jwt.CreateJwtToken(claims, audiance, domain); AddRefreshToken(tokenRespons.RefreshToken, tokendb.Id); if (!IsLocked(tokendb) && tokendb.LockOut > 0) { Unlock(tokendb); } return(tokenRespons); } catch { throw; } }