Skip to content

Can add Basic Auth, but cannot remove it #61

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
aaboyd opened this issue Jun 10, 2012 · 1 comment
Closed

Can add Basic Auth, but cannot remove it #61

aaboyd opened this issue Jun 10, 2012 · 1 comment
Assignees

Comments

@aaboyd
Copy link

aaboyd commented Jun 10, 2012

There is a mechanism to allow users to add credentials. Added in 1.4.0.

    /**
     * Sets basic authentication for the request. Uses AuthScope.ANY. This is the same as
     * setBasicAuth('username','password',AuthScope.ANY) 
     * @param username
     * @param password
     */
    public void setBasicAuth(String user, String pass){
        AuthScope scope = AuthScope.ANY;
        setBasicAuth(user, pass, scope);
    }

   /**
     * Sets basic authentication for the request. You should pass in your AuthScope for security. It should be like this
     * setBasicAuth("username","password", new AuthScope("host",port,AuthScope.ANY_REALM))
     * @param username
     * @param password
     * @param scope - an AuthScope object
     *
     */
    public void setBasicAuth( String user, String pass, AuthScope scope){
        UsernamePasswordCredentials credentials = new UsernamePasswordCredentials(user,pass);
        this.httpClient.getCredentialsProvider().setCredentials(scope, credentials);
    }

Since the library provides convenience methods to add credentials I believe there should be a mechanism to easily remove them as well.

@smarek
Copy link
Member

smarek commented Oct 13, 2013

This is actually a good point. I'm sending in an fix.

@ghost ghost assigned smarek Oct 13, 2013
@smarek smarek closed this as completed in 68840e7 Oct 13, 2013
iNdieboyjeff pushed a commit to iNdieboyjeff/android-async-http that referenced this issue Oct 14, 2013
# By mareksebera (51) and Marek Sebera (2)
# Via mareksebera
* 'master' of https://github.com/loopj/android-async-http: (53 commits)
  Handy method to specify charset in anonymous inner instances
  Sample Application initial state
  Removed unnecessary dependency, android-async-http#168
  Javadoc formatting
  Fixed 2d34e1c leftover, Closes android-async-http#86
  Fixing android-async-http#79, Allowing non-standard HTTP and HTTPS ports
  Added warning about SSL bypass fix
  Related to android-async-http#67, avoiding NPE in JsonHttpResponseHandler
  Fixes android-async-http#61, allow removing of Basic Auth credentials
  Compatibility changes fix
  Fixes android-async-http#14
  Fixes android-async-http#143
  android-async-http#88 uncatched exception
  Closes android-async-http#266
  Closes android-async-http#283
  Fixes android-async-http#286
  Fixes android-async-http#294
  Fixes android-async-http#287
  Fixes android-async-http#295
  Added Maven description to README file [skip ci]
  ...

Conflicts:
	.classpath
	build.gradle
	project.properties
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants