Android Open Source - ACM_Pi_Cloud Own Cloud Basic Credentials

From Project

Back to project page ACM_Pi_Cloud.


The source code is released under:

MIT License

If you think the Android project ACM_Pi_Cloud listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

/*from  w w w .  j a  va2  s. c  o m*/
import java.util.ArrayList;
import java.util.List;

import org.apache.commons.httpclient.UsernamePasswordCredentials;
import org.apache.commons.httpclient.auth.AuthPolicy;
import org.apache.commons.httpclient.auth.AuthScope;

public class OwnCloudBasicCredentials implements OwnCloudCredentials {

  private String mUsername;
  private String mPassword;

  public OwnCloudBasicCredentials(String username, String password) {
    mUsername = username != null ? username : "";
    mPassword = password != null ? password : "";

  public void applyTo(OwnCloudClient client) {
        List<String> authPrefs = new ArrayList<String>(1);
        client.getParams().setParameter(AuthPolicy.AUTH_SCHEME_PRIORITY, authPrefs);        
            new UsernamePasswordCredentials(mUsername, mPassword)

  public String getUsername() {
    return mUsername;

  public String getAuthToken() {
    return mPassword;

  public boolean authTokenExpires() {
    return false;


Java Source Code List