public ListenerSettings() { var newkey = AuthenticationKey.Generate(); this.AuthId = newkey.Id; this.AuthPassword = newkey.Password; }
public OutputListenerViewModel(SettingViewModel owner, System.Net.IPEndPoint endpoint) { this.owner = owner; if (endpoint.Address.Equals(System.Net.IPAddress.Any)) { address = "IPv4 Any"; } else if (endpoint.Address.Equals(System.Net.IPAddress.IPv6Any)) { address = "IPv6 Any"; } else { address = endpoint.Address.ToString(); } port = endpoint.Port; globalRelay = true; globalPlay = false; globalInterface = false; globalAuthRequired = true; localRelay = true; localPlay = true; localInterface = true; localAuthRequired = false; var authkey = AuthenticationKey.Generate(); authId = authkey.Id; authPassword = authkey.Password; isOpen = null; RegenerateAuthKey = new Command(DoRegenerateAuthKey); }
private void DoRegenerateAuthKey() { var authkey = AuthenticationKey.Generate(); authId = authkey.Id; authPassword = authkey.Password; OnPropertyChanged("AuthId"); OnPropertyChanged("AuthPassword"); }
public void Constructor_NullAuthKey_Throws() { var stubRequestSender = Substitute.For <IHttpBatchTranslationRequestSender>(); var stubDeserializer = Substitute.For <IHttpBatchTranslationResponseDeserializer>(); AuthenticationKey nullKey = null; Assert.Throws <ArgumentNullException>( () => new RestApiBatchTextTranslator( stubRequestSender, stubDeserializer, nullKey)); }
private static ISubtitlesTranslator CreateDeeplBatchSubtitlesTranslator(AuthenticationKey authKey) { const int deeplMaxBatchSize = 50; return(new BatchSubtitlesTranslator( new SubtitleBatchTranslator( CreateDeeplBatchTextTranslator(authKey), new SingleLineSubtitleTextFormatter()), deeplMaxBatchSize)); }
/// <summary> /// Clean up the stream binding resource and cryptographic keys when disposing of the object. /// </summary> public void Dispose() { if (_stream.IsValueCreated) { _stream.Value.Flush(); _stream.Value.Close(); } SymmetricCipherKey.SecureWipe(); AuthenticationKey.SecureWipe(); }
public ActionResult AuthenticationKey([FromBody] AuthenticationKey authenticationKey) { if (authenticationKey == null) { return(BadRequest()); } if (!authenticationKey.Key.Equals(Configuration.GetSection("Taesa").GetSection("Key").Value)) { return(Unauthorized()); } return(Ok(TokenJWT.create(null, "System"))); }
private static void TranslateSubtitles( FilePath toTranslate, Language targetLanguage, FilePath outputFile, AuthenticationKey authKey) { var translator = AppComposer.CreateDeeplBatchSubtitlesFileTranslator(authKey); translator.Execute( new TranslateSubtitlesFileToNewFile( toTranslate, targetLanguage, outputFile)); }
public static ICommandService <TranslateSubtitlesFileToNewFile> CreateDeeplBatchSubtitlesFileTranslator( AuthenticationKey authKey) { return(new ErrorHandlerSubtitlesFileTranslator( new TranslationCostConfirmationDecorator( new SubtitlesFileTranslator( CreateSubtitlesParser(), CreateSubtitlesSerializer(), CreateDeeplBatchSubtitlesTranslator(authKey), new SubtitlesSuccessfullyTranslatedUserNotifier( new ConsoleUserNotifier())), CreateDeeplSubtitlesFileTranslationCostCalculator(), new ConsoleUserConfirmationService()), new ConsoleErrorUserNotifier())); }
private static IBatchTextTranslator CreateDeeplBatchTextTranslator(AuthenticationKey authKey) { var textTranslator = new RestApiBatchTextTranslator( new HttpBatchTranslationRequestSender( new ApiHttpRequestSender(httpClient), new HttpBatchTranslationRequestGenerator( deeplTranslationApiUrl, new HttpBatchTranslationRequestContentGenerator( authKey, deeplLanguageToCodeMapper))), new JsonHttpBatchTranslationResponseDeserializer(), authKey); return(textTranslator); }
static void Main(string[] args) { if (InvalidInputArgs(args)) { ShowHelp(); return; } var srtFileToTranslate = new FilePath(args[0]); Language targetLanguage = ParseLanguage(args[2]); var outputFile = new FilePath(args[4]); var authKey = new AuthenticationKey(args[6]); TranslateSubtitles( srtFileToTranslate, targetLanguage, outputFile, authKey); }
public OutputListenerViewModel(SettingViewModel owner, int new_port) { this.owner = owner; address = "IPv4 Any"; port = new_port; globalRelay = true; globalPlay = false; globalInterface = false; globalAuthRequired = true; localRelay = true; localPlay = true; localInterface = true; localAuthRequired = false; var authkey = AuthenticationKey.Generate(); authId = authkey.Id; authPassword = authkey.Password; isOpen = null; RegenerateAuthKey = new Command(DoRegenerateAuthKey); }
/// <inheritdoc /> public bool Equals(PayloadItem other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (Type.Equals(other.Type) && String.Equals(Path, other.Path, Type != PayloadItemType.KeyAction ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal) && InternalLength == other.InternalLength && ExternalLength == other.ExternalLength && (FormatName == null ? other.FormatName == null : String.Equals(FormatName, other.FormatName, StringComparison.Ordinal)) && (FormatData == null ? other.FormatData == null : FormatData.SequenceEqualShortCircuiting(other.FormatData)) && SymmetricCipher.Equals(other.SymmetricCipher) && Authentication.Equals(other.Authentication) && (AuthenticationKey == null ? other.AuthenticationKey == null : AuthenticationKey.SequenceEqualShortCircuiting(other.AuthenticationKey)) && AuthenticationVerifiedOutput.SequenceEqualShortCircuiting(other.AuthenticationVerifiedOutput) && (KeyConfirmation == null ? other.KeyConfirmation == null : KeyConfirmation.Equals(other.KeyConfirmation)) && (KeyConfirmationVerifiedOutput == null ? other.KeyConfirmationVerifiedOutput == null : KeyConfirmationVerifiedOutput.SequenceEqualShortCircuiting(other.KeyConfirmationVerifiedOutput)) && KeyDerivation == null ? other.KeyDerivation == null : KeyDerivation.Equals((other.KeyDerivation))); }
private static string buildUrl(LookupMethods method, InfoLevels infolevel = InfoLevels.Basic, int page = 1, int width = 0, int height = 0, SizeOperators op = SizeOperators.Equal, int id = 0, string query = null, SortMethods sortby = SortMethods.Newest) { if (AuthenticationKey == null || AuthenticationKey.Trim().Length == 0) { throw new NullReferenceException("API Key cannot be null!"); } if (page < 1) { page = 1; } if ((width <= 0 && height > 0) || (width > 0 && height <= 0)) { throw new ArgumentException("Both Width and height must be specified!"); } string toReturn = baseUrl + AuthenticationKey + "&method=" + method; switch (infolevel) { //case InfoLevels.Basic: case InfoLevels.IncludeCategory: toReturn += "&info_level=2"; break; case InfoLevels.IncludeCategoryCollectionAndGroup: toReturn += "&info_level=3"; break; } if (page > 1) { toReturn += "&page=" + page; } if (width > 0) { toReturn += "&width=" + width + "&height=" + height; } switch (op) { //case SizeOperators.Equal: case SizeOperators.Max: toReturn += "&operator=max"; break; case SizeOperators.Min: toReturn += "&operator=min"; break; } if (id > 0) { toReturn += "&id=" + id; } if (method == LookupMethods.search || method == LookupMethods.user) { toReturn += "&term=" + Uri.EscapeDataString(query); } switch (sortby) { case SortMethods.Favorites: toReturn += "&sort=favorites"; break; case SortMethods.Newest: toReturn += "&sort=newest"; break; case SortMethods.Rating: toReturn += "&sort=rating"; break; case SortMethods.Views: toReturn += "&sort=views"; break; } return(toReturn += "&check_last=1"); }
public AuthenticationException(AuthenticationKey key) : base($"The key \"{key}\" is not valid. Please supply a valid authentication key.") { Key = key; }