basic-authentication

401 error when using [Authenticate] with BasicAuthProvider

徘徊边缘 提交于 2019-12-06 05:17:56
I'm having some trouble with authenticating with ServiceStack using the BasicAuthProvider. All works well when I authenticate using the provider route 'auth/myauth' but when I go to one of my other service DTOS that use the [Authenticate] attribute e.g. /hello, I always get a 401 Unauthorized error even when I always supply the basic authentication details in the 'Authorization' header using beforeSend with jQuery. Basically, I'm building an API for a mobile app that involves credential authentication on the first time(or if a supplied token isn't expired), then subsequently basic

Custom channel based authentication with gRPC

妖精的绣舞 提交于 2019-12-06 05:09:10
How can I do simple channel authentication with gRPC in dotnet? I want to pass just the client machine name and the client service name during the channel connection, and then be able of getting those in the server once, as a way of identifying where are the request coming from. I do not want to pass them as metadata in every call, and I do not want to implement an additional method for that. I have been taking a look to the documentation and trying to implement some abstract classes like ServerCredentials but I do not see how it would be done neither if it is even possible due some internal

How to do ASP.NET Web API integration tests with authorize attribute

独自空忆成欢 提交于 2019-12-06 04:03:39
问题 I do have authorize attribute applied on my Web API. I am calling Web API from MVC4 application in which I am using standard cookie based authentication. I need to call Web API method on controllers from integration tests but because authorize attribute is applied I will always receive unauthorized exception . What is the best way to solve this problem ? PS. I don't want (need) to use other methods of authentication such as APIKey,Token in Auth Header and similar... 回答1: First of all, one key

How do I exclude a path from requiring basic auth in Sinatra

无人久伴 提交于 2019-12-06 03:59:15
问题 I'm writing a smallish web service in Ruby using Sinatra. Access to pretty much everything is controlled using http basic auth (over https in production). There is one particular directory that I want to exclude from requiring authorization. Is there an easy way to do this? 回答1: require 'sinatra' helpers do def protected! unless authorized? response['WWW-Authenticate'] = %(Basic realm="Testing HTTP Auth") throw(:halt, [401, "Not authorized\n"]) end end def authorized? @auth ||= Rack::Auth:

How to set HTTP Request Header “authentication” using HTTPClient?

痴心易碎 提交于 2019-12-06 03:14:55
I want to set the HTTP Request header "Authorization" when sending a POST request to a server. How do I do it in Java? Does HttpClient have any support for it? http://www.w3.org/Protocols/HTTP/HTRQ_Headers.html#z9 The server requires me to set some specific value for the authorization field: of the form ID:signature which they will then use to authenticate the request. Thanks Ajay Below is the example for setting request headers HttpPost post = new HttpPost("someurl"); post.addHeader(key1, value1)); post.addHeader(key2, value2)); Here is the code for a Basic Access Authentication : HttpPost

How to pass through window asking for basic auth credentials that appears when click link redirecting from HTTP to HTTPS?

最后都变了- 提交于 2019-12-06 02:55:46
问题 I have a website where most of pages are normally used via HTTP but some other pages are available only via HTTPS. Site is protected by basic auth (credentials are the same for HTTP and HTTPS pages). When I open any HTTP page in browser (either FF or Chrome) and click link that leads to HTTPS page, browser shows alert that asks for basic auth credentials. I have same issue with Webdriver (either FF or Chrome): When I visit http://username:password@some_domain.com and click link that leads to

How do you access the HTTP basic authentication username from perl?

只谈情不闲聊 提交于 2019-12-06 02:13:23
问题 I need to get the remote user name in my CGI script. Where do I find that? I want to display that name on the page that I return. 回答1: Under the CGI spec, the HTTP-auth user name will be in the environment variable REMOTE_USER . In Perl you can get this via $ENV{REMOTE_USER} . You can find descriptions of all the standard CGI environment variables, including REMOTE_USER , in section 4 of RFC 3875. 回答2: The remote_user() method in the CGI module. If you're not using the CGI module, the

HTTP Basic Authentication + Access Token?

白昼怎懂夜的黑 提交于 2019-12-06 00:44:03
问题 I am developing a REST API that I plan on using with a web and IOS app. I intend for this API to be private for sometime (private meaning I only want my web app and ios app to access the api). I have read about many different authentication methods but I am still to confused to select the appropriate authentication method for my API. From what I understand, oAuth2 is for allowing users to login to your APP using other service providers so that you can access the data on the respective service

Spring RestTemplate: SSL handshake failure

自古美人都是妖i 提交于 2019-12-06 00:15:31
问题 I am trying to consume a restful ws with basic auth. I did not import any cert into my keystore. When I use chrome plugin Advance Rest client to test it (using basic auth with base64 encoded username:pass). I can see the response back. So far so good. But when I develop Java code to consume this ws, I get SSL handsake failure: org.springframework.web.client.ResourceAccessException: I/O error: Received fatal alert: handshake_failure; nested exception is javax.net.ssl.SSLHandshakeException:

How to get ServiceStack authentication to work? (with iPhone clients)

我怕爱的太早我们不能终老 提交于 2019-12-05 21:36:51
问题 We have hired a contractor who is writing an iPhone app for us, and I'm starting to write the backend service for it with ServiceStack. I'm struggling with authorization in general: what kind of authorization to use and how to implement it. I don't know much about ServiceStack, HTTP and authorization (yet).. I've read this, but I'm probably still doing something wrong. I will use usernames and passwords from an existing legacy database to authenticate (but nothing else - no registering of new