http-authentication

WCF WebHttp Mixed Authentication (Basic AND Anonymous)

十年热恋 提交于 2019-12-06 23:55:44
问题 All of this is pertaining to WebHttp binding, hosted in a custom Service Host (IIS is not an option at this time). I've implemented a custom UserNamePasswordValidator, and a custom IAuthorizationPolicy. When I configure the endpoint's binding to use Basic authentication, everything works just as I'd like (custom principal, custom roles, etc..). I'd like to add the ability for anonymous HTTP access as well, and have my custom implementations put the Anonymous user in some default roles, etc..

Connecting to socket with authentication in python

久未见 提交于 2019-12-06 14:47:15
I'm trying to connect to a mongodb instance through a python socket. The url looks like this username:password@host.com:port how can I connect to this with a python socket? The following code gives me this error: [Errno -5] No address associated with hostname import socket import tornado full_url = '%s:%s@%s' % (username, password, host) s = socket.socket() s.connect((full_url, port)) stream = iostream.IOStream(s) EDIT - the reason I ask is because asyncmongo doesn't support this type of url right now. I'm trying to see if I can write a patch. The asyncmongo library connects using a socket

NSURLRequest setValue: forHTTPHeaderField:@“Authorization” not working

走远了吗. 提交于 2019-12-06 11:31:44
I try to make an authenticate call to the twitter API with the Application only Authentication API NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:url] cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:20.0]; [request setHTTPMethod:@"POST"]; [request setValue:@"application/x-www-form-urlencoded;charset=UTF-8" forHTTPHeaderField:@"Content-Type"]; [request setValue:@"Some App Name" forHTTPHeaderField:@"User-Agent"]; [request setValue:authValue forHTTPHeaderField:@"Authorization"]; [request setHTTPBody:[@"grant_type=client_credentials"

Apache Http Digest Authentication using Java

心已入冬 提交于 2019-12-06 05:05:28
I am currently working on a Java project and I can't get the http digest authentication working. I tried using the Apache website, but it didn't help. I have a site that requires HTTP digest authentication. DefaultHttpClient httpclient = new DefaultHttpClient(); String hostUrl = "http://somewebsite.com"; String postUrl = "http://somewebsite.com/request"; HttpPost httpPost = new HttpPost(postUrl); String username = "hello"; String password = "world"; HttpHost targetHost = new HttpHost(hostUrl); httpclient.getCredentialsProvider().setCredentials( new AuthScope(hostUrl, AuthScope.ANY_PORT), new

Elasticsearch HTTP authentication in Spring

时光总嘲笑我的痴心妄想 提交于 2019-12-06 04:20:03
问题 I want to access a remote elasticsearch which is protected by a username and password. https://[username]:[password]@aws-eu-west-1-portal1.dblayer.com:11109/ In Spring using the XML config I was able to access my localhost elastic as shown below <!-- ElasticSearch --> <elasticsearch:repositories base-package="be.smartsearch.service.repository.elasticsearch" /> <elasticsearch:transport-client id="esClient" cluster-nodes="localhost:9300" /> <bean id="elasticsearchTemplate" class="org

Why is the http auth UI so poor in browsers?

喜欢而已 提交于 2019-12-05 22:57:12
问题 Why isn't there a logout button? Why no list of "websites you're logged into"? Is it because of some issue with the HTTP specs? Life would be much easier for web developers if they could actually rely on HTTP auth ... 回答1: No technical reason. I suppose if anything, the auth UI is neglected because fewer and fewer web sites are still using HTTP Basic Authentication, trending more towards various cookie-related login schemes... precisely because the auth UI is so poor! One could probably hack

How can I http-authentication login with javascript for an iframe?

瘦欲@ 提交于 2019-12-05 20:05:38
I need to make a page that will Login to a site automatically via http-authentication Show said site with an iframe I was thinking I could use XHR and specify the login headers directly, and then use javascript to create the iframe. Does this make sense? Will it work? Due to the same-origin-policy your XHR approach won't work. However, for HTTP authentication you can simply include the data in the url, i.e. the src of the <iframe> : <iframe src="http://username:password@domain.tld/..."></iframe> I think I don't have to mention that this should not be done if the login credentials are sensitive

Protect a url with HTTP authentication based on query string parameter

醉酒当歌 提交于 2019-12-05 19:39:30
I have a site with links like this: http://www.example.com/index.php?id=1 http://www.example.com/index.php?id=3 etc. I would like to have htaccess password protection for a specific ID, say 200. How can I do this? This is not straight forward but here is a way it can be done in .htaccess itself: RewriteEngine On # set URI to /index.php/200 if query string is id=200 RewriteCond %{QUERY_STRING} (?:^|&)id=(200|1)(?:&|$) [NC] RewriteRule ^(index\.php)/?$ $1/%1 [NC] # set SECURED var to 1 if URI is /index.php/200 SetEnvIfNoCase Request_URI "^/index\.php/(200|1)" SECURED # enforce auth if SECURED=1

Can I do preemptive authentication with httplib2?

喜你入骨 提交于 2019-12-05 09:47:06
I need to perform preemptive basic authentication against an HTTP server, i.e., authenticate right away without waiting on a 401 response. Can this be done with httplib2? Edit: I solved it by adding an Authorization header to the request, as suggested in the accepted answer: headers["Authorization"] = "Basic {0}".format( base64.b64encode("{0}:{1}".format(username, password))) Add an appropriately formed 'Authorization' header to your initial request. This also works with the built-in httplib (for anyone wishing to minimize 3rd-party libs/modules). I am using it to authenticate with our Jenkins

Laravel Basic HTTP Auth Check Returning False

ぃ、小莉子 提交于 2019-12-05 05:38:46
I'm using the basic HTTP authentication provided in Laravel to log in to my website. However, when I call Auth::Check() I always get false as the response even though I am logged in. Does Auth::Check() not work with the basic authentication model and if not, is there any way to check the basic authentication to see if a user is logged in? This is my user class: namespace App; use Illuminate\Foundation\Auth\User as Authenticatable; class User extends Authenticatable { /** * The attributes that are mass assignable. * * @var array */ protected $fillable = [ 'email', 'password', ]; /** * The