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 gov.nist.javax.sip.message.MessageFactoryImpl;
import gov.nist.javax.sip.message.SIPRequest;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.DigestUtils;
@ -96,8 +97,7 @@ public class SIPRequestHeaderPlarformProvider {
if (www == null) {
AuthorizationHeader authorizationHeader = SipFactory.getInstance().createHeaderFactory().createAuthorizationHeader("Digest");
String username = parentPlatform.getUsername();
if ( username == null || username == "" )
{
if (ObjectUtils.isEmpty(username)){
authorizationHeader.setUsername(parentPlatform.getDeviceGBId());
} else {
authorizationHeader.setUsername(username);
@ -148,7 +148,12 @@ public class SIPRequestHeaderPlarformProvider {
String RESPONSE = DigestUtils.md5DigestAsHex(reStr.toString().getBytes());
AuthorizationHeader authorizationHeader = SipFactory.getInstance().createHeaderFactory().createAuthorizationHeader(scheme);
String username = parentPlatform.getUsername();
if (ObjectUtils.isEmpty(username)){
authorizationHeader.setUsername(parentPlatform.getDeviceGBId());
} else {
authorizationHeader.setUsername(username);
}
authorizationHeader.setRealm(realm);
authorizationHeader.setNonce(nonce);
authorizationHeader.setURI(requestURI);