实现流程:同步域账户用户名至项目数据库-》若是IE浏览器则通过ActiveXObject获取PC用户名-》根据用户名查询数据库-》存在则自动登陆
步骤1:通过定时任务同步AD域账户用户名,代码如下
package com.honsto.edusys.job;
import java.util.Date;
import java.util.Hashtable;
import javax.naming.AuthenticationException;
import javax.naming.Context;
import javax.naming.NamingEnumeration;
import javax.naming.directory.Attribute;
import javax.naming.directory.Attributes;
import javax.naming.directory.DirContext;
import javax.naming.directory.InitialDirContext;
import javax.naming.directory.SearchControls;
import javax.naming.directory.SearchResult;
import org.apache.log4j.Logger;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.scheduling.quartz.QuartzJobBean;
import com.honsto.core.common.base.ApplicationContextBeanUtil;
import com.honsto.edusys.domain.Member;
import com.honsto.edusys.service.MemberService;
/**
* 获取新增AD域教师用户保存至数据库
*
* @author liming
*
*/
public class AddTeacherJob extends QuartzJobBean {
private final Logger log = Logger.getLogger(this.getClass());
@Override
protected void executeInternal(JobExecutionContext arg0)
throws JobExecutionException {
String jobTitle = this.getClass().getSimpleName();
log.info(jobTitle + " start");
ApplicationContextBeanUtil adb=new ApplicationContextBeanUtil();
try {
Date now = new Date();
long start = now.getTime();
int generalNum = 0;
MemberServi