From 9cb3ddc448a0c1ff878f72882e57f7c3fa01a928 Mon Sep 17 00:00:00 2001 From: maxiaohong Date: Sat, 25 Nov 2017 15:30:52 +0800 Subject: [PATCH] change Shibboleth Login to Single Sign-On, and rename some files --- app/src/main/AndroidManifest.xml | 4 +- .../ui/SeafileAuthenticatorActivity.java | 10 +- ...ctivity.java => SingleSignOnActivity.java} | 34 ++-- ...ava => SingleSignOnAuthorizeActivity.java} | 20 +-- .../res/layout/shibboleth_welcome_layout.xml | 56 ------- ...ml => single_sign_on_authorize_layout.xml} | 4 +- .../layout/single_sign_on_welcome_layout.xml | 47 ++++++ app/src/main/res/values-cs-rCZ/strings.xml | 5 +- app/src/main/res/values-de/strings.xml | 12 +- app/src/main/res/values-el/strings.xml | 2 +- app/src/main/res/values-en-rUS/strings.xml | 29 ---- app/src/main/res/values-es-rAR/strings.xml | 10 +- app/src/main/res/values-es-rMX/strings.xml | 29 ---- app/src/main/res/values-es/strings.xml | 10 +- app/src/main/res/values-fi/strings.xml | 10 +- app/src/main/res/values-fr/strings.xml | 10 +- app/src/main/res/values-hu-rHU/strings.xml | 29 ---- app/src/main/res/values-hu/strings.xml | 10 +- app/src/main/res/values-is-rIS/strings.xml | 5 +- app/src/main/res/values-it/strings.xml | 155 ------------------ app/src/main/res/values-ja-rJP/strings.xml | 10 +- app/src/main/res/values-ko/strings.xml | 10 +- app/src/main/res/values-lv/strings.xml | 29 ---- app/src/main/res/values-nb-rNO/strings.xml | 5 +- app/src/main/res/values-nl-rNL/strings.xml | 10 +- app/src/main/res/values-pl-rPL/strings.xml | 10 +- app/src/main/res/values-pt-rBR/strings.xml | 5 +- app/src/main/res/values-ru/strings.xml | 10 +- app/src/main/res/values-tr/strings.xml | 4 +- app/src/main/res/values-ug/strings.xml | 29 ---- app/src/main/res/values-zh-rCN/strings.xml | 10 +- app/src/main/res/values-zh-rTW/strings.xml | 10 +- app/src/main/res/values-zh/strings.xml | 29 ---- app/src/main/res/values/strings.xml | 8 +- 34 files changed, 109 insertions(+), 561 deletions(-) rename app/src/main/java/com/seafile/seadroid2/account/ui/{ShibbolethActivity.java => SingleSignOnActivity.java} (67%) rename app/src/main/java/com/seafile/seadroid2/account/ui/{ShibbolethAuthorizeActivity.java => SingleSignOnAuthorizeActivity.java} (93%) delete mode 100644 app/src/main/res/layout/shibboleth_welcome_layout.xml rename app/src/main/res/layout/{shibboleth_authorize_layout.xml => single_sign_on_authorize_layout.xml} (91%) create mode 100644 app/src/main/res/layout/single_sign_on_welcome_layout.xml delete mode 100644 app/src/main/res/values-en-rUS/strings.xml delete mode 100644 app/src/main/res/values-es-rMX/strings.xml delete mode 100644 app/src/main/res/values-hu-rHU/strings.xml delete mode 100644 app/src/main/res/values-it/strings.xml delete mode 100644 app/src/main/res/values-lv/strings.xml delete mode 100644 app/src/main/res/values-ug/strings.xml delete mode 100644 app/src/main/res/values-zh/strings.xml diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 88bc9b8d3..54e2d1c9e 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -45,11 +45,11 @@ android:label="@string/app_name"> - - diff --git a/app/src/main/java/com/seafile/seadroid2/account/ui/SeafileAuthenticatorActivity.java b/app/src/main/java/com/seafile/seadroid2/account/ui/SeafileAuthenticatorActivity.java index 27162aecc..3bb48112f 100644 --- a/app/src/main/java/com/seafile/seadroid2/account/ui/SeafileAuthenticatorActivity.java +++ b/app/src/main/java/com/seafile/seadroid2/account/ui/SeafileAuthenticatorActivity.java @@ -27,7 +27,7 @@ public class SeafileAuthenticatorActivity extends BaseAuthenticatorActivity { public static final int SEACLOUD_CC = 0; - public static final int SHIBBOLETH_LOGIN = 1; + public static final int SINGLE_SIGN_ON_LOGIN = 1; public static final int OTHER_SERVER = 2; public final static String ARG_ACCOUNT_TYPE = "ACCOUNT_TYPE"; @@ -69,8 +69,8 @@ public void onItemClick(AdapterView parent, View view, int position, long id) intent.putExtra(SeafileAuthenticatorActivity.ARG_SERVER_URI, getString(R.string.server_url_seacloud)); startActivityForResult(intent, SeafileAuthenticatorActivity.REQ_SIGNUP); break; - case SHIBBOLETH_LOGIN: - intent = new Intent(SeafileAuthenticatorActivity.this, ShibbolethActivity.class); + case SINGLE_SIGN_ON_LOGIN: + intent = new Intent(SeafileAuthenticatorActivity.this, SingleSignOnActivity.class); intent.putExtras(getIntent()); startActivityForResult(intent, SeafileAuthenticatorActivity.REQ_SIGNUP); break; @@ -88,9 +88,9 @@ public void onItemClick(AdapterView parent, View view, int position, long id) mAccountManager = AccountManager.get(getBaseContext()); if (getIntent().getBooleanExtra(ARG_SHIB, false)) { - Intent intent = new Intent(this, ShibbolethAuthorizeActivity.class); + Intent intent = new Intent(this, SingleSignOnAuthorizeActivity.class); android.accounts.Account account = new android.accounts.Account(getIntent().getStringExtra(SeafileAuthenticatorActivity.ARG_ACCOUNT_NAME), com.seafile.seadroid2.account.Account.ACCOUNT_TYPE); - intent.putExtra(ShibbolethActivity.SHIBBOLETH_SERVER_URL, mAccountManager.getUserData(account, Authenticator.KEY_SERVER_URI)); + intent.putExtra(SingleSignOnActivity.SINGLE_SIGN_ON_SERVER_URL, mAccountManager.getUserData(account, Authenticator.KEY_SERVER_URI)); intent.putExtras(getIntent().getExtras()); startActivityForResult(intent, SeafileAuthenticatorActivity.REQ_SIGNUP); } else if (getIntent().getBooleanExtra(ARG_IS_EDITING, false)) { diff --git a/app/src/main/java/com/seafile/seadroid2/account/ui/ShibbolethActivity.java b/app/src/main/java/com/seafile/seadroid2/account/ui/SingleSignOnActivity.java similarity index 67% rename from app/src/main/java/com/seafile/seadroid2/account/ui/ShibbolethActivity.java rename to app/src/main/java/com/seafile/seadroid2/account/ui/SingleSignOnActivity.java index 0b0af770a..18ea8f5c6 100644 --- a/app/src/main/java/com/seafile/seadroid2/account/ui/ShibbolethActivity.java +++ b/app/src/main/java/com/seafile/seadroid2/account/ui/SingleSignOnActivity.java @@ -13,30 +13,30 @@ import com.seafile.seadroid2.ui.activity.BaseActivity; /** - * Shibboleth welcome page + * Single Sign-On welcome page *

*/ -public class ShibbolethActivity extends BaseActivity implements Toolbar.OnMenuItemClickListener { - public static final String DEBUG_TAG = "ShibbolethActivity"; +public class SingleSignOnActivity extends BaseActivity implements Toolbar.OnMenuItemClickListener { + public static final String DEBUG_TAG = "SingleSignOnActivity"; - public static final String SHIBBOLETH_SERVER_URL = "shibboleth server url"; - public static final String SHIBBOLETH_HTTPS_PREFIX = "https://"; + public static final String SINGLE_SIGN_ON_SERVER_URL = "single sign on server url"; + public static final String SINGLE_SIGN_ON_HTTPS_PREFIX = "https://"; private Button mNextBtn; private EditText mServerUrlEt; - private static final int SHIBBOLETH_AUTH = 1; + private static final int SINGLE_SIGN_ON_AUTH = 1; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(R.layout.shibboleth_welcome_layout); - mNextBtn = (Button) findViewById(R.id.shibboleth_next_btn); - mServerUrlEt = (EditText) findViewById(R.id.shibboleth_server_url_et); + setContentView(R.layout.single_sign_on_welcome_layout); + mNextBtn = (Button) findViewById(R.id.single_sign_on_next_btn); + mServerUrlEt = (EditText) findViewById(R.id.single_sign_on_server_url_et); - mServerUrlEt.setText(SHIBBOLETH_HTTPS_PREFIX); - int prefixLen = SHIBBOLETH_HTTPS_PREFIX.length(); + mServerUrlEt.setText(SINGLE_SIGN_ON_HTTPS_PREFIX); + int prefixLen = SINGLE_SIGN_ON_HTTPS_PREFIX.length(); mServerUrlEt.setSelection(prefixLen, prefixLen); mNextBtn.setOnClickListener(new View.OnClickListener() { @@ -52,7 +52,7 @@ public void onClick(View v) { toolbar.setOnMenuItemClickListener(this); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); - getSupportActionBar().setTitle(R.string.shib_actionbar_title); + getSupportActionBar().setTitle(R.string.shib_login_title); } @Override @@ -76,7 +76,7 @@ private boolean isServerUrlValid(String serverUrl) { return false; } - if (!serverUrl.startsWith(SHIBBOLETH_HTTPS_PREFIX)) { + if (!serverUrl.startsWith(SINGLE_SIGN_ON_HTTPS_PREFIX)) { showShortToast(this, getString(R.string.shib_server_incorrect_prefix)); return false; } @@ -90,10 +90,10 @@ private String getServerUrl() { } private void openAuthorizePage(String serverUrl) { - Intent intent = new Intent(ShibbolethActivity.this, ShibbolethAuthorizeActivity.class); - intent.putExtra(SHIBBOLETH_SERVER_URL, serverUrl); + Intent intent = new Intent(SingleSignOnActivity.this, SingleSignOnAuthorizeActivity.class); + intent.putExtra(SINGLE_SIGN_ON_SERVER_URL, serverUrl); intent.putExtras(getIntent()); - startActivityForResult(intent, SHIBBOLETH_AUTH); + startActivityForResult(intent, SINGLE_SIGN_ON_AUTH); } @Override @@ -101,7 +101,7 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) { Log.d(DEBUG_TAG, "onActivityResult"); // pass auth result back to the SeafileAuthenticatorActivity - if (requestCode == SHIBBOLETH_AUTH) { + if (requestCode == SINGLE_SIGN_ON_AUTH) { setResult(resultCode, data); finish(); } diff --git a/app/src/main/java/com/seafile/seadroid2/account/ui/ShibbolethAuthorizeActivity.java b/app/src/main/java/com/seafile/seadroid2/account/ui/SingleSignOnAuthorizeActivity.java similarity index 93% rename from app/src/main/java/com/seafile/seadroid2/account/ui/ShibbolethAuthorizeActivity.java rename to app/src/main/java/com/seafile/seadroid2/account/ui/SingleSignOnAuthorizeActivity.java index e7ded7ad7..0f2bf1507 100644 --- a/app/src/main/java/com/seafile/seadroid2/account/ui/ShibbolethAuthorizeActivity.java +++ b/app/src/main/java/com/seafile/seadroid2/account/ui/SingleSignOnAuthorizeActivity.java @@ -35,12 +35,12 @@ import java.security.cert.X509Certificate; /** - * Shibboleth Authorize page + * Single sign on Authorize page * use cookie to get authorized data *

*/ -public class ShibbolethAuthorizeActivity extends BaseActivity implements Toolbar.OnMenuItemClickListener { - public static final String DEBUG_TAG = "ShibbolethAuthorizeActivity"; +public class SingleSignOnAuthorizeActivity extends BaseActivity implements Toolbar.OnMenuItemClickListener { + public static final String DEBUG_TAG = "SingleSignOnAuthorizeActivity"; public static final String SEAHUB_SHIB_COOKIE_NAME = "seahub_auth"; private WebView mWebview; @@ -50,9 +50,9 @@ public class ShibbolethAuthorizeActivity extends BaseActivity implements Toolbar @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setContentView(R.layout.shibboleth_authorize_layout); - mWebview = (WebView) findViewById(R.id.shibboleth_authorize_wv); - mloadingAnimation = (LinearLayout) findViewById(R.id.shibboleth_loading_ll); + setContentView(R.layout.single_sign_on_authorize_layout); + mWebview = (WebView) findViewById(R.id.single_sign_on_authorize_wv); + mloadingAnimation = (LinearLayout) findViewById(R.id.single_sign_on_loading_ll); mWebview.getSettings().setLoadsImagesAutomatically(true); mWebview.getSettings().setJavaScriptEnabled(true); @@ -65,9 +65,9 @@ protected void onCreate(Bundle savedInstanceState) { setSupportActionBar(toolbar); toolbar.setOnMenuItemClickListener(this); getSupportActionBar().setDisplayHomeAsUpEnabled(true); - getSupportActionBar().setTitle(R.string.shib_actionbar_title); + getSupportActionBar().setTitle(R.string.shib_login_title); - String url = getIntent().getStringExtra(ShibbolethActivity.SHIBBOLETH_SERVER_URL); + String url = getIntent().getStringExtra(SingleSignOnActivity.SINGLE_SIGN_ON_SERVER_URL); CookieManager.getInstance().removeAllCookie(); openAuthorizePage(url); } @@ -164,7 +164,7 @@ class CustomWebviewClient extends WebViewClient { @Override public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { // Display error messages - showShortToast(ShibbolethAuthorizeActivity.this, + showShortToast(SingleSignOnAuthorizeActivity.this, String.format((R.string.shib_load_page_error) + description)); showPageLoading(false); @@ -239,7 +239,7 @@ private void returnAccount(Account account) { retData.putExtra(SeafileAuthenticatorActivity.ARG_SHIB, account.isShib()); retData.putExtra(SeafileAuthenticatorActivity.ARG_SERVER_URI, account.getServer()); - // pass auth result back to the ShibbolethActivity + // pass auth result back to the SingleSignOnActivity setResult(RESULT_OK, retData); finish(); } diff --git a/app/src/main/res/layout/shibboleth_welcome_layout.xml b/app/src/main/res/layout/shibboleth_welcome_layout.xml deleted file mode 100644 index 7cb704ce0..000000000 --- a/app/src/main/res/layout/shibboleth_welcome_layout.xml +++ /dev/null @@ -1,56 +0,0 @@ - - - - - - - - - - -