Empty shortVerificationUri not the same with default (null) value

closes #20851
This commit is contained in:
Douglas Palmer 2023-06-23 11:59:47 -07:00 committed by Marek Posolda
parent d0691b0884
commit c75bf31398

View file

@ -170,8 +170,10 @@ public class DeviceEndpoint extends AuthorizationEndpointBase implements RealmRe
singleUseStore.put(userCode.serializeKey(), lifespanSeconds, userCode.serializeValue());
try {
String deviceUrl = realm.getAttribute(SHORT_VERIFICATION_URI) != null ? realm.getAttribute(SHORT_VERIFICATION_URI) : DeviceGrantType.oauth2DeviceVerificationUrl(session.getContext().getUri()).build(realm.getName())
.toString();
String deviceUrl = realm.getAttribute(SHORT_VERIFICATION_URI);
if (deviceUrl == null || deviceUrl.isEmpty()) {
deviceUrl = DeviceGrantType.oauth2DeviceVerificationUrl(session.getContext().getUri()).build(realm.getName()).toString();
}
OAuth2DeviceAuthorizationResponse response = new OAuth2DeviceAuthorizationResponse();
response.setDeviceCode(deviceCode.getDeviceCode());