public virtual object Clone() { return(new OAuthClient { ClientId = ClientId, ClientNames = ClientNames == null ? new List <OAuthTranslation>() : ClientNames.Select(c => (OAuthTranslation)c.Clone()).ToList(), ClientUris = ClientUris == null ? new List <OAuthTranslation>() : ClientUris.Select(c => (OAuthTranslation)c.Clone()).ToList(), LogoUris = LogoUris == null ? new List <OAuthTranslation>() : LogoUris.Select(c => (OAuthTranslation)c.Clone()).ToList(), PolicyUris = PolicyUris == null ? new List <OAuthTranslation>() : PolicyUris.Select(c => (OAuthTranslation)c.Clone()).ToList(), TosUris = TosUris == null ? new List <OAuthTranslation>() : TosUris.Select(c => (OAuthTranslation)c.Clone()).ToList(), CreateDateTime = CreateDateTime, JwksUri = JwksUri, RefreshTokenExpirationTimeInSeconds = RefreshTokenExpirationTimeInSeconds, UpdateDateTime = UpdateDateTime, TokenEndPointAuthMethod = TokenEndPointAuthMethod, TokenExpirationTimeInSeconds = TokenExpirationTimeInSeconds, Secrets = Secrets == null ? new List <ClientSecret>() : Secrets.Select(s => (ClientSecret)s.Clone()).ToList(), AllowedScopes = AllowedScopes == null ? new List <OAuthScope>() : AllowedScopes.Select(s => (OAuthScope)s.Clone()).ToList(), JsonWebKeys = JsonWebKeys == null ? new List <JsonWebKey>() : JsonWebKeys.Select(j => (JsonWebKey)j.Clone()).ToList(), GrantTypes = GrantTypes.ToList(), RedirectionUrls = RedirectionUrls.ToList(), PreferredTokenProfile = PreferredTokenProfile, TokenEncryptedResponseAlg = TokenEncryptedResponseAlg, TokenEncryptedResponseEnc = TokenEncryptedResponseEnc, TokenSignedResponseAlg = TokenSignedResponseAlg, ResponseTypes = ResponseTypes.ToList(), Contacts = Contacts.ToList(), SoftwareId = SoftwareId, SoftwareVersion = SoftwareVersion, PostLogoutRedirectUris = PostLogoutRedirectUris.ToList() }); }
public NamedPipeServer(IMessagesInterface messageInterface, ClientNames selfName) { SelfName = selfName.ToString(); ClientNames = new List <string>(); RegisterClientName(); serverHost = new ServiceHost(messageInterface); serverHost.AddServiceEndpoint((typeof(IMessagesInterface)), new NetNamedPipeBinding(), "net.pipe://localhost/Server/" + SelfName); serverHost.Open(); }
private void CreateConfigPath(Options options) { var configRoot = ""; var userRoot = Properties.Settings.Default.ConfigurationPath; if (!string.IsNullOrEmpty(userRoot)) { configRoot = userRoot; // Path configured in settings always wins, but // check for possible sub directories with client name // to keep bug-compatible with older releases that // created a subfolder inside of the users chosen config path foreach (var clientName in ClientNames) { var configRootWithClient = Path.Combine(userRoot, clientName); if (Directory.Exists(configRootWithClient)) { configRoot = configRootWithClient; break; } } } else { // When using a system folder, we have to create a sub folder // with the most preferred client name, but we should check first // if there is an older folder with an less preferred (older) // client name. var roots = new List <string> { Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) }; foreach (var root in roots) { // Stop looking if the directory has been found if (!Directory.Exists(configRoot)) { foreach (var clientName in ClientNames.Reverse()) { configRoot = Path.Combine(root, clientName); if (Directory.Exists(configRoot)) { // Stop looking if the directory has been found break; } } } } } _configPath = Path.Combine(configRoot, options.BaseUri.CleanFileName()); _log.Debug("Config folder: {_configPath}", _configPath); Directory.CreateDirectory(_configPath); }
/// <summary> /// Find and/or create path of the configuration files /// </summary> /// <param name="options"></param> private void CreateConfigPath(MainArguments options) { var configRoot = ""; var userRoot = Settings.Default.ConfigurationPath; if (!string.IsNullOrEmpty(userRoot)) { configRoot = userRoot; // Path configured in settings always wins, but // check for possible sub directories with client name // to keep bug-compatible with older releases that // created a subfolder inside of the users chosen config path foreach (var clientName in ClientNames) { var configRootWithClient = Path.Combine(userRoot, clientName); if (Directory.Exists(configRootWithClient)) { configRoot = configRootWithClient; break; } } } else { // When using a system folder, we have to create a sub folder // with the most preferred client name, but we should check first // if there is an older folder with an less preferred (older) // client name. // Stop looking if the directory has been found if (!Directory.Exists(configRoot)) { var appData = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData); foreach (var clientName in ClientNames.Reverse()) { configRoot = Path.Combine(appData, clientName); if (Directory.Exists(configRoot)) { // Stop looking if the directory has been found break; } } } } // This only happens when invalid options are provided if (options != null) { ConfigPath = Path.Combine(configRoot, options.GetBaseUri().CleanBaseUri()); _log.Debug("Config folder: {_configPath}", ConfigPath); Directory.CreateDirectory(ConfigPath); } }
public override object Clone() { return(new OpenIdClient { ClientId = ClientId, ClientNames = ClientNames == null ? new List <OAuthTranslation>() : ClientNames.Select(c => (OAuthTranslation)c.Clone()).ToList(), ClientUris = ClientUris == null ? new List <OAuthTranslation>() : ClientUris.Select(c => (OAuthTranslation)c.Clone()).ToList(), LogoUris = LogoUris == null ? new List <OAuthTranslation>() : LogoUris.Select(c => (OAuthTranslation)c.Clone()).ToList(), PolicyUris = PolicyUris == null ? new List <OAuthTranslation>() : PolicyUris.Select(c => (OAuthTranslation)c.Clone()).ToList(), TosUris = TosUris == null ? new List <OAuthTranslation>() : TosUris.Select(c => (OAuthTranslation)c.Clone()).ToList(), CreateDateTime = CreateDateTime, JwksUri = JwksUri, RefreshTokenExpirationTimeInSeconds = RefreshTokenExpirationTimeInSeconds, UpdateDateTime = UpdateDateTime, TokenEndPointAuthMethod = TokenEndPointAuthMethod, TokenExpirationTimeInSeconds = TokenExpirationTimeInSeconds, Secrets = Secrets == null ? new List <ClientSecret>() : Secrets.Select(s => (ClientSecret)s.Clone()).ToList(), AllowedScopes = AllowedScopes == null ? new List <OpenIdScope>() : AllowedScopes.Select(s => (OpenIdScope)s.Clone()).ToList(), JsonWebKeys = JsonWebKeys == null ? new List <JsonWebKey>() : JsonWebKeys.Select(j => (JsonWebKey)j.Clone()).ToList(), GrantTypes = GrantTypes.ToList(), RedirectionUrls = RedirectionUrls.ToList(), PreferredTokenProfile = PreferredTokenProfile, TokenEncryptedResponseAlg = TokenEncryptedResponseAlg, TokenEncryptedResponseEnc = TokenEncryptedResponseEnc, TokenSignedResponseAlg = TokenSignedResponseAlg, ResponseTypes = ResponseTypes.ToList(), Contacts = Contacts.ToList(), SoftwareId = SoftwareId, SoftwareVersion = SoftwareVersion, ApplicationType = ApplicationType, DefaultAcrValues = DefaultAcrValues.ToList(), DefaultMaxAge = DefaultMaxAge, IdTokenEncryptedResponseAlg = IdTokenEncryptedResponseAlg, IdTokenEncryptedResponseEnc = IdTokenEncryptedResponseEnc, IdTokenSignedResponseAlg = IdTokenSignedResponseAlg, PairWiseIdentifierSalt = PairWiseIdentifierSalt, RequestObjectEncryptionAlg = RequestObjectEncryptionAlg, RequestObjectEncryptionEnc = RequestObjectEncryptionEnc, RequestObjectSigningAlg = RequestObjectSigningAlg, RequireAuthTime = RequireAuthTime, SectorIdentifierUri = SectorIdentifierUri, SubjectType = SubjectType, UserInfoEncryptedResponseAlg = UserInfoEncryptedResponseAlg, UserInfoEncryptedResponseEnc = UserInfoEncryptedResponseEnc, UserInfoSignedResponseAlg = UserInfoSignedResponseAlg, RegistrationAccessToken = RegistrationAccessToken, PostLogoutRedirectUris = PostLogoutRedirectUris, InitiateLoginUri = InitiateLoginUri }); }
/// <summary> /// Parses the received request from the client and determines what data to send to the client in response. /// </summary> /// <param name="query">Request string received from the client.</param> /// <returns>Data to send to the client.</returns> private byte[] ParseQuery(string query) { string[] partsOfQuery = query.Split(" "); if (partsOfQuery.Length > 1) { var resultClientNames = new ClientNames(); resultClientNames.Names.Add(_clientNames.GetUsernameByName(partsOfQuery[1])); return(ClientNames.Serialize(resultClientNames)); } return(ClientNames.Serialize(_clientNames)); }
public ProcessEnum Check(CollectionNameModel nameModel) { if (nameModel is LogCollectionNameModel logNameModel) { if (ClientNames.AnyX() && !ClientNames.Contains(logNameModel.ClientName)) { return(ProcessEnum.None); } if (EnvNames.AnyX() && !EnvNames.Contains(logNameModel.EnvName)) { return(ProcessEnum.None); } if (Preffix != logNameModel.Preffix) { return(ProcessEnum.None); } if (logNameModel.Date > RealMaxDate) { return(ProcessEnum.None); } return(DropAfterBak ? ProcessEnum.BakAndRemove : ProcessEnum.BakOnly); } else if (nameModel is TraceOrPageIdNameModel tpNameMode) { if (!ProcessTraceIdPageId) { return(ProcessEnum.None); } if (ClientNames.AnyX() || EnvNames.AnyX()) { return(ProcessEnum.None); } var modelDate = new DateTime(tpNameMode.Year, tpNameMode.Month, 1); if (modelDate < new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1)) { return(ProcessEnum.BakOnly); } else { return(ProcessEnum.BakAndRemove); } } else { return(ProcessEnum.None); } }
private bool DoChecks() { if (tbName.Text.Length == 0) { MessageBox.Show("Se requiere un nombre."); tbName.Focus(); return(false); } // Da null en modo edicion porque ClientNames no se asigna. if (ClientNames != null) { if (ClientNames.Contains(tbName.Text)) { MessageBox.Show("El nombre ya está registrado. Se requiere un nombre diferente."); tbName.Focus(); return(false); } } if (tbAppPath.Text.Length == 0) { MessageBox.Show("Se requiere una aplicación."); tbAppPath.Focus(); return(false); } if (tbPort.Text.Length == 0) { MessageBox.Show("Se requiere un puerto."); tbPort.Focus(); return(false); } if (tbTimeout.Text.Length == 0) { MessageBox.Show("Se requiere un valor de timeout."); tbTimeout.Focus(); return(false); } return(true); }
/// <summary> /// Finishes receiving data from the server. /// </summary> /// <param name="asyncResult">The result of the asynchronous operation.</param> private void FinishReceiving(IAsyncResult asyncResult) { try { var state = (ClientState)asyncResult.AsyncState; Socket client = state.WorkSocket; int bytesRead = client.EndReceive(asyncResult); byte[] data = state.Buffer.Take(bytesRead).ToArray(); ServerResponse = ClientNames.Deserialize(data).Names; _receiveDone.Set(); } catch { throw; } }
public void AddClientName(string language, string value) { ClientNames.Add(new OAuthTranslation($"{ClientId}_client_name", value, language)); }
/// <summary> /// Initializes class fields. /// </summary> public FingerServer() { _allDone = new ManualResetEvent(false); _clientNames = new ClientNames(); }