非常感謝。我對Android/Java開發非常陌生,我試圖用MicroStrategy Mobile for Android SDK來解決這個問題。我們需要移動應用在打開時進入外部登錄網站,而不是顯示默認登錄屏幕或直接登錄到MicroStrategy演示服務器(默認配置)。不幸的是,MicroStrategy沒有提供足夠的Android SDK文檔,並且我已經多次請求文檔而沒有成功。 我找到了處理登錄的Activity類,並且擴展了這個類,並且打算瀏覽到URL。由於我在Java和Android開發方面的限制,這可能(很可能)是錯誤的。我們的自定義身份驗證流程由Tomcat中的外部Java Web應用程序處理,該應用程序捕獲令牌和簽名,驗證簽名,解析令牌上的數據並調用創建用戶的不同任務,分配組,隨機字母數字密碼並打開會話用戶在飛行中。所以主要是,我們去外部網站,並通過鏈接在那裏我們做了一個帖子到Web應用程序的令牌和登錄base64。該功能已適用於Web訪問和移動訪問。適用於Android的MicroStrategy Mobile使用外部登錄頁面進行自定義
LoginActivity.class
//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//
package com.microstrategy.android.ui.activity;
import android.app.Fragment;
import android.app.ProgressDialog;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.Toast;
import com.microstrategy.android.MstrApplication;
import com.microstrategy.android.infrastructure.MobileLoginManager;
import com.microstrategy.android.infrastructure.SessionManager;
import com.microstrategy.android.infrastructure.SessionManager.GetSessionInfoCallback;
import com.microstrategy.android.model.config.MobileConfig;
import com.microstrategy.android.model.config.MobileProjectSettings;
import com.microstrategy.android.model.config.MobileServerSettings;
import com.microstrategy.android.network.CredentialsHelper;
import com.microstrategy.android.ui.Utils;
import com.microstrategy.android.ui.activity.MSTRNonStartupBaseActivity;
import com.microstrategy.android.ui.fragment.MobileLoginFragment;
import com.microstrategy.android.ui.view.ProgressWheel;
import com.microstrategy.android.utils.MSTRFeature;
import com.microstrategy.android.websdk.R.id;
import com.microstrategy.android.websdk.R.layout;
import com.microstrategy.android.websdk.R.string;
import java.util.HashMap;
import java.util.Map;
public class LoginActivity extends MSTRNonStartupBaseActivity {
private static final String LOG_TAG = "LoginActivity";
public static final String KEY_SERVER_INDEX = "com.microstrategy.android.webapp.serverIndex";
public static final String KEY_PROJECT_INDEX = "com.microstrategy.android.webapp.projectIndex";
public LoginActivity() {
}
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.setContentView(layout.login_view);
if(Utils.hasKitKat()) {
this.getWindow().addFlags(67108864);
} else {
this.getWindow().addFlags(1024);
}
if(!MstrApplication.getInstance().isTablet()) {
this.setRequestedOrientation(1);
}
if(savedInstanceState == null) {
final int serverIndex = this.getIntent().getExtras().getInt("com.microstrategy.android.webapp.serverIndex");
final int projectIndex = this.getIntent().getExtras().getInt("com.microstrategy.android.webapp.projectIndex");
MobileProjectSettings projectSettings = this.getMobileConfig().getProject(serverIndex, projectIndex);
if(projectSettings == null) {
this.finish();
return;
}
int credentialStatus = CredentialsHelper.checkProjectAndParentServerValidity(projectSettings);
MobileLoginManager manager = MobileLoginManager.sharedLoginManager();
MobileLoginFragment fragment = null;
if(CredentialsHelper.isOnlyProjectChangePasswordError(credentialStatus)) {
fragment = manager.newLoginFragment(1, new HashMap() {
{
this.put("com.microstrategy.android.webapp.serverIndex", Integer.valueOf(serverIndex));
this.put("com.microstrategy.android.webapp.projectIndex", Integer.valueOf(projectIndex));
}
});
} else if(projectSettings.getCredentials().getAuthMode() == 5) {
if(!MstrApplication.getInstance().getSecurityHandler().isFeatureAvailable(MSTRFeature.UsherAuthentication)) {
Toast.makeText(this, string.FEATURE_NOT_AVAILABLE_MSG, 0).show();
this.finish();
}
fragment = manager.newLoginFragment(2, new HashMap() {
{
this.put("com.microstrategy.android.webapp.serverIndex", Integer.valueOf(serverIndex));
this.put("com.microstrategy.android.webapp.projectIndex", Integer.valueOf(projectIndex));
}
});
} else {
if(!CredentialsHelper.isAuthenticationError(credentialStatus)) {
this.finish();
return;
}
fragment = manager.newLoginFragment(0, new HashMap() {
{
this.put("com.microstrategy.android.webapp.serverIndex", Integer.valueOf(serverIndex));
this.put("com.microstrategy.android.webapp.projectIndex", Integer.valueOf(projectIndex));
}
});
}
this.showFragment(fragment);
}
}
protected void onDestroy() {
if(this.isFinishing()) {
MobileLoginManager.sharedLoginManager().dismissCurrentDisplayingMobileLoginPromptView();
}
super.onDestroy();
}
public MobileConfig getMobileConfig() {
return MstrApplication.getInstance().getConfigObject();
}
public void onNeedChangePassword(final int serverIndex, final int projectIndex, String errorMessage) {
this.showFragment(MobileLoginManager.sharedLoginManager().newLoginFragment(1, new HashMap() {
{
this.put("com.microstrategy.android.webapp.serverIndex", Integer.valueOf(serverIndex));
this.put("com.microstrategy.android.webapp.projectIndex", Integer.valueOf(projectIndex));
}
}));
}
private void showFragment(Fragment fragment) {
Log.i("Authentication", "showFragment");
this.getFragmentManager().beginTransaction().replace(id.login_fragment, fragment).commit();
}
public void dismissFragment(boolean validated) {
Log.i("Authentication", "dismissFragment");
MobileLoginManager manager = MobileLoginManager.sharedLoginManager();
manager.setMobileLoginPromptStatus(validated?1:2);
this.finish();
}
public void showProgressBar() {
Log.i("Authentication", "showProgressBar");
RelativeLayout disableViewContainer = (RelativeLayout)this.findViewById(id.disable_view);
if(disableViewContainer.getVisibility() != 0) {
disableViewContainer.setVisibility(0);
}
disableViewContainer.bringToFront();
View overlayProgressbar = disableViewContainer.findViewById(id.overlay_circular_progressbar);
if(overlayProgressbar == null) {
disableViewContainer.removeAllViews();
overlayProgressbar = this.getLayoutInflater().inflate(layout.overlay_circular_progressbar, disableViewContainer, false);
disableViewContainer.setGravity(17);
disableViewContainer.addView(overlayProgressbar);
}
View progressBar = overlayProgressbar.findViewById(id.progressbar_in_overlay);
((ProgressWheel)progressBar).spin();
}
public void dismissProgressBar() {
Log.i("Authentication", "dismissProgressBar");
this.runOnUiThread(new Runnable() {
public void run() {
RelativeLayout disableViewContainer = (RelativeLayout)LoginActivity.this.findViewById(id.disable_view);
View overlayProgressbar = disableViewContainer.findViewById(id.overlay_circular_progressbar);
if(overlayProgressbar != null) {
View progressBar = overlayProgressbar.findViewById(id.progressbar_in_overlay);
((ProgressWheel)progressBar).stopSpinning();
}
if(disableViewContainer.getVisibility() == 0) {
disableViewContainer.setVisibility(8);
}
}
});
}
public boolean isProgressBarSpinning() {
RelativeLayout disableViewContainer = (RelativeLayout)this.findViewById(id.disable_view);
if(disableViewContainer == null) {
return false;
} else {
View overlayProgressbar = disableViewContainer.findViewById(id.overlay_circular_progressbar);
if(overlayProgressbar == null) {
return false;
} else {
View progressBar = overlayProgressbar.findViewById(id.progressbar_in_overlay);
return progressBar != null && ((ProgressWheel)progressBar).isSpinning();
}
}
}
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
if(intent != null) {
Uri uri = intent.getData();
if(uri != null && uri.getScheme().equals(this.getString(string.usher_scheme))) {
int serverIndex = this.getIntent().getExtras().getInt("com.microstrategy.android.webapp.serverIndex");
int projectIndex = this.getIntent().getExtras().getInt("com.microstrategy.android.webapp.projectIndex");
MobileServerSettings mobileServerSettings = this.getMobileConfig().getMobileServer(serverIndex);
MobileProjectSettings projectSettings = mobileServerSettings.getProject(projectIndex);
final ProgressDialog dialog = new ProgressDialog(this);
dialog.setTitle(this.getString(string.LOGIN));
dialog.setMessage(this.getString(string.WAIT));
dialog.setIndeterminate(true);
dialog.show();
SessionManager.getInstance().validate(projectSettings, false, new GetSessionInfoCallback() {
public void returnResponse(Map sessionStateInfo) {
if(sessionStateInfo != null && sessionStateInfo.containsKey("sessionState")) {
MobileLoginManager manager = MobileLoginManager.sharedLoginManager();
if(manager.getMobileLoginPromptStatus() == 0) {
manager.setMobileLoginPromptStatus(1);
}
}
LoginActivity.this.runOnUiThread(new Runnable() {
public void run() {
dialog.hide();
}
});
LoginActivity.this.finish();
}
});
}
}
}
protected boolean shouldShowOfflineIndicator() {
return false;
}
}
CustomLoginActivity.class
package com.microstrategy.android.custom.afip;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import com.google.android.gms.appindexing.Action;
import com.google.android.gms.appindexing.AppIndex;
import com.google.android.gms.appindexing.Thing;
import com.google.android.gms.common.api.GoogleApiClient;
import com.microstrategy.android.ui.activity.LoginActivity;
/**
* Created by Max on 12/23/2016.
*/
public class CustomLoginActivity extends com.microstrategy.android.ui.activity.LoginActivity {
/**
* ATTENTION: This was auto-generated to implement the App Indexing API.
* See https://g.co/AppIndexing/AndroidStudio for more information.
*/
private GoogleApiClient client;
public CustomLoginActivity(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://authinthomo.afip.gob.ar"));
startActivity(intent);
}
}
AndroidManifest.xml中
</intent-filter>
</activity>
<activity android:configChanges="orientation|keyboardHidden|screenSize" android:launchMode="singleTask" android:name="com.microstrategy.android.custom.afip.CustomLoginActivity" android:theme="@style/LoginActivityTheme" android:windowSoftInputMode="adjustPan">
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="https" android:host="authinthomo.afip.gob.ar"/>
</intent-filter>
</activity>
我在正確的軌道上?當我安裝apk時,它只是登錄到演示服務器,默認情況下是在應用程序上配置的。我正在使用Android版MicroStrategy SDK 10.6(最新版)& Android Studio。任何意見或幫助,不勝感激。
由於提前, 親切的問候, 最大
我想MicroStrategy的得到了支持?這很不清楚你要求什麼。 – slanecek
我有一個案件被打開,但仍然沒有答案。還有一個關於MicroStrategy論壇的問題,目前還沒有答案。我想在這裏嘗試一下,因爲有很多人有很多知識。 –