|
24 | 24 | */ |
25 | 25 |
|
26 | 26 | use Drupal\apigee_edge\OauthTokenFileStorage; |
| 27 | +use Drupal\apigee_edge\Plugin\EdgeKeyTypeInterface; |
27 | 28 | use Drupal\Core\Installer\InstallerKernel; |
28 | 29 | use Drupal\Core\Url; |
29 | 30 | use Drupal\user\RoleInterface; |
@@ -68,17 +69,36 @@ function apigee_edge_requirements($phase) { |
68 | 69 | 'severity' => REQUIREMENT_WARNING, |
69 | 70 | ]; |
70 | 71 | } |
71 | | - // Warning message in status report if insecure Configuration Key provider is being used. |
| 72 | + |
72 | 73 | $auth_config = \Drupal::config('apigee_edge.auth'); |
73 | | - if ($key = $auth_config->get('active_key')) { |
74 | | - $key_repository = \Drupal::service('key.repository')->getKey($key); |
75 | | - if ($key_repository && $key_repository->getKeyProvider()->getPluginId() === "config") { |
| 74 | + if ($key_id = $auth_config->get('active_key')) { |
| 75 | + |
| 76 | + // Warning message if insecure Configuration Key provider is being used. |
| 77 | + $key = \Drupal::service('key.repository')->getKey($key_id); |
| 78 | + if ($key && $key->getKeyProvider()->getPluginId() === "config") { |
76 | 79 | $requirements['apigee_edge_insecure_config_key_provider'] = [ |
77 | 80 | 'title' => t('Apigee Edge'), |
78 | 81 | 'description' => t('Edge connection settings are stored in Drupal’s configuration system, which is not designed to store sensitive information. When installing Kickstart for uses other than local development, we highly recommend changing the Apigee Edge connection key provider to a more secure storage location. <a href="https://www.drupal.org/docs/8/modules/apigee-developer-portal-kickstart/apigee-kickstart-faqs#s-during-installation-a-warning-is-displayed-that-the-apigee-edge-connection-key-provider-is-not-considered-secure-what-should-i-do" target="_blank">Learn more.</a>'), |
79 | 82 | 'severity' => REQUIREMENT_WARNING, |
80 | 83 | ]; |
81 | 84 | } |
| 85 | + |
| 86 | + // Warning message in status report if using basic auth. |
| 87 | + try { |
| 88 | + if ($key && $key->getKeyType() instanceof EdgeKeyTypeInterface && |
| 89 | + $key->getKeyType()->getAuthenticationType($key) === EdgeKeyTypeInterface::EDGE_AUTH_TYPE_BASIC) { |
| 90 | + $requirements['apigee_edge_http_basic_auth'] = [ |
| 91 | + 'title' => t('Apigee Edge'), |
| 92 | + 'description' => t('Apigee Edge HTTP basic authentication will be deprecated. Please choose another authentication method. Visit the <a href=":url">Apigee Edge general settings</a> page to get more information.', [ |
| 93 | + ':url' => Url::fromRoute('apigee_edge.settings', ['destination' => 'admin/reports/status'])->toString(), |
| 94 | + ]), |
| 95 | + 'severity' => REQUIREMENT_WARNING, |
| 96 | + ]; |
| 97 | + } |
| 98 | + } |
| 99 | + catch (Exception $e) { |
| 100 | + // Do nothing. |
| 101 | + } |
82 | 102 | } |
83 | 103 | } |
84 | 104 |
|
|
0 commit comments