|
@@ -242,10 +242,9 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
|
|
/// Identifier of operation in progress which result shouldn't be lost
|
|
/// Identifier of operation in progress which result shouldn't be lost
|
|
private long mWaitingForOpId = Long.MAX_VALUE;
|
|
private long mWaitingForOpId = Long.MAX_VALUE;
|
|
|
|
|
|
- private final String BASIC_TOKEN_TYPE = AccountTypeUtils.getAuthTokenTypePass(MainApp.getAccountType(this));
|
|
|
|
- private final String OAUTH_TOKEN_TYPE = AccountTypeUtils.getAuthTokenTypeAccessToken(MainApp.getAccountType(this));
|
|
|
|
- private final String SAML_TOKEN_TYPE = AccountTypeUtils.getAuthTokenTypeSamlSessionCookie(
|
|
|
|
- MainApp.getAccountType(this));
|
|
|
|
|
|
+ private String basicTokenType;
|
|
|
|
+ private String oauthTokenType;
|
|
|
|
+ private String samlTokenType;
|
|
|
|
|
|
private boolean webViewLoginMethod;
|
|
private boolean webViewLoginMethod;
|
|
private String webViewUser;
|
|
private String webViewUser;
|
|
@@ -264,6 +263,10 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
|
|
//Log_OC.e(TAG, "onCreate init");
|
|
//Log_OC.e(TAG, "onCreate init");
|
|
super.onCreate(savedInstanceState);
|
|
super.onCreate(savedInstanceState);
|
|
|
|
|
|
|
|
+ basicTokenType = AccountTypeUtils.getAuthTokenTypePass(MainApp.getAccountType(this));
|
|
|
|
+ oauthTokenType = AccountTypeUtils.getAuthTokenTypeAccessToken(MainApp.getAccountType(this));
|
|
|
|
+ samlTokenType = AccountTypeUtils.getAuthTokenTypeSamlSessionCookie(MainApp.getAccountType(this));
|
|
|
|
+
|
|
// delete cookies for webView
|
|
// delete cookies for webView
|
|
deleteCookies();
|
|
deleteCookies();
|
|
|
|
|
|
@@ -561,11 +564,11 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
|
|
|
|
|
|
private String chooseAuthTokenType(boolean oauth, boolean saml) {
|
|
private String chooseAuthTokenType(boolean oauth, boolean saml) {
|
|
if (saml) {
|
|
if (saml) {
|
|
- return SAML_TOKEN_TYPE;
|
|
|
|
|
|
+ return samlTokenType;
|
|
} else if (oauth) {
|
|
} else if (oauth) {
|
|
- return OAUTH_TOKEN_TYPE;
|
|
|
|
|
|
+ return oauthTokenType;
|
|
} else {
|
|
} else {
|
|
- return BASIC_TOKEN_TYPE;
|
|
|
|
|
|
+ return basicTokenType;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -911,10 +914,10 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
|
|
String password = savedInstanceState.getString(KEY_PASSWORD);
|
|
String password = savedInstanceState.getString(KEY_PASSWORD);
|
|
|
|
|
|
OwnCloudCredentials credentials = null;
|
|
OwnCloudCredentials credentials = null;
|
|
- if (BASIC_TOKEN_TYPE.equals(mAuthTokenType)) {
|
|
|
|
|
|
+ if (basicTokenType.equals(mAuthTokenType)) {
|
|
credentials = OwnCloudCredentialsFactory.newBasicCredentials(username, password);
|
|
credentials = OwnCloudCredentialsFactory.newBasicCredentials(username, password);
|
|
|
|
|
|
- } else if (OAUTH_TOKEN_TYPE.equals(mAuthTokenType)) {
|
|
|
|
|
|
+ } else if (oauthTokenType.equals(mAuthTokenType)) {
|
|
credentials = OwnCloudCredentialsFactory.newBearerCredentials(mAuthToken);
|
|
credentials = OwnCloudCredentialsFactory.newBearerCredentials(mAuthToken);
|
|
|
|
|
|
}
|
|
}
|
|
@@ -1475,11 +1478,11 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
|
|
|
|
|
|
|
|
|
|
private boolean authSupported(AuthenticationMethod authMethod) {
|
|
private boolean authSupported(AuthenticationMethod authMethod) {
|
|
- return ((BASIC_TOKEN_TYPE.equals(mAuthTokenType) &&
|
|
|
|
|
|
+ return ((basicTokenType.equals(mAuthTokenType) &&
|
|
AuthenticationMethod.BASIC_HTTP_AUTH.equals(authMethod)) ||
|
|
AuthenticationMethod.BASIC_HTTP_AUTH.equals(authMethod)) ||
|
|
- (OAUTH_TOKEN_TYPE.equals(mAuthTokenType) &&
|
|
|
|
|
|
+ (oauthTokenType.equals(mAuthTokenType) &&
|
|
AuthenticationMethod.BEARER_TOKEN.equals(authMethod)) ||
|
|
AuthenticationMethod.BEARER_TOKEN.equals(authMethod)) ||
|
|
- (SAML_TOKEN_TYPE.equals(mAuthTokenType) &&
|
|
|
|
|
|
+ (samlTokenType.equals(mAuthTokenType) &&
|
|
AuthenticationMethod.SAML_WEB_SSO.equals(authMethod))
|
|
AuthenticationMethod.SAML_WEB_SSO.equals(authMethod))
|
|
);
|
|
);
|
|
}
|
|
}
|
|
@@ -2020,9 +2023,9 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
|
|
public void onCheckClick(View view) {
|
|
public void onCheckClick(View view) {
|
|
CheckBox oAuth2Check = (CheckBox) view;
|
|
CheckBox oAuth2Check = (CheckBox) view;
|
|
if (oAuth2Check.isChecked()) {
|
|
if (oAuth2Check.isChecked()) {
|
|
- mAuthTokenType = OAUTH_TOKEN_TYPE;
|
|
|
|
|
|
+ mAuthTokenType = oauthTokenType;
|
|
} else {
|
|
} else {
|
|
- mAuthTokenType = BASIC_TOKEN_TYPE;
|
|
|
|
|
|
+ mAuthTokenType = basicTokenType;
|
|
}
|
|
}
|
|
updateAuthenticationPreFragmentVisibility();
|
|
updateAuthenticationPreFragmentVisibility();
|
|
}
|
|
}
|