linked: move github client id and secret into build vars
This commit is contained in:
@@ -157,6 +157,10 @@ android {
|
|||||||
buildConfigField "String", "ACCOUNT_TYPE", "\"org.sufficientlysecure.keychain.debug.account\""
|
buildConfigField "String", "ACCOUNT_TYPE", "\"org.sufficientlysecure.keychain.debug.account\""
|
||||||
buildConfigField "String", "PROVIDER_CONTENT_AUTHORITY", "\"org.sufficientlysecure.keychain.debug.provider\""
|
buildConfigField "String", "PROVIDER_CONTENT_AUTHORITY", "\"org.sufficientlysecure.keychain.debug.provider\""
|
||||||
|
|
||||||
|
// Github api for debug build only
|
||||||
|
buildConfigField "String", "GITHUB_CLIENT_ID", "\"7a011b66275f244d3f21\""
|
||||||
|
buildConfigField "String", "GITHUB_CLIENT_SECRET", "\"ced8a6655719d8c6848396de97b3f5d7a89fec\""
|
||||||
|
|
||||||
// Reference them in .xml files.
|
// Reference them in .xml files.
|
||||||
resValue "string", "account_type", "org.sufficientlysecure.keychain.debug.account"
|
resValue "string", "account_type", "org.sufficientlysecure.keychain.debug.account"
|
||||||
resValue "string", "provider_content_authority", "org.sufficientlysecure.keychain.debug.provider"
|
resValue "string", "provider_content_authority", "org.sufficientlysecure.keychain.debug.provider"
|
||||||
|
|||||||
@@ -91,9 +91,6 @@ public class LinkedIdCreateGithubFragment extends CryptoOperationFragment<SaveKe
|
|||||||
IDLE, AUTH_PROCESS, AUTH_ERROR, POST_PROCESS, POST_ERROR, LID_PROCESS, LID_ERROR, DONE
|
IDLE, AUTH_PROCESS, AUTH_ERROR, POST_PROCESS, POST_ERROR, LID_PROCESS, LID_ERROR, DONE
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final String GITHUB_CLIENT_ID = "7a011b66275f244d3f21";
|
|
||||||
public static final String GITHUB_CLIENT_SECRET = "eaced8a6655719d8c6848396de97b3f5d7a89fec";
|
|
||||||
|
|
||||||
ViewAnimator mButtonContainer;
|
ViewAnimator mButtonContainer;
|
||||||
|
|
||||||
StatusIndicator mStatus1, mStatus2, mStatus3;
|
StatusIndicator mStatus1, mStatus2, mStatus3;
|
||||||
@@ -170,7 +167,7 @@ public class LinkedIdCreateGithubFragment extends CryptoOperationFragment<SaveKe
|
|||||||
new Handler().postDelayed(new Runnable() {
|
new Handler().postDelayed(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
oAuthRequest("github.com/login/oauth/authorize", GITHUB_CLIENT_ID, "gist");
|
oAuthRequest("github.com/login/oauth/authorize", BuildConfig.GITHUB_CLIENT_ID, "gist");
|
||||||
}
|
}
|
||||||
}, 300);
|
}, 300);
|
||||||
|
|
||||||
@@ -213,8 +210,8 @@ public class LinkedIdCreateGithubFragment extends CryptoOperationFragment<SaveKe
|
|||||||
try {
|
try {
|
||||||
|
|
||||||
JSONObject params = new JSONObject();
|
JSONObject params = new JSONObject();
|
||||||
params.put("client_id", GITHUB_CLIENT_ID);
|
params.put("client_id", BuildConfig.GITHUB_CLIENT_ID);
|
||||||
params.put("client_secret", GITHUB_CLIENT_SECRET);
|
params.put("client_secret", BuildConfig.GITHUB_CLIENT_SECRET);
|
||||||
params.put("code", mOAuthCode);
|
params.put("code", mOAuthCode);
|
||||||
params.put("state", mOAuthState);
|
params.put("state", mOAuthState);
|
||||||
|
|
||||||
@@ -379,11 +376,11 @@ public class LinkedIdCreateGithubFragment extends CryptoOperationFragment<SaveKe
|
|||||||
protected Void doInBackground(Void... dummy) {
|
protected Void doInBackground(Void... dummy) {
|
||||||
try {
|
try {
|
||||||
HttpsURLConnection nection = (HttpsURLConnection) new URL(
|
HttpsURLConnection nection = (HttpsURLConnection) new URL(
|
||||||
"https://api.github.com/applications/" + GITHUB_CLIENT_ID + "/tokens/" + token)
|
"https://api.github.com/applications/" + BuildConfig.GITHUB_CLIENT_ID + "/tokens/" + token)
|
||||||
.openConnection();
|
.openConnection();
|
||||||
nection.setRequestMethod("DELETE");
|
nection.setRequestMethod("DELETE");
|
||||||
String encoded = Base64.encodeToString(
|
String encoded = Base64.encodeToString(
|
||||||
(GITHUB_CLIENT_ID + ":" + GITHUB_CLIENT_SECRET).getBytes(), Base64.DEFAULT);
|
(BuildConfig.GITHUB_CLIENT_ID + ":" + BuildConfig.GITHUB_CLIENT_SECRET).getBytes(), Base64.DEFAULT);
|
||||||
nection.setRequestProperty("Authorization", "Basic " + encoded);
|
nection.setRequestProperty("Authorization", "Basic " + encoded);
|
||||||
nection.connect();
|
nection.connect();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user