Credentials do not work for “docker login”

@mustaccio was correct. The Docker Hub website allows you to login with either your username OR your email, and the website does not require a case-correct username. docker login DOES require a case-correct username, and DOES NOT work with your email address. When I signed up I chose a camel-cased username e.g.: MyUsername Docker forces … Read more

Encrypting credentials in a WPF application

Here’s a summary of my blog post: How to store a password on Windows? You can use the Data Protection API and its .NET implementation (ProtectedData) to encrypt the password. Here’s an example: public static string Protect(string str) { byte[] entropy = Encoding.ASCII.GetBytes(Assembly.GetExecutingAssembly().FullName); byte[] data = Encoding.ASCII.GetBytes(str); string protectedData = Convert.ToBase64String(ProtectedData.Protect(data, entropy, DataProtectionScope.CurrentUser)); return protectedData; … Read more

Get current user’s credentials object in Powershell without prompting

The Windows API will not expose the information you need, which is why Powershell can’t get to them. Its an intentional feature of the security subsystem. The only way for this to work is for the Linux machines to trust the calling machine, such as joining them to an Active Directory (or any kerberos setup … Read more

Invalid SSL certificate when pushing to Git server

Git for Windows has its own trust store of trusted certificates which is normally located in the file Git for Windows <=1.9: [Git installdir]\bin\curl-ca-bundle.crt (e.g., C:\Program Files (x86)\Git\bin\curl-ca-bundle.crt; configured by the key http.sslCAinfo in [Git installdir]\etc\gitconfig). Git for Windows >= 2.0: [Git installdir]\mingwXX\ssl\certs\ca-bundle.crt where XX stands for 32 or 64 (e.g., C:\Program Files\Git\mingw64\ssl\certs\ca-bundle.crt; configured by … Read more

DefaultNetworkCredentials or DefaultCredentials

They are exactly the same thing, which you can confirm for yourself using a disassembler like Reflector. The only difference is that DefaultNetworkCredentials returns a NetworkCredentials object and and DefaultCredentials casts it to ICredentials. So you have access to more information with a NetworkCredentials object, but which of those you use supply to an object … Read more

Externalizing Grails Datasource configuration

You can use a properties file specified in the grails.config.locations as a way to externalize the datasource configuration. Below is how I typically set up a Grails project: In my DataSource.groovy I specify this for the production environment: …. …. production { dataSource { dbCreate = “update” driverClassName = “com.myorg.jdbcDriverNotExists” url = “” username = … Read more

How to get Windows user name using different methods?

Environment.UserName calls GetUserName within advapi32.dll. This means that if you’re impersonating another user, this property will reflect that. Thread.CurrentPrincipal has a setter and can be changed programmatically. (This is not impersonation btw.) WindowsIdentity is your current windows identity, if any. It will not necessarily reflect the user, think ASP.NET with FormsAuthentication. Then the WindowsIdentity will … Read more