Proxy Basic Authentication in C#: HTTP 407 error

This method may avoid the need to hard code or configure proxy credentials, which may be desirable. Put this in your application configuration file – probably app.config. Visual Studio will rename it to yourappname.exe.config on build, and it will end up next to your executable. If you don’t have an application configuration file, just add … Read more

Spring Security exclude url patterns in security annotation configurartion

Found the solution in Spring security examples posted in Github. WebSecurityConfigurerAdapter has a overloaded configure message that takes WebSecurity as argument which accepts ant matchers on requests to be ignored. @Override public void configure(WebSecurity web) throws Exception { web.ignoring().antMatchers(“/authFailure”); } See Spring Security Samples for more details

What is the “realm” in basic authentication

From RFC 1945 (HTTP/1.0) and RFC 2617 (HTTP Authentication referenced by HTTP/1.1) The realm attribute (case-insensitive) is required for all authentication schemes which issue a challenge. The realm value (case-sensitive), in combination with the canonical root URL of the server being accessed, defines the protection space. These realms allow the protected resources on a server … Read more

How to use UrlFetchApp with credentials? Google Scripts

This question has been answered on another else where. Here is the summary: Bruce Mcpherson basic authentication looks like this… var options = {}; options.headers = {“Authorization”: “Basic ” + Utilities.base64Encode(username + “:” + password)}; Lenny Cunningham //Added Basic Authorization////////////////////////////////////////////////////////////////////////////////////////// var USERNAME = PropertiesService.getScriptProperties().getProperty(‘username’); var PASSWORD = PropertiesService.getScriptProperties().getProperty(‘password’); var url = PropertiesService.getScriptProperties().getProperty(‘url’);//////////////////////////Forwarded Ports to WebRelay … Read more

Preemptive Basic Auth with HttpUrlConnection?

If you are using Java 8 or later, java.util.Base64 is usable: HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection(); String encoded = Base64.getEncoder().encodeToString((username+”:”+password).getBytes(StandardCharsets.UTF_8)); //Java 8 connection.setRequestProperty(“Authorization”, “Basic “+encoded); Then use the connection as normal. If you’re using Java 7 or lower, you’ll need a method to encode a String to Base64, such as: byte[] message = (username+”:”+password).getBytes(“UTF-8”); … Read more