basic-authentication

How to send username:password to unittest's app.get() request?

你。 提交于 2019-12-05 01:24:32
This is part of my unit test in Flask-RESTful. self.app = application.app.test_client() rv = self.app.get('api/v1.0/{0}'.format(ios_sync_timestamp)) eq_(rv.status_code,200) Within the command line I could use curl to send the username:password to the service: curl -d username:password http://localhost:5000/api/v1.0/1234567 How do I achieve the same within my unit test's get() ? Since my get/put/post require authentication otherwise the test would fail. From RFC 1945, Hypertext Transfer Protocol -- HTTP/1.0 11.1 Basic Authentication Scheme ... To receive authorization, the client sends the user

Basic Authentication with jQuery.ajax request and jsonp

五迷三道 提交于 2019-12-04 23:06:18
I have some local html/js files with which I'd like to invoke some remote servers via https and eventually use Basic Authentication for the request. I am encountering two problems. First is that if I don't specify 'jsonp' for the dataType, jQuery.ajax() request returns the error: Access to restricted URI denied code: 1012 Are my requests considered cross-domain because my main work file is stored locally, but retrieving data from a server elsewhere? So fine, I update the call so it now looks like: $.ajax({ url: myServerUrl, type: "GET", dataType: "jsonp", // considered a cross domain Ajax

Backbone HTTP basic rest api authentication

末鹿安然 提交于 2019-12-04 20:21:40
问题 I am using Backbone.js and it communicates with a stateless rest API. Some calls require authentication, through HTTP basic. What I don't understand is, somehow I have to authenticate each request, how could I do this securely? My first thought was to have a cookie, store the username and password but this would be vulnerable? Can this be done securely? 回答1: Is https://github.com/fiznool/backbone.basicauth something you'd find useful? This plugin enables access to remote resources which are

Solr 5.3 & Zookeeper Security Authentication & Authorization

眉间皱痕 提交于 2019-12-04 19:59:55
There are a few topics and articles on Solr authentication & authorization, but I cannot get it to work (the way I like). I followed these tutorials / information sources: https://cwiki.apache.org/confluence/display/solr/Authentication+and+Authorization+Plugins and https://lucidworks.com/blog/2015/08/17/securing-solr-basic-auth-permission-rules/ Then I created this security.json and I confirmed it is active in Zookeeper: { "authentication":{ "class":"solr.BasicAuthPlugin", "credentials":{ "solr":"...", "admin":"...", "monitor":"...", "data_import":"..."}, "":{"v":8}}, "authorization":{ "class"

HTTP basic authentication through CXF interceptor not working

蹲街弑〆低调 提交于 2019-12-04 19:38:41
问题 I'm having some trouble setting the HTTP Authorization header for a web service request using Apache CXF. I have my client setup through spring: <bean id="loggingInInterceptor" class="org.apache.cxf.interceptor.LoggingInInterceptor" /> <bean id="loggingOutInterceptor" class="org.apache.cxf.interceptor.LoggingOutInterceptor" /> <bean id="myHTTPAuthInterceptor" class="my.app.MyHTTPAuthInterceptor" autowire="constructor" /> <bean id="webServiceFactory" class="my.app.WebServiceFactory"> <property

IP Camera - Streaming video with the basic authentication on Chrome

僤鯓⒐⒋嵵緔 提交于 2019-12-04 19:21:32
I have an Amcrest IP Camera. I would like to stream video to my web page. Its url is rtsp://mycamera.com:5554/stream In order to get the stream of the camera, the camera has a following API http://mycamera.com/video.mjpg It requires the basic authentication to work. By formatting the URL and putting it into the image tag like below, I can make it work on Firefox, Safari <img src="http://username:password@mycamera.com/video.mjpg" /> However, Chrome (v.40 on mine) does not allow this kind of URL, the browser will promt the user password form to be filled, or simply refuses the request. Setting

Remove basic authentication header with apache mod proxy

喜你入骨 提交于 2019-12-04 16:33:42
问题 I have a HTTP Basic secured website. I hide a Tomcat application server with mod_proxy. Can I remove the HTTP Basic header? The Tomcat application reads the header and returns 401 not authorized. Basic auth isn't needed because the application uses cookie sessions. So I think just removing the headers would be fine. 回答1: Make sure mod_headers is enabled. An example config: <VirtualHost *:80> ServerName something.example.com ServerAdmin admin@example.com ProxyRequests Off ProxyPreserveHost Off

JaxWS: Webservice with Basic Authentication

混江龙づ霸主 提交于 2019-12-04 16:33:33
I'm building a client for a SOAP webservice. I auto-generated most of the client code with IntelliJ IDEA, by telling it to build a JaxWS webservice client from a WSDL. The webservice runs on different URLs (test, integration, production), so I need to be able to configure the service URL in my client. My code looks like this: String urlString = props.getProperty(URL); service = new RequestMultiTransportService(new URL(urlString), new QName("http://some.uri.com/", "RequestMultiTransportService")); Boolean useBasicAuth = Boolean.parseBoolean(props.getProperty(BASICAUTH)); RequestMultiTransport

Password Protect one webpage in Flask app

六月ゝ 毕业季﹏ 提交于 2019-12-04 14:42:58
I am running a Flask web app and using Apache basic authentication(with .htaccess and .htpasswd files) to password protect it. I want to password protect only one webpage in the app. When I password protect the html file for the webpage there is no effect and the webpage is still not password protected. Could this be because it is my python file that is calling the html file using render_template? I'm not sure how to fix this issue. You need to restrict access to your endpoint. This snippet should get you started down the right path. from functools import wraps from flask import request,

Consuming web service with c# and basic authentication [duplicate]

那年仲夏 提交于 2019-12-04 13:54:12
问题 This question already has answers here : How to pass user credentials to web service? (2 answers) Closed 3 years ago . I want to consume a web service with this code: WebService.GenRelClient client = new WebService.GenRelClient(); client.ClientCredentials.UserName.UserName = @"UserName"; client.ClientCredentials.UserName.Password = @"Password"; var response = client.returnString("test"); And my config looks like this: <?xml version="1.0" encoding="utf-8" ?> <configuration> <startup>