basic-authentication

Adding Basic Authorization for Swagger-UI

半城伤御伤魂 提交于 2019-11-27 14:42:06
I have currently deployed a swagger project but I am having trouble adding some basic authorization to it. Currenty when you click on the "Try it out!" button you are required to log in to an account to access the results. I have an account that I want to automatically be used everytime someone tries to access the api. Bellow is my index.html for the project: <!DOCTYPE html> <html> <head> <title>Swagger UI</title> <link href='css/screen.css' media='screen' rel='stylesheet' type='text/css'/> <link href='css/screen.css' media='print' rel='stylesheet' type='text/css'/> <script src='lib/jquery-1.8

Spring Security HTTP Basic Authentication

烂漫一生 提交于 2019-11-27 14:29:29
I am trying to do a really simple basic authentication with Spring Security. I have configured the namespace properly and there are no Exceptions in the server. In my "servlet.xml" I have got the next for Spring Security: <security:http> <security:http-basic></security:http-basic> <security:intercept-url method="POST" pattern="/**" access="ROLE_USER" /> </security:http> <security:authentication-manager alias="authenticationManager"> <security:authentication-provider> <security:user-service> <security:user name="cucu" password="tas" authorities="ROLE_USER" /> <security:user name="bob" password=

Getting a value from HttpServletRequest.getRemoteUser() in Tomcat without modifying application

走远了吗. 提交于 2019-11-27 13:17:35
问题 (Using Java 6 and Tomcat 6.) Is there a way for me to get HttpServletRequest.getRemoteUser() to return a value in my development environment (i.e. localhost) without needing to modify my application's web.xml file? The reason I ask is that the authentication implementation when the app is deployed to a remote environment is handled by a web server and plugged-in tool. Running locally I obviously do not have the plugged-in tool or a separate web server; I just have Tomcat 6. I am trying to

Logging a user out when using HTTP Basic authentication

左心房为你撑大大i 提交于 2019-11-27 11:56:41
I want users to be able to log in via HTTP Basic authentication modes. The problem is that I also want them to be able to log out again - weirdly browsers just don't seem to support that. This is considered to be a social-hacking risk - user leaves their machine unlocked and their browser open and someone else can easily visit the site as them. Note that just closing the browser-tab is not enough to reset the token, so it could be an easy thing for users to miss. So I've come up with a workaround, but it's a total cludge: 1) Redirect them to a Logoff page 2) On that page fire a script to ajax

How do I create a user account for basic authentication?

老子叫甜甜 提交于 2019-11-27 11:25:00
I'd like to add basic authentication to my website. I followed the instructions in the MSDN article on Configure Basic Authentication (IIS 7) To use the UI Open IIS Manager and navigate to the level you want to manage. For information about opening IIS Manager, see Open IIS Manager (IIS 7) . For information about navigating to locations in the UI, see Navigation in IIS Manager (IIS 7) . In Features View , double-click Authentication . On the Authentication page, select Basic Authentication . In the Actions pane, click Enable to use Basic authentication with the default settings. Optionally, in

Spring 4.0.0 basic authentication with RestTemplate

大兔子大兔子 提交于 2019-11-27 11:18:10
问题 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

JQuery Ajax calls with HTTP Basic Authentication

半城伤御伤魂 提交于 2019-11-27 10:51:50
问题 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

How to use http.client in Node.js if there is basic authorization

你离开我真会死。 提交于 2019-11-27 10:12:20
As per title, how do I do that? Here is my code: var http = require('http'); // to access this url I need to put basic auth. var client = http.createClient(80, 'www.example.com'); var request = client.request('GET', '/', { 'host': 'www.example.com' }); request.end(); request.on('response', function (response) { console.log('STATUS: ' + response.statusCode); console.log('HEADERS: ' + JSON.stringify(response.headers)); response.setEncoding('utf8'); response.on('data', function (chunk) { console.log('BODY: ' + chunk); }); }); Ivo Wetzel You have to set the Authorization field in the header. It

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

假如想象 提交于 2019-11-27 09:51:22
问题 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 /

How to define the basic HTTP authentication using cURL correctly?

本秂侑毒 提交于 2019-11-27 09:48:23
问题 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