From: David A. Velasco Date: Wed, 27 Mar 2013 12:39:00 +0000 (+0100) Subject: Make the OAuth authorization available or not depending upon a variable in oauth.xml X-Git-Tag: oc-android-1.4.3~29^2~5 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/2e5b40e357a5ab18b3a04f823b7cd27d5c94dc90?hp=-c Make the OAuth authorization available or not depending upon a variable in oauth.xml --- 2e5b40e357a5ab18b3a04f823b7cd27d5c94dc90 diff --git a/res/values/oauth2_configuration.xml b/res/values/oauth2_configuration.xml index c3d5c72b..e56f225a 100644 --- a/res/values/oauth2_configuration.xml +++ b/res/values/oauth2_configuration.xml @@ -1,5 +1,10 @@ + + off + owncloud owncloud://callback diff --git a/src/com/owncloud/android/authentication/AuthenticatorActivity.java b/src/com/owncloud/android/authentication/AuthenticatorActivity.java index 44ebf6a9..cc1b6482 100644 --- a/src/com/owncloud/android/authentication/AuthenticatorActivity.java +++ b/src/com/owncloud/android/authentication/AuthenticatorActivity.java @@ -87,6 +87,10 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity private static final String KEY_IS_SSL_CONN = "IS_SSL_CONN"; private static final String KEY_OAUTH2_STATUS_TEXT = "OAUTH2_STATUS_TEXT"; private static final String KEY_OAUTH2_STATUS_ICON = "OAUTH2_STATUS_ICON"; + + private static final String OAUTH_MODE_ON = "on"; + private static final String OAUTH_MODE_OFF = "off"; + private static final String OAUTH_MODE_OPTIONAL = "optional"; private static final int DIALOG_LOGIN_PROGRESS = 0; private static final int DIALOG_SSL_VALIDATOR = 1; @@ -154,7 +158,6 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity mOkButton = findViewById(R.id.buttonOK); mAuthStatusLayout = (TextView) findViewById(R.id.auth_status_text); - /// complete label for 'register account' button Button b = (Button) findViewById(R.id.account_register); if (b != null) { @@ -179,7 +182,7 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity /// retrieve extras from intent String tokenType = getIntent().getExtras().getString(AccountAuthenticator.KEY_AUTH_TOKEN_TYPE); - boolean oAuthRequired = AccountAuthenticator.AUTH_TOKEN_TYPE_ACCESS_TOKEN.equals(tokenType); + boolean oAuthRequired = AccountAuthenticator.AUTH_TOKEN_TYPE_ACCESS_TOKEN.equals(tokenType) || OAUTH_MODE_ON.equals(getString(R.string.oauth2_mode)); mAccount = getIntent().getExtras().getParcelable(EXTRA_ACCOUNT); if (mAccount != null) { @@ -201,6 +204,10 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity loadSavedInstanceState(savedInstanceState); } + if (!OAUTH_MODE_OPTIONAL.equals(getString(R.string.oauth2_mode))) { + mOAuth2Check.setVisibility(View.GONE); + } + if (mAction == ACTION_UPDATE_TOKEN) { /// lock things that should not change mHostUrlInput.setEnabled(false);