Android Open Source - SipgateInfo Preferences Authenticator






From Project

Back to project page SipgateInfo.

License

The source code is released under:

GNU General Public License

If you think the Android project SipgateInfo 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

package net.skweez.sipgate;
/*from   ww w. j a  va  2 s  .  c  om*/
import java.net.Authenticator;
import java.net.PasswordAuthentication;

import android.content.SharedPreferences;

/**
 * An implementation of {@link Authenticator} that gets user name and password
 * from the {@link SharedPreferences}.
 * 
 * @author Michael Kanis
 */
public class PreferencesAuthenticator extends Authenticator {

  private final SharedPreferences prefs;

  public PreferencesAuthenticator(SharedPreferences preferences) {
    this.prefs = preferences;
  }

  /** {@inheritDoc} */
  @Override
  protected PasswordAuthentication getPasswordAuthentication() {

    String userName = prefs.getString("username", null);
    String password = prefs.getString("password", null);

    if (userName == null || password == null) {
      return null;
    }

    return new PasswordAuthentication(userName, password.toCharArray());
  }
}




Java Source Code List

net.skweez.sipgate.CallUtils.java
net.skweez.sipgate.PreferencesAuthenticator.java
net.skweez.sipgate.SipgateApplication.java
net.skweez.sipgate.activity.AccountInfoAdapter.java
net.skweez.sipgate.activity.CallListAdapter.java
net.skweez.sipgate.activity.MainActivity.java
net.skweez.sipgate.activity.SetupActivity.java
net.skweez.sipgate.api.AuthenticationException.java
net.skweez.sipgate.api.Call.java
net.skweez.sipgate.api.ECallStatus.java
net.skweez.sipgate.api.ISipgateAPI.java
net.skweez.sipgate.api.Price.java
net.skweez.sipgate.api.SipgateException.java
net.skweez.sipgate.api.UserName.java
net.skweez.sipgate.api.UserUri.java
net.skweez.sipgate.api.xmlrpc.SipgateUriHelper.java
net.skweez.sipgate.api.xmlrpc.SipgateXmlRpcImpl.java
net.skweez.sipgate.db.DataSource.java
net.skweez.sipgate.db.DatabaseHelper.java
net.skweez.sipgate.model.AccountInfo.java
net.skweez.sipgate.service.QueryResultReceiver.java
net.skweez.sipgate.service.QueryService.java