Index: ssts-web/src/main/java/com/forgon/disinfectsystem/security/userdetails/DaoUserDetailSSTSImpl.java =================================================================== diff -u -r20233 -r20267 --- ssts-web/src/main/java/com/forgon/disinfectsystem/security/userdetails/DaoUserDetailSSTSImpl.java (.../DaoUserDetailSSTSImpl.java) (revision 20233) +++ ssts-web/src/main/java/com/forgon/disinfectsystem/security/userdetails/DaoUserDetailSSTSImpl.java (.../DaoUserDetailSSTSImpl.java) (revision 20267) @@ -12,7 +12,6 @@ import org.apache.commons.lang.StringUtils; import org.apache.log4j.Logger; -import org.apache.struts2.ServletActionContext; import org.springframework.security.authentication.DisabledException; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.authority.SimpleGrantedAuthority; @@ -42,7 +41,6 @@ import com.forgon.security.service.UserManager; import com.forgon.security.tools.Util; import com.forgon.security.userdetails.UserContainsSessionUser; -import com.forgon.tools.StrutsParamUtils; import com.forgon.tools.crypto.coder.CoderEncryption; import com.forgon.tools.string.StringTools; import com.forgon.tools.util.ForgonStringUtils; @@ -151,18 +149,25 @@ } String password = currentLoginedUser.getPasswd(); - if(ssoAuthenticationService != null){ + //如果有配置sso单点登录的bean且所登录的帐号不为条码时,通过统一身份认证的方式认证 + if(ssoAuthenticationService != null && !CssdUtils.usernameIsBarcode(username)){ boolean succ = false; String message = "帐号" + username + "单点登录认证失败"; try { + //仅适合于获取登录页面提交的密码、pda与测试用例的登录提交的是无法通过request获取到的密码 password = request.getParameter("j_password"); - succ = ssoAuthenticationService.authentication(username, password, null); - byte[] bytes = password.getBytes(Charset.forName("UTF-8")); - try { - byte[] md5Bytes = CoderEncryption.encryptMD5(bytes); - password = ForgonStringUtils.encodeHexStr(md5Bytes, true); - } catch (Exception e) { - throw new RuntimeException("计算材料MD5出错!" + e.getMessage()); + if(StringUtils.isNotBlank(password)){ + succ = ssoAuthenticationService.authentication(username, password, null); + byte[] bytes = password.getBytes(Charset.forName("UTF-8")); + try { + byte[] md5Bytes = CoderEncryption.encryptMD5(bytes); + password = ForgonStringUtils.encodeHexStr(md5Bytes, true); + } catch (Exception e) { + throw new RuntimeException("计算材料MD5出错!" + e.getMessage()); + } + }else{ + succ = true; + password = currentLoginedUser.getPasswd(); } } catch (RuntimeException e) { e.printStackTrace();