basic-authentication

How to call REST service with Basic Authentication in Angularjs 2.0?

时光总嘲笑我的痴心妄想 提交于 2019-12-23 10:08:25
问题 I have java REST services and consumer in Angularjs 1.3. Services are JSON based and expect BASIC authentication (username-password). In AgJs 1.3, I used Base64 factory code (found on google) for creating basic authentication token from username and password and able to consume services SUCCESSFULLY. I read HTTP class in AgJs 2.0 documentation but I didn't find any information about basic authentication. Could anybody please provide sample code to consume REST services in Angularjs 2.0 using

Apache 2.2 redirect to SSL *then* do auth (with solution < but is it crap?)

这一生的挚爱 提交于 2019-12-23 08:47:50
问题 Seems to be the place for apache so here goes :) Age old problem: how so I redirect HTTP->HTTPS, then and only if HTTPS, do an auth? Oh - and I'd like most of it in a single snippet that can be Include-ed in multiple <directory> or <location> blocks, so no virtual host level random path based rewrites... Well, here's what I have that does seem to work: In the top of a VirtualHost block # Set ssl_off environment variable RewriteEngine on RewriteCond %{HTTPS} =on RewriteRule ^ - [E=ssl] In the

RUBY - SSL, Basic Auth, and POST

假如想象 提交于 2019-12-23 08:27:51
问题 I'm having quite a hard time with this -- seems like there are a few snippets of code lying around that I can't seem to piece together. I'm simply trying to POST key/value pairs, but getting Connection refused - connect(2) (Errno::ECONNREFUSED) . Help! require 'net/http' require 'net/https' require 'uri' @http = Net::HTTP.new('https://my.url.com/path', 443) @http.use_ssl = true @http.start() { |http| req = Net::HTTP.post_form( URI.parse('https:///my.url.com/path'), {'key1' => 'value1', 'key2'

Getting error in <security:intercept-url pattern=“/**” access=“hasAnyRole('customer')”/> in spring security basic authentication?

筅森魡賤 提交于 2019-12-23 06:09:11
问题 This is my rest-dispather-servlet-security.xml file I have used the XML based configuration in my spring security but I am getting an error in my access attribute access="hasAnyRole('customer')" . Here is my xml file. <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:security="http://www.springframework.org/schema/security" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans

Can't set a header using Cors and Ajax

泪湿孤枕 提交于 2019-12-23 04:47:16
问题 Hello I am trying to do a http request with Basic Auth, but I can't set the header authorization and it is allowed in server. Ajax : $.ajax({ xhrFields: { withCredentials: true }, beforeSend: function(xhr){xhr.setRequestHeader('authorization', 'Basic cmFmmFuQHBoaWlubm92YXRpb25zLmNv=');}, url : 'http://www.vozi.dev.br/api/audio', type: 'POST', data: JSON.stringify(sender), dataType: 'json', contentType: 'application/json', success : function(data, textStatus, jqXHR) { //do something } }); Http

Why would Basic Auth not work with my WCF client to Java SOAP Web Service?

妖精的绣舞 提交于 2019-12-23 04:34:16
问题 I have a Java based web service that requires basic authentication to communicate with it. If I type the WSDL url into my browser I'm prompted for Basic Auth. Which I can get by entering the correct credentials. However using my WCF client doesn't work. I construct my WCF client like this: var binding = new BasicHttpBinding { MaxReceivedMessageSize = 2048 * 10240, Security = { Mode = BasicHttpSecurityMode.TransportCredentialOnly, Transport = { ClientCredentialType = HttpClientCredentialType

.Net CF 2.0 HttpWebRequest pre-authentication and sending credentials on first request

纵饮孤独 提交于 2019-12-23 04:17:06
问题 I'm attempting to communicate with bit.ly's REST API using their modified version of basic authentication. However in order for this to work HttpWebRequest needs to attach the credentials on the first request, however, HttpWebRequest will not send credentials on the first request and will wait for a 401 before sending any credentials even if PreAuthenticate is set to true (with PreAuthenticate it will send credentials for all subsequent requests). I have attempted the following to get

Jetty UserRealm redirect on 3th failed login

对着背影说爱祢 提交于 2019-12-23 03:39:18
问题 If I have a custom Jetty UserRealm implementation and its configured for basic authentication (with SSL), is there any way to get it to go to an specific page after the 3rd failed login? Well really I just want to display some contact information to the user if they cannot login after 3 attempts. Alternatively is it possible to display the exception which I throw from the public Principal authenticate(final String username, final Object credentials, final Request request) method when its

Custom channel based authentication with gRPC

走远了吗. 提交于 2019-12-22 10:29:02
问题 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

how to set authorization header with android's httpURLconnection

 ̄綄美尐妖づ 提交于 2019-12-22 08:30:53
问题 I am attempting to connect to my server using basic authentication, but when I set the Authorization header, it causes getInputStream to throw a fileNotFound exception. Here is the relevant code: URL url = new URL(myurl); //set up the connection HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setReadTimeout(10000);//this is in milliseconds conn.setConnectTimeout(15000);//this is in milliseconds String authHeader = getAuthHeader(userID,pass); conn.setRequestMethod("GET"