Pre Merge pull request !25 from 大头虾/wvp-28181-2.0

This commit is contained in:
大头虾 2023-07-04 03:10:36 +00:00 committed by Gitee
commit 7bba8dafc5
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -10,6 +10,7 @@ import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
import com.genersoft.iot.vmp.utils.GitUtil; import com.genersoft.iot.vmp.utils.GitUtil;
import gov.nist.javax.sip.message.MessageFactoryImpl; import gov.nist.javax.sip.message.MessageFactoryImpl;
import gov.nist.javax.sip.message.SIPRequest; import gov.nist.javax.sip.message.SIPRequest;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.DigestUtils; import org.springframework.util.DigestUtils;
@ -36,7 +37,7 @@ public class SIPRequestHeaderPlarformProvider {
@Autowired @Autowired
private SipConfig sipConfig; private SipConfig sipConfig;
@Autowired @Autowired
private SipLayer sipLayer; private SipLayer sipLayer;
@ -96,8 +97,7 @@ public class SIPRequestHeaderPlarformProvider {
if (www == null) { if (www == null) {
AuthorizationHeader authorizationHeader = SipFactory.getInstance().createHeaderFactory().createAuthorizationHeader("Digest"); AuthorizationHeader authorizationHeader = SipFactory.getInstance().createHeaderFactory().createAuthorizationHeader("Digest");
String username = parentPlatform.getUsername(); String username = parentPlatform.getUsername();
if ( username == null || username == "" ) if (ObjectUtils.isEmpty(username)){
{
authorizationHeader.setUsername(parentPlatform.getDeviceGBId()); authorizationHeader.setUsername(parentPlatform.getDeviceGBId());
} else { } else {
authorizationHeader.setUsername(username); authorizationHeader.setUsername(username);
@ -148,7 +148,12 @@ public class SIPRequestHeaderPlarformProvider {
String RESPONSE = DigestUtils.md5DigestAsHex(reStr.toString().getBytes()); String RESPONSE = DigestUtils.md5DigestAsHex(reStr.toString().getBytes());
AuthorizationHeader authorizationHeader = SipFactory.getInstance().createHeaderFactory().createAuthorizationHeader(scheme); AuthorizationHeader authorizationHeader = SipFactory.getInstance().createHeaderFactory().createAuthorizationHeader(scheme);
authorizationHeader.setUsername(parentPlatform.getDeviceGBId()); String username = parentPlatform.getUsername();
if (ObjectUtils.isEmpty(username)){
authorizationHeader.setUsername(parentPlatform.getDeviceGBId());
} else {
authorizationHeader.setUsername(username);
}
authorizationHeader.setRealm(realm); authorizationHeader.setRealm(realm);
authorizationHeader.setNonce(nonce); authorizationHeader.setNonce(nonce);
authorizationHeader.setURI(requestURI); authorizationHeader.setURI(requestURI);