How to make LdapContextSource pointing to UnboundID InMemoryDirectoryServer? - spring-ldap

I have a set of old automated test cases which are based on Spring LDAP framework. They connect to an external LDAP server. I am thinking about replacing the external server with an embedded one. The UnboundID InMemoryDirectoryServer appears attractive, especially if there is a way allowing Spring LDAP based clients to connect UnboundID-based embedded server. The question is: How to do it? I am new to LDAP, please help.

There is really not much difference between the case of an external and an embedded LDAP server. When configuring the LdapContextSource, you will have to set the url of the server to something like ldap://localhost:33389/ (assuming your embedded server listens at port 33389).
Be aware that by default the UnboundID InMemoryDirectoryServer will pick a free port randomly at runtime unless you configure it to listen to a fix port. This might help you getting started:
InMemoryDirectoryServerConfig config =
new InMemoryDirectoryServerConfig("dc=example, dc=com");
// make sure that the server listens on port 33389
config.setListenerConfigs(
new InMemoryListenerConfig("myListener", null, 33389, null, null, null));
InMemoryDirectoryServer ds = new InMemoryDirectoryServer(config);
ds.startListening();
// import some test data from an ldif file
ds.importFromLDIF(true,"content.ldif");

Related

How to pass web proxy address to Microsoft.WindowsAzure.Storage.OperationContext.UserHeaders?

I am writing some C# code that uses the Azure Resource Manager APIs and my CloudBlobClient needs to use a web proxy. According to the documentation for OperationContext.UserHeaders property at https://msdn.microsoft.com/en-us/library/microsoft.windowsazure.storage.operationcontext.userheaders.aspx, UserHeaders can be used to specify a proxy. Can you please share how this should be done properly?
Edited after Gaurav Mantri's comment.
The Azure clients below allow you to specify a proxy to be used via the httpClientHandler but the CloudBlobClient does not respect the proxy information from StorageManagementClient and there doesn't seem to be a way to pass the proxy information to the CloudBlobClient. Our users may want to specify different proxies for multiple connections and it doesn't seem the current architecture will easily allow this.
//Example code that instantiates clients with proxy information inside the httpClientHandler
armCompute = new ComputeManagementClient(tokenCredentials, httpClientHandler)
armStorage = new StorageManagementClient(tokenCredentials, httpClientHandler)
armNetwork = new NetworkManagementClient(tokenCredentials, httpClientHandler)
armResource = new ResourceManagementClient(tokenCredentials, httpClientHandler)
armSubscription = new SubscriptionClient(tokenCredentials, httpClientHandler)
I believe you're understanding it incorrectly. The documentation states:
Gets or sets additional headers on the request, for example, for proxy
or logging information.
From what I understand you use this to get or set the headers for your proxy to understand and not specify proxy configuration settings.
In order to specify proxy settings, you would need to specify those in your application configuration file (web.config or app.config).

Does Golang's net.LookupHost() use all DNS servers in "/etc/resolv.conf"?

I have an application, that's written in Go that uses this function and it keeps failing to resolve a DNS name. I can resolve the DNS name on the server just fine using other applications but not the Go-based one that uses this function.
When in doubt, "Use the source, Luke". Reading dnsclient_unix.go reveals that it iterates over all configured servers.
But mind the note:
// If answer errored for rcodes dnsRcodeSuccess or dnsRcodeNameError,
// it means the response in msg was not useful and trying another
// server probably won't help. Return now in those cases.
// TODO: indicate this in a more obvious way, such as a field on DNSError?

How to use the ChromeApp to connect to a node.js server?

I have a Node.js server and I'd like to know how I could do for the ChromeApp to work with it. I tried putting "http://localhost:3000" (server address) on the runtime:
chrome.app.runtime.onLaunched.addListener(function () {
chrome.app.window.create('http://localhost:3000');
});
But it doesn't even launch. Does someone have an idea on what I could do?
Thanks.
You cannot launch external URLs with chrome.app.window.create. In fact if you check the chrome.runtime.lastError property you will see the following error:
The URL used for window creation must be local for security reasons.
I suggest you look into using the <webview> tag as it is much more appropriate for your use-case.

How do I check custom TURN server is working with easyRTC

I am working on an application for Audio/Video calls using easyrtc.
I have added turn server details in server.js file to configure the turn servers I want to use.
var myIceServers = [
{url: "stun:stun.anyfirewall.com:3478"},
{url: "turn:turn.anyfirewall.com:443", "username":"xxxxx", "credential":"xxxxx"},
{url: "turn:turn.anyfirewall.com:443?transport=tcp", "username":"xxxxx", "credential":"xxxxx"}
];
then set options for appIceServers using below line of code.
easyrtc.setOption("appIceServers", myIceServers);
and configured the listener as well.
easyrtc.on("getIceConfig", function(connectionObj, callback){
callback(null, myIceServers);
}
After this when I am running easyrtc simple audio-video demo, from local machine, in chrome using two tabs it works fine.
Now I have two questions:
How do I make sure that easyrtc is using custom supplied TURN server configuration ?
And from where I need to test the links for my application, which will make sure that easyrtc is using custom supplied TURN url for tcp ? (i.e. firewall check).
You can turn the "log level" to "3" in server.js to see more detail logs, and use chrome://werbrtc-internals to see the chrome webrtc logs . I just set up a TURN server yesterday and in my way , I modified the easyrtc_default_options to using my own TURN,I think your configuration will work if you test with two client in different network, the Turn server will give you a feedback.
"from local machine, in chrome using two tabs it works fine." this is not using you TURN server.

Do I need to replace localhost in the IIS://localhost/MimeMap when reading the Mimemap

I'm reading out the mime types from IIS's MimeMap using the command
_mimeTypes = new Dictionary<string, string>();
//load from iis store.
DirectoryEntry Path = new DirectoryEntry("IIS://localhost/MimeMap");
PropertyValueCollection PropValues = Path.Properties["MimeMap"];
IISOle.MimeMap MimeTypeObj;
foreach (var item in PropValues)
{
// IISOle -> Add reference to Active DS IIS Namespace provider
MimeTypeObj = (IISOle.MimeMap)item;
_mimeTypes.Add(MimeTypeObj.Extension, MimeTypeObj.MimeType);
}
Do I need replace the localhost part when I deploy it to my live server? If not, why not and what are the implications of not doing so.
Cheers
It should not be an issue to leave the host as 'localhost'.
After all, you want to get the MimeMap of the machine your app is running on, correct?
A possible complication that I can forsee is that if you are using a third party as a host. They can do anything they want with host headers and it may be possible that localhost is not available for whatever reason.
But you should simply give it a shot and adjust if necessary.
If you leave it like 'Localhost', you will have to run this script directly on the server.
If you change it to fetch the machine name directly, you can think of running this script remotely as well.

Resources