/// <summary> /// Marca as mensagens como lidas. /// </summary> /// <param name="dispatcherIds">Identificadores dos despachos.</param> public void MarkMessageAsRead(IEnumerable <int> dispatcherIds) { try { TokenProviderClient.MarkMessageAsRead(dispatcherIds.ToArray()); } catch { } }
/// <summary> /// Executa uma verificação do token no servidor. /// </summary> /// <param name="token">Token</param> /// <returns></returns> public TokenPingResult Ping(string token) { try { return(TokenProviderClient.Ping(token)); } catch (Exception ex) { return(new TokenPingResult { Message = ex, Status = TokenPingResultStatus.Error, }); } }
/// <summary> /// Define o perfil para o token. /// </summary> /// <param name="token"></param> /// <param name="profileId"></param> /// <returns></returns> public TokenSetProfileResult SetProfile(string token, int profileId) { try { return(TokenProviderClient.SetProfile(token, profileId)); } catch (Exception ex) { return(new TokenSetProfileResult { Success = false, FailureMessage = ex.Message }); } }
/// <summary> /// Verifica se um token está ou não válido /// </summary> /// <param name="token">token</param> /// <returns>Objeto com o resultado da consulta</returns> public TokenConsultResult Check(string token) { /* * System.Security.Principal.IPrincipal currentPrincipal = UserContext.Current.Principal; * if ((currentPrincipal != null) && (currentPrincipal.Identity != null)) * { * var identity = currentPrincipal.Identity; * * if (identity.IsAuthenticated) * return TokenProviderClient.Check(token); * * } * * return new TokenConsultResult * { * Success = false * };*/ try { return(TokenProviderClient.Check(token)); } catch (System.ServiceModel.EndpointNotFoundException) { throw new Exception(ResourceMessageFormatter.Create(() => Properties.Resources.RemoteTokenProvider_CheckTokenEndpointNotFound).Format()); } catch (System.ServiceModel.FaultException <System.ServiceModel.ExceptionDetail> ex) { throw new Exception(ResourceMessageFormatter.Create(() => Properties.Resources.RemoteTokenProvider_CheckTokenFaultException, ex.Detail.Message).Format(), ex); } catch (System.ServiceModel.CommunicationException) { throw new Exception(ResourceMessageFormatter.Create(() => Properties.Resources.RemoteTokenProvider_CheckTokenCommunicationError).Format()); } catch (Exception ex) { throw new Exception(ResourceMessageFormatter.Create(() => Properties.Resources.RemoteTokenProvider_CheckTokenUnknownError).Format(), ex); } }
/// <summary> /// Fecha os otknes em aberto do usuário. /// </summary> /// <param name="userId"></param> /// <param name="applicationName"></param> public void CloseUserTokens(int userId, string applicationName) { TokenProviderClient.CloseUserTokens2(userId, applicationName); }
/// <summary> /// Fecha os tokens em aberto de um usuário. /// </summary> /// <param name="userId">Identificador do usuário</param> public void CloseUserTokens(int userId) { TokenProviderClient.CloseUserTokens(userId); }