Source:
private DeviceAuthzResponse _exec() { try { clientRequest.setHttpMethod(getHttpMethod()); clientRequest.header("Content-Type", request.getContentType()); if (request.getAuthenticationMethod() == AuthenticationMethod.CLIENT_SECRET_BASIC && request.hasCredentials()) { clientRequest.header("Authorization", "Basic " + request.getEncodedCredentials()); } final String scopesAsString = Util.listAsString(getRequest().getScopes()); if (StringUtils.isNotBlank(scopesAsString)) { clientRequest.formParameter(SCOPE, scopesAsString); } if (StringUtils.isNotBlank(getRequest().getClientId())) { clientRequest.formParameter(CLIENT_ID, getRequest().getClientId()); } clientResponse = clientRequest.post(String.class); setResponse(new DeviceAuthzResponse(clientResponse)); String entity = clientResponse.getEntity(String.class); getResponse().setEntity(entity); getResponse().setHeaders(clientResponse.getMetadata()); if (StringUtils.isNotBlank(entity)) { JSONObject jsonObj = new JSONObject(entity); if (jsonObj.has(USER_CODE)) { getResponse().setUserCode(jsonObj.getString(USER_CODE)); } if (jsonObj.has(DEVICE_CODE)) { getResponse().setDeviceCode(jsonObj.getString(DEVICE_CODE)); } if (jsonObj.has(INTERVAL)) { getResponse().setInterval(jsonObj.getInt(INTERVAL)); } if (jsonObj.has(VERIFICATION_URI)) { getResponse().setVerificationUri(jsonObj.getString(VERIFICATION_URI)); } if (jsonObj.has(VERIFICATION_URI_COMPLETE)) { getResponse().setVerificationUriComplete(jsonObj.getString(VERIFICATION_URI_COMPLETE)); } if (jsonObj.has(EXPIRES_IN)) { getResponse().setExpiresIn(jsonObj.getInt(EXPIRES_IN)); } } return getResponse(); } catch (Exception e) { e.printStackTrace(); return null; } }

Target:
private DeviceAuthzResponse _exec() { try { clientRequest.setHttpMethod(getHttpMethod()); clientRequest.header("Content-Type", request.getContentType()); new ClientAuthnEnabler(clientRequest).exec(getRequest()); final String scopesAsString = Util.listAsString(getRequest().getScopes()); if (StringUtils.isNotBlank(scopesAsString)) { clientRequest.formParameter(SCOPE, scopesAsString); } if (StringUtils.isNotBlank(getRequest().getClientId())) { clientRequest.formParameter(CLIENT_ID, getRequest().getClientId()); } clientResponse = clientRequest.post(String.class); setResponse(new DeviceAuthzResponse(clientResponse)); String entity = clientResponse.getEntity(String.class); getResponse().setEntity(entity); getResponse().setHeaders(clientResponse.getMetadata()); if (StringUtils.isNotBlank(entity)) { JSONObject jsonObj = new JSONObject(entity); if (jsonObj.has(USER_CODE)) { getResponse().setUserCode(jsonObj.getString(USER_CODE)); } if (jsonObj.has(DEVICE_CODE)) { getResponse().setDeviceCode(jsonObj.getString(DEVICE_CODE)); } if (jsonObj.has(INTERVAL)) { getResponse().setInterval(jsonObj.getInt(INTERVAL)); } if (jsonObj.has(VERIFICATION_URI)) { getResponse().setVerificationUri(jsonObj.getString(VERIFICATION_URI)); } if (jsonObj.has(VERIFICATION_URI_COMPLETE)) { getResponse().setVerificationUriComplete(jsonObj.getString(VERIFICATION_URI_COMPLETE)); } if (jsonObj.has(EXPIRES_IN)) { getResponse().setExpiresIn(jsonObj.getInt(EXPIRES_IN)); } } return getResponse(); } catch (Exception e) { LOG.error(e.getMessage(), e); return null; } finally { closeConnection(); } }