private void GetSettings(IKeyValueSettings settings, out string serviceId, out string authority, out string passwordStoreKey) { // Validate arguments. if (!settings.Values.ContainsKey(TokenKeys.AuthorityKey)) { throw new ArgumentException("Authority is missing. Cannot process the request."); } if (!settings.Values.ContainsKey(TokenKeys.ServiceApplicationIdKey)) { throw new ArgumentException("ApplicationId is missing. Cannot process the request."); } serviceId = settings.Values[TokenKeys.ServiceApplicationIdKey]; authority = settings.Values[TokenKeys.AuthorityKey]; // Check the information. var messages = new Arc4u.ServiceModel.Messages(); if (String.IsNullOrWhiteSpace(serviceId)) { messages.Add(new Message(ServiceModel.MessageCategory.Technical, ServiceModel.MessageType.Warning, $"No information from the application settings section about an entry: {TokenKeys.ServiceApplicationIdKey}.")); } if (String.IsNullOrWhiteSpace(authority)) { messages.Add(new Message(ServiceModel.MessageCategory.Technical, ServiceModel.MessageType.Warning, $"{TokenKeys.AuthorityKey} is not defined in the configuration file.")); } messages.LogAndThrowIfNecessary(this); messages.Clear(); passwordStoreKey = "secret"; if (settings.Values.ContainsKey(TokenKeys.PasswordStoreKey)) { passwordStoreKey = String.IsNullOrWhiteSpace(settings.Values[TokenKeys.PasswordStoreKey]) ? passwordStoreKey : settings.Values[TokenKeys.PasswordStoreKey]; } }