basic-authentication

Spring 4.0.0 basic authentication with RestTemplate

旧城冷巷雨未停 提交于 2019-11-28 18:22:51
I am currently working on integration of a third party application with our local reporting system. I would like to implement REST calls with basic authentication but facing issues in Spring 4.0.0. I have a simple solution what works nicely: final RestTemplate restTemplate = new RestTemplate(); final String plainCreds = "username:password"; final byte[] plainCredsBytes = plainCreds.getBytes(); final byte[] base64CredsBytes = Base64.encodeBase64(plainCredsBytes); final String base64Creds = new String(base64CredsBytes); final HttpHeaders headers = new HttpHeaders(); headers.add("Authorization",

JQuery Ajax calls with HTTP Basic Authentication

霸气de小男生 提交于 2019-11-28 17:52:05
I have a REST based server which I am trying to communicate with using JQuery. Both XML and JSON are available as response formats, so I am using JSON. The connections are all SSL so HTTP Basic Authentication has been our authorization method of choice, and we have had no problems with other front ends (raw Javascript, Silverlight, etc...) Now I am attempting to put something together with JQuery and having endless problems using HTTP Basic Authentication. I have scoured through numerous previous questions most of which either have solutions that do not seem to actually work or blame the

Apache2 Reverse Proxy to an end-point that requires BasicAuth but want to hide this from user

岁酱吖の 提交于 2019-11-28 16:54:01
Basically my scenario is that I have an internal website that requires a SINGLE hard-coded username and password to access (and this can't be turned off, only changed). I am exposing this website through a reverse proxy for various reasons (hiding the port, simplifying url, simplifying NAT, etc). However, what I would like to do is be able to use Apache to handle the authentication so that: I don't have to give out single password to everyone I can have multiple usernames and passwords using Apache's BasicAuth For internal users, I don't have to prompt for a password EDIT: Second part about

In Spring-Security with Java Config, why does httpBasic POST want csrf token?

最后都变了- 提交于 2019-11-28 16:42:05
I am using Spring-Security 3.2.0.RC2 with Java config. I set up a simple HttpSecurity config that asks for basic auth on /v1/**. GET requests work but POST requests fail with: HTTP Status 403 - Invalid CSRF Token 'null' was found on the request parameter '_csrf' or header 'X-CSRF-TOKEN'. My security config looks like this: @Configuration @EnableWebSecurity public class SecurityConfig extends WebSecurityConfigurerAdapter { @Resource private MyUserDetailsService userDetailsService; @Autowired //public void configureGlobal(AuthenticationManagerBuilder auth) public void configure

How to define the basic HTTP authentication using cURL correctly?

谁都会走 提交于 2019-11-28 16:36:18
I'm learning Apigility ( Apigility docu -> REST Service Tutorial ) and trying to send a POST request with basic authentication via cURL: $ curl -X POST -i -H "Content-Type: application/hal+json" -H "Authorization: Basic YXBpdXNlcjphcGlwd2Q=" http://apigilityhw.sandbox.loc/status YXBpdXNlcjphcGlwd2Q= is the base 64 encoded string with my credentials apiuser:apipwd . The credentials are saved in the /data/htpasswd ( apiuser:$apr1$3J4cyqEw$WKga3rQMkxvnevMuBaekg/ ). The looks like this: HTTP/1.1 401 Unauthorized Server: nginx/1.4.7 Date: Mon, 22 Sep 2014 07:48:47 GMT Content-Type: application

HTTP Spec: Proxy-Authorization and Authorization headers

放肆的年华 提交于 2019-11-28 15:31:45
So I'm trying to implement the following scenario: An application is protected by Basic Authentication. Let's say it is hosted on app.com An HTTP proxy, in front of the application, requires authentication as well. It is hosted on proxy.com The user must therefore provide credentials for both the proxy and the application in the same request, thus he has different username/password pairs: one pair to authenticate himself against the application, and another username/password pair to authenticate himself against the proxy. After reading the specs, I'm not really sure on how I should implement

HTTP Basic Authentication - what's the expected browser experience?

。_饼干妹妹 提交于 2019-11-28 15:19:53
When a server allows access via Basic HTTP Authentication, what is the experience expected to be on the browser? I typically just do this with curl: curl -u myusername:mypassword http://somesite.com And it works just fine. However, right now I don't have access to curl (long story), and I want to just do it from the web browser, if possible. I thought the way Basic Auth was supposed to work was - I type in the url I want, the server then decides I'm not authorized, returns response code 401, and I type my username and password into a prompt. If it's correct, the page loads! However, on

Basic HTTP and Bearer Token Authentication

 ̄綄美尐妖づ 提交于 2019-11-28 15:12:45
问题 I am currently developing a REST-API which is HTTP-Basic protected for the development environment. As the real authentication is done via a token, I'm still trying to figure out, how to send two authorization headers. I have tried this one: curl -i http://dev.myapp.com/api/users \ -H "Authorization: Basic Ym9zY236Ym9zY28=" \ -H "Authorization: Bearer mytoken123" I could for example disable the HTTP-Authentication for my IP but as I usually work in different environments with dynamic IPs,

.htaccess / .htpasswd bypass if at a certain IP address

寵の児 提交于 2019-11-28 15:08:14
问题 Is it possible to have an .htaccess/.htpasswd access control setup for a given directory, but if they are from a specific IP address, bypass the login/password authentication? I know you can do something like this in the .htaccess file: order deny,allow deny from all allow from 000.000.000.000 But if you add something along these lines: AuthType Basic AuthName "restricted area" AuthUserFile /path/to/.htpasswd require valid-user Then it prompts for the password. Is there any way to do an if

Why Base64 in Basic Authentication

二次信任 提交于 2019-11-28 12:27:34
why has the resulting string literal of "username:password" be encoded with Base64 in the Authorization header? Whats the background of it? This is the production rule for the userid-password tuple before it’s encoded: userid-password = [ token ] ":" *TEXT Here token is specified as follows: token = 1*<any CHAR except CTLs or tspecials> This is basically any US-ASCII character within the range of 32 to 126 but without some special characters ( ( , ) , < , > , @ , , , ; , : , \ , " , / , [ , ] , ? , = , { , } , space, and horizontal tab). And TEXT is specified as follows: TEXT = <any OCTET