Created
February 20, 2013 18:37
-
-
Save bshaffer/4997879 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.omniture.android.dashboard.viewer.model.user; | |
import java.io.UnsupportedEncodingException; | |
import java.net.URLEncoder; | |
public class AuthParams { | |
String mAuth_username; | |
String mAuth_nonce; | |
String mAuth_created; | |
String mAuth_digest; | |
String mAppdigest; | |
String mAppnonce; | |
String mAppkey; | |
public AuthParams() { | |
super(); | |
} | |
public AuthParams(String mAuthUsername, String mAuthNonce, String mAuthCreated, String mAuthDigest, String mAppdigest, String mAppnonce, | |
String mAppkey) { | |
super(); | |
try { | |
this.mAuth_username = URLEncoder.encode(mAuthUsername, "UTF-8").replace(":", "%3a").replace("+", "%20"); | |
this.mAuth_nonce = URLEncoder.encode(mAuthNonce, "UTF-8").replace(":", "%3a").replace("+", "%20"); | |
this.mAuth_created = URLEncoder.encode(mAuthCreated, "UTF-8").replace(":", "%3a").replace("+", "%20"); | |
this.mAuth_digest = URLEncoder.encode(mAuthDigest, "UTF-8").replace(":", "%3a").replace("+", "%20"); | |
this.mAppdigest = URLEncoder.encode(mAppdigest, "UTF-8").replace(":", "%3a").replace("+", "%20"); | |
this.mAppnonce = URLEncoder.encode(mAppnonce, "UTF-8").replace(":", "%3a").replace("+", "%20"); | |
this.mAppkey = URLEncoder.encode(mAppkey, "UTF-8").replace(":", "%3a").replace("+", "%20"); | |
} catch (UnsupportedEncodingException e) { | |
e.printStackTrace(); | |
} | |
} | |
public String getCompleteAuthString() { | |
String auth_string = "&auth_username=" + mAuth_username + "&auth_created=" + mAuth_created + "&auth_digest=" + mAuth_digest + "&auth_nonce=" | |
+ mAuth_nonce + "&appkey=" + mAppkey + "&appdigest=" + mAppdigest + "&appnonce=" + mAppnonce; | |
return auth_string; | |
} | |
public String getAppKeyString() { | |
String app_key_string = "&appkey=" + mAppkey + "&appdigest=" + mAppdigest + "&appnonce=" + mAppnonce; | |
return app_key_string; | |
} | |
public String getAuthString() { | |
String auth_string = "UsernameToken Username=\"" + mAuth_username + "\", PasswordDigest=\"" + mAuth_digest + "\", Nonce=\"" + mAuth_nonce | |
+ "\", Created=\"" + mAuth_created + "\""; | |
return auth_string; | |
} | |
public String getWSSE() { | |
String auth_string = "UsernameToken Username=\"" + mAuth_username + "\", PasswordDigest=\"" + mAuth_digest + "\", Nonce=\"" + mAuth_nonce | |
+ "\", Created=\"" + mAuth_created + "\""; | |
return auth_string; | |
} | |
public String getmAuth_username() { | |
return mAuth_username; | |
} | |
public void setmAuth_username(String mAuthUsername) { | |
try { | |
this.mAuth_username = URLEncoder.encode(mAuthUsername, "UTF-8").replace(":", "%3a").replace("+", "%20"); | |
} catch (UnsupportedEncodingException e) { | |
e.printStackTrace(); | |
} | |
} | |
public String getmAuth_nonce() { | |
return mAuth_nonce; | |
} | |
public void setmAuth_nonce(String mAuthNonce) { | |
try { | |
this.mAuth_nonce = URLEncoder.encode(mAuthNonce, "UTF-8").replace(":", "%3a").replace("+", "%20"); | |
} catch (UnsupportedEncodingException e) { | |
e.printStackTrace(); | |
} | |
} | |
public String getmAuth_created() { | |
return mAuth_created; | |
} | |
public void setmAuth_created(String mAuthCreated) { | |
try { | |
this.mAuth_created = URLEncoder.encode(mAuthCreated, "UTF-8").replace(":", "%3a").replace("+", "%20"); | |
} catch (UnsupportedEncodingException e) { | |
e.printStackTrace(); | |
} | |
} | |
public String getmAuth_digest() { | |
return mAuth_digest; | |
} | |
public void setmAuth_digest(String mAuthDigest) { | |
this.mAuth_digest = mAuthDigest; | |
} | |
public String getmAppdigest() { | |
return mAppdigest; | |
} | |
public void setmAppdigest(String mAppdigest) { | |
this.mAppdigest = mAppdigest; | |
} | |
public String getmAppnonce() { | |
return mAppnonce; | |
} | |
public void setmAppnonce(String mAppnonce) { | |
try { | |
this.mAppnonce = URLEncoder.encode(mAppnonce, "UTF-8").replace(":", "%3a").replace("+", "%20"); | |
} catch (UnsupportedEncodingException e) { | |
e.printStackTrace(); | |
} | |
} | |
public String getmAppkey() { | |
return mAppkey; | |
} | |
public void setmAppkey(String mAppkey) { | |
try { | |
this.mAppkey = URLEncoder.encode(mAppkey, "UTF-8").replace(":", "%3a").replace("+", "%20"); | |
} catch (UnsupportedEncodingException e) { | |
e.printStackTrace(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment