public async Task <Credential> CreateCredential(LoginCredentialDto loginCredential) { Credential credentialDb; if (loginCredential.GrantType.ToLower().Equals("refreshtoken")) { refreshToken = loginCredential.RefreshToken; logsheet = await unitOfWork.Logsheet.FindLogsheetByRefreshTokenAsync(refreshToken); if (logsheet != null && logsheet.Credential != null) { credential = logsheet.Credential; credential.IsAuthenticated = true; } } else if (loginCredential.GrantType.ToLower().Equals("idtoken")) { credentialDb = unitOfWork.Credential.FindByEmail(loginCredential.Email); if (credentialDb != null && StringHelper.CompareStringToHash(credentialDb.Password, loginCredential.Password)) { credential = credentialDb; credential.IsAuthenticated = true; } } return(credential); }
public AuthTokenDto Login(Client client, Credential credential) { if (refreshToken == null) { refreshToken = tokenSrvice.GenerateRefreshToken(credential.PublicId); logsheet = new Logsheet() { RefreshToken = refreshToken, CredentialId = credential.Id, ClientId = client.Id, Platform = client.Platform, Browser = client.Browser, IP = client.IP, CreatedAt = DateTime.Now, UpdatedAt = DateTime.Now }; unitOfWork.Logsheet.Add(logsheet); } else { } unitOfWork.Credential.UpdateLastLogin(credential); unitOfWork.Logsheet.UpdateLastTimeLogin(logsheet); unitOfWork.Complete(); return(tokenSrvice.GenerateAuthToken(credential, logsheet.Id, refreshToken)); }
public void SetExchquerWorkOrder(Logsheet logsheet = null) { }