aTrust集成新增AD域认证

master
wenfei 3 months ago
parent 3d009ef50d
commit daae2f4344

@ -504,6 +504,7 @@ public class Contans {
public final static String WIFI_4G = "wifi4g";
public final static String NETWORK_CHECK_TYPE = "NETWORK_CHECK_TYPE";
public final static String VPN_LOGIN_TYPE = "VPN_LOGIN_TYPE";

@ -15,10 +15,16 @@ import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import com.rehome.pdf.utils.SPUtils;
import com.rehome.zhdcoa.Contans;
import com.rehome.zhdcoa.R;
import com.rehome.zhdcoa.base.BaseActivity;
import com.sangfor.sdk.SFUemSDK;
@ -64,6 +70,10 @@ public class VpnAuthActivity extends BaseActivity implements SFAuthResultListene
private ProgressDialog mProgressDialog = null; // 进度条对话框
private RadioGroup rg;
private RadioButton rb1;
private RadioButton rb2;
// @Override
// public int getContentViewID() {
@ -115,10 +125,36 @@ public class VpnAuthActivity extends BaseActivity implements SFAuthResultListene
mServerAddressEditText = findViewById(R.id.vpn_addr_editView);
mUserNameEditView = findViewById(R.id.svpn_username_editView);
mUserPasswordEditView = findViewById(R.id.svpn_userPassword_editView);
rg = findViewById(R.id.rg);
rb1 = findViewById(R.id.rb1);
rb2 = findViewById(R.id.rb2);
//登录按钮
mLoginButton = findViewById(R.id.svpn_login_button);
mLoginButton.setOnClickListener(this);
String vpnLoginType = (String) SPUtils.get(this, Contans.VPN_LOGIN_TYPE, "");
if (TextUtils.isEmpty(vpnLoginType)) {
rb1.setChecked(true);
rb2.setChecked(false);
}else{
if("内部员工登录".equals(vpnLoginType)){
rb1.setChecked(true);
rb2.setChecked(false);
}
if("外部人员认证".equals(vpnLoginType)){
rb1.setChecked(false);
rb2.setChecked(true);
}
}
rg.setOnCheckedChangeListener((group, checkedId) -> {
if(checkedId==R.id.rb1){
SPUtils.put(context,Contans.VPN_LOGIN_TYPE,"内部员工登录");
}
if(checkedId==R.id.rb2){
SPUtils.put(context,Contans.VPN_LOGIN_TYPE,"外部人员认证");
}
});
initToolbar("aTrust 登录", "", new View.OnClickListener() {
@Override
public void onClick(View v) {
@ -188,23 +224,9 @@ public class VpnAuthActivity extends BaseActivity implements SFAuthResultListene
mServerAddress = mServerAddressEditText.getText().toString();
mUserName = mUserNameEditView.getText().toString();
mUserPassword = mUserPasswordEditView.getText().toString();
//开始主认证
startPrimaryAuth();
}
// switch (v.getId()) {
// case R.id.svpn_login_button: {
// mServerAddress = mServerAddressEditText.getText().toString();
// mUserName = mUserNameEditView.getText().toString();
// mUserPassword = mUserPasswordEditView.getText().toString();
//
// //开始主认证
// startPrimaryAuth();
// break;
// }
// default:
// break;
// }
}
//开始用户名密码认证
@ -230,7 +252,15 @@ public class VpnAuthActivity extends BaseActivity implements SFAuthResultListene
/**
* onAuthSuccess,onAuthFailed,onAuthProgress
*/
SFUemSDK.getInstance().startPasswordAuth(mServerAddress, mUserName, mUserPassword);
if(rb1.isChecked()){
String adUsername = mUserName+"@ad57795";
//showLog("------adUsername-------");
//showLog(adUsername);
SFUemSDK.getInstance().startPasswordAuth(mServerAddress, adUsername, mUserPassword);
}
if(rb2.isChecked()){
SFUemSDK.getInstance().startPasswordAuth(mServerAddress, mUserName, mUserPassword);
}
}
/**

@ -76,12 +76,52 @@
<include layout="@layout/auth_layout" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_rg"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/svpn_auth_layout"
android:layout_marginLeft="30dp"
android:layout_marginTop="30dp"
android:layout_marginRight="30dp"
android:orientation="vertical">
<RadioGroup
android:id="@id/rg"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_gravity="center"
android:gravity="center"
android:orientation="horizontal">
<RadioButton
android:id="@+id/rb1"
style="@style/Widget.AppCompat.CompoundButton.RadioButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:textSize="16sp"
android:checked="true"
android:text="内部员工登录" />
<RadioButton
android:id="@+id/rb2"
style="@style/Widget.AppCompat.CompoundButton.RadioButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:textSize="16sp"
android:text="外部人员认证" />
</RadioGroup>
</LinearLayout>
<Button
android:id="@+id/svpn_login_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/svpn_auth_layout"
android:layout_below="@id/ll_rg"
android:layout_marginLeft="30dp"
android:layout_marginTop="20dp"
android:layout_marginRight="30dp"

@ -76,7 +76,7 @@
<string name="info">提示</string>
<string name="update_app_ok">确认</string>
<string name="ok">确定</string>
<string name="str_tab_password">账号登录</string>
<string name="str_tab_password">aTrust账号登录</string>
<string name="str_vpn_logout">注销vpn登录成功</string>
<string name="file_test">文件测试</string>
<string name="start_tunnel">启动隧道</string>

Loading…
Cancel
Save