@itwin/core-frontend 5.13.0-dev.15 → 5.13.0-dev.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. package/lib/cjs/IModelApp.d.ts +11 -1
  2. package/lib/cjs/IModelApp.d.ts.map +1 -1
  3. package/lib/cjs/IModelApp.js +14 -1
  4. package/lib/cjs/IModelApp.js.map +1 -1
  5. package/lib/cjs/IModeljs-css.d.ts.map +1 -1
  6. package/lib/cjs/IModeljs-css.js +4 -2
  7. package/lib/cjs/IModeljs-css.js.map +1 -1
  8. package/lib/cjs/RealityDataSource.d.ts.map +1 -1
  9. package/lib/cjs/RealityDataSource.js +7 -4
  10. package/lib/cjs/RealityDataSource.js.map +1 -1
  11. package/lib/cjs/internal/GoogleMapsDecorator.js +1 -1
  12. package/lib/cjs/internal/GoogleMapsDecorator.js.map +1 -1
  13. package/lib/cjs/internal/tile/OrbitGtTileTree.d.ts.map +1 -1
  14. package/lib/cjs/internal/tile/OrbitGtTileTree.js +5 -1
  15. package/lib/cjs/internal/tile/OrbitGtTileTree.js.map +1 -1
  16. package/lib/cjs/internal/tile/RealityModelTileTree.d.ts.map +1 -1
  17. package/lib/cjs/internal/tile/RealityModelTileTree.js +5 -1
  18. package/lib/cjs/internal/tile/RealityModelTileTree.js.map +1 -1
  19. package/lib/cjs/internal/tile/map/ArcGisUtilities.d.ts +3 -0
  20. package/lib/cjs/internal/tile/map/ArcGisUtilities.d.ts.map +1 -1
  21. package/lib/cjs/internal/tile/map/ArcGisUtilities.js +32 -4
  22. package/lib/cjs/internal/tile/map/ArcGisUtilities.js.map +1 -1
  23. package/lib/cjs/internal/tile/map/ImageryProviders/ArcGISImageryProvider.d.ts.map +1 -1
  24. package/lib/cjs/internal/tile/map/ImageryProviders/ArcGISImageryProvider.js +28 -6
  25. package/lib/cjs/internal/tile/map/ImageryProviders/ArcGISImageryProvider.js.map +1 -1
  26. package/lib/cjs/internal/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.d.ts.map +1 -1
  27. package/lib/cjs/internal/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js +7 -3
  28. package/lib/cjs/internal/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js.map +1 -1
  29. package/lib/cjs/internal/tile/map/ImageryProviders/BingImageryProvider.d.ts.map +1 -1
  30. package/lib/cjs/internal/tile/map/ImageryProviders/BingImageryProvider.js +1 -7
  31. package/lib/cjs/internal/tile/map/ImageryProviders/BingImageryProvider.js.map +1 -1
  32. package/lib/cjs/internal/tile/map/ImageryProviders/WmsMapLayerImageryProvider.d.ts.map +1 -1
  33. package/lib/cjs/internal/tile/map/ImageryProviders/WmsMapLayerImageryProvider.js +4 -1
  34. package/lib/cjs/internal/tile/map/ImageryProviders/WmsMapLayerImageryProvider.js.map +1 -1
  35. package/lib/cjs/internal/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.d.ts.map +1 -1
  36. package/lib/cjs/internal/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.js +6 -2
  37. package/lib/cjs/internal/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.js.map +1 -1
  38. package/lib/cjs/internal/tile/map/WmsUtilities.d.ts.map +1 -1
  39. package/lib/cjs/internal/tile/map/WmsUtilities.js +25 -4
  40. package/lib/cjs/internal/tile/map/WmsUtilities.js.map +1 -1
  41. package/lib/cjs/tile/map/MapLayerFormatRegistry.d.ts +74 -0
  42. package/lib/cjs/tile/map/MapLayerFormatRegistry.d.ts.map +1 -1
  43. package/lib/cjs/tile/map/MapLayerFormatRegistry.js +114 -2
  44. package/lib/cjs/tile/map/MapLayerFormatRegistry.js.map +1 -1
  45. package/lib/cjs/tile/map/MapLayerImageryFormats.d.ts.map +1 -1
  46. package/lib/cjs/tile/map/MapLayerImageryFormats.js +16 -0
  47. package/lib/cjs/tile/map/MapLayerImageryFormats.js.map +1 -1
  48. package/lib/cjs/tile/map/MapLayerImageryProvider.d.ts +118 -2
  49. package/lib/cjs/tile/map/MapLayerImageryProvider.d.ts.map +1 -1
  50. package/lib/cjs/tile/map/MapLayerImageryProvider.js +230 -20
  51. package/lib/cjs/tile/map/MapLayerImageryProvider.js.map +1 -1
  52. package/lib/cjs/tile/map/MapLayerSources.d.ts +7 -1
  53. package/lib/cjs/tile/map/MapLayerSources.d.ts.map +1 -1
  54. package/lib/cjs/tile/map/MapLayerSources.js +6 -0
  55. package/lib/cjs/tile/map/MapLayerSources.js.map +1 -1
  56. package/lib/cjs/tile/map/MapLayerTileTreeReference.d.ts.map +1 -1
  57. package/lib/cjs/tile/map/MapLayerTileTreeReference.js +1 -3
  58. package/lib/cjs/tile/map/MapLayerTileTreeReference.js.map +1 -1
  59. package/lib/cjs/tile/map/MapTileTree.d.ts.map +1 -1
  60. package/lib/cjs/tile/map/MapTileTree.js +3 -1
  61. package/lib/cjs/tile/map/MapTileTree.js.map +1 -1
  62. package/lib/esm/IModelApp.d.ts +11 -1
  63. package/lib/esm/IModelApp.d.ts.map +1 -1
  64. package/lib/esm/IModelApp.js +14 -1
  65. package/lib/esm/IModelApp.js.map +1 -1
  66. package/lib/esm/IModeljs-css.d.ts.map +1 -1
  67. package/lib/esm/IModeljs-css.js +4 -2
  68. package/lib/esm/IModeljs-css.js.map +1 -1
  69. package/lib/esm/RealityDataSource.d.ts.map +1 -1
  70. package/lib/esm/RealityDataSource.js +7 -4
  71. package/lib/esm/RealityDataSource.js.map +1 -1
  72. package/lib/esm/internal/GoogleMapsDecorator.js +1 -1
  73. package/lib/esm/internal/GoogleMapsDecorator.js.map +1 -1
  74. package/lib/esm/internal/tile/OrbitGtTileTree.d.ts.map +1 -1
  75. package/lib/esm/internal/tile/OrbitGtTileTree.js +5 -1
  76. package/lib/esm/internal/tile/OrbitGtTileTree.js.map +1 -1
  77. package/lib/esm/internal/tile/RealityModelTileTree.d.ts.map +1 -1
  78. package/lib/esm/internal/tile/RealityModelTileTree.js +5 -1
  79. package/lib/esm/internal/tile/RealityModelTileTree.js.map +1 -1
  80. package/lib/esm/internal/tile/map/ArcGisUtilities.d.ts +3 -0
  81. package/lib/esm/internal/tile/map/ArcGisUtilities.d.ts.map +1 -1
  82. package/lib/esm/internal/tile/map/ArcGisUtilities.js +33 -5
  83. package/lib/esm/internal/tile/map/ArcGisUtilities.js.map +1 -1
  84. package/lib/esm/internal/tile/map/ImageryProviders/ArcGISImageryProvider.d.ts.map +1 -1
  85. package/lib/esm/internal/tile/map/ImageryProviders/ArcGISImageryProvider.js +29 -7
  86. package/lib/esm/internal/tile/map/ImageryProviders/ArcGISImageryProvider.js.map +1 -1
  87. package/lib/esm/internal/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.d.ts.map +1 -1
  88. package/lib/esm/internal/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js +8 -4
  89. package/lib/esm/internal/tile/map/ImageryProviders/ArcGISMapLayerImageryProvider.js.map +1 -1
  90. package/lib/esm/internal/tile/map/ImageryProviders/BingImageryProvider.d.ts.map +1 -1
  91. package/lib/esm/internal/tile/map/ImageryProviders/BingImageryProvider.js +1 -7
  92. package/lib/esm/internal/tile/map/ImageryProviders/BingImageryProvider.js.map +1 -1
  93. package/lib/esm/internal/tile/map/ImageryProviders/WmsMapLayerImageryProvider.d.ts.map +1 -1
  94. package/lib/esm/internal/tile/map/ImageryProviders/WmsMapLayerImageryProvider.js +5 -2
  95. package/lib/esm/internal/tile/map/ImageryProviders/WmsMapLayerImageryProvider.js.map +1 -1
  96. package/lib/esm/internal/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.d.ts.map +1 -1
  97. package/lib/esm/internal/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.js +7 -3
  98. package/lib/esm/internal/tile/map/ImageryProviders/WmtsMapLayerImageryProvider.js.map +1 -1
  99. package/lib/esm/internal/tile/map/WmsUtilities.d.ts.map +1 -1
  100. package/lib/esm/internal/tile/map/WmsUtilities.js +25 -4
  101. package/lib/esm/internal/tile/map/WmsUtilities.js.map +1 -1
  102. package/lib/esm/tile/map/MapLayerFormatRegistry.d.ts +74 -0
  103. package/lib/esm/tile/map/MapLayerFormatRegistry.d.ts.map +1 -1
  104. package/lib/esm/tile/map/MapLayerFormatRegistry.js +113 -2
  105. package/lib/esm/tile/map/MapLayerFormatRegistry.js.map +1 -1
  106. package/lib/esm/tile/map/MapLayerImageryFormats.d.ts.map +1 -1
  107. package/lib/esm/tile/map/MapLayerImageryFormats.js +17 -1
  108. package/lib/esm/tile/map/MapLayerImageryFormats.js.map +1 -1
  109. package/lib/esm/tile/map/MapLayerImageryProvider.d.ts +118 -2
  110. package/lib/esm/tile/map/MapLayerImageryProvider.d.ts.map +1 -1
  111. package/lib/esm/tile/map/MapLayerImageryProvider.js +228 -20
  112. package/lib/esm/tile/map/MapLayerImageryProvider.js.map +1 -1
  113. package/lib/esm/tile/map/MapLayerSources.d.ts +7 -1
  114. package/lib/esm/tile/map/MapLayerSources.d.ts.map +1 -1
  115. package/lib/esm/tile/map/MapLayerSources.js +6 -0
  116. package/lib/esm/tile/map/MapLayerSources.js.map +1 -1
  117. package/lib/esm/tile/map/MapLayerTileTreeReference.d.ts.map +1 -1
  118. package/lib/esm/tile/map/MapLayerTileTreeReference.js +1 -3
  119. package/lib/esm/tile/map/MapLayerTileTreeReference.js.map +1 -1
  120. package/lib/esm/tile/map/MapTileTree.d.ts.map +1 -1
  121. package/lib/esm/tile/map/MapTileTree.js +4 -2
  122. package/lib/esm/tile/map/MapTileTree.js.map +1 -1
  123. package/package.json +20 -20
@@ -7,11 +7,11 @@
7
7
  * @module MapLayers
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.MapLayerFormatRegistry = exports.MapLayerFormat = void 0;
10
+ exports.MapLayerFormatRegistry = exports.MapLayerUntrustedOriginError = exports.MapLayerFormat = void 0;
11
11
  const core_bentley_1 = require("@itwin/core-bentley");
12
12
  const IModelApp_1 = require("../../IModelApp");
13
13
  const internal_1 = require("../internal");
14
- const loggerCategory = "ArcGISFeatureProvider";
14
+ const loggerCategory = "MapLayerFormatRegistry";
15
15
  /**
16
16
  * Class representing a map-layer format.
17
17
  * Each format has it's unique 'formatId' string, used to uniquely identify a format in the [[MapLayerFormatRegistry]].
@@ -61,16 +61,128 @@ class MapLayerFormat {
61
61
  }
62
62
  }
63
63
  exports.MapLayerFormat = MapLayerFormat;
64
+ /** Error thrown when an NTLM or Negotiate http 401 challenge could not be answered because the request
65
+ * URL's origin is not listed in [[MapLayerFormatRegistry.trustedCredentialsOrigins]]
66
+ * (see [[MapLayerFormatRegistry.restrictCredentialsToTrustedOrigins]]).
67
+ * Thrown by the static map-layer utilities (e.g. capabilities / service-metadata fetches) that have no
68
+ * provider instance on which to report the blocked origin; callers convert it to
69
+ * [[MapLayerImageryProviderStatus.UntrustedOrigin]] (provider initialization) or
70
+ * [[MapLayerSourceStatus.UntrustedOrigin]] (source validation).
71
+ * @internal
72
+ */
73
+ class MapLayerUntrustedOriginError extends Error {
74
+ /** The URL of the request whose authentication challenge was left unanswered. */
75
+ url;
76
+ constructor(url) {
77
+ super(`Authentication blocked: origin of '${url}' is not listed in MapLayerFormatRegistry.trustedCredentialsOrigins`);
78
+ this.url = url;
79
+ }
80
+ }
81
+ exports.MapLayerUntrustedOriginError = MapLayerUntrustedOriginError;
64
82
  /**
65
83
  * A registry of MapLayerFormats identified by their unique format IDs. The registry can be accessed via [[IModelApp.mapLayerFormatRegistry]].
66
84
  * @public
67
85
  */
68
86
  class MapLayerFormatRegistry {
69
87
  _configOptions;
88
+ _trustedCredentialsOrigins = [];
89
+ /** Opt-in enforcement of origin restrictions on map-layer credentials.
90
+ * When enabled, map layer providers:
91
+ * - attach the basic-auth credentials stored in the layer settings only to requests targeting the origin
92
+ * of the layer's settings URL or an origin listed in [[trustedCredentialsOrigins]];
93
+ * - retry a request with browser credentials included (i.e. SSO / Windows Authentication) after an NTLM
94
+ * or Negotiate http 401 challenge only for origins explicitly listed in [[trustedCredentialsOrigins]]
95
+ * (the settings-URL origin is NOT implicitly trusted for SSO, since map-layer URLs may originate from
96
+ * untrusted user input while SSO shares the user's ambient identity).
97
+ * Default is false, preserving the legacy behavior of sending credentials to any request URL.
98
+ * @beta
99
+ */
100
+ restrictCredentialsToTrustedOrigins = false;
70
101
  constructor(opts) {
71
102
  this._configOptions = opts ?? {};
72
103
  internal_1.internalMapLayerImageryFormats.forEach((format) => this.register(format));
73
104
  }
105
+ /** Origins (e.g. "https://tiles.example.com") to which map layer providers may send credentials —
106
+ * both the basic-auth credentials stored in the layer settings and browser credentials for
107
+ * SSO (i.e. Windows Authentication) retries after an NTLM or Negotiate http 401 challenge.
108
+ * Only enforced when [[restrictCredentialsToTrustedOrigins]] is enabled.
109
+ * For basic-auth, the origin of each map layer's settings URL is always implicitly trusted; for SSO,
110
+ * origins must be explicitly listed here.
111
+ * Entries are normalized to their origin (scheme + host + port); only `http:` and `https:` URLs are accepted,
112
+ * and any other entry is ignored and logged. Opaque schemes such as `file:`, `data:`, `about:` and custom
113
+ * Electron protocols are rejected because they all share the same serialized origin, so trusting one would
114
+ * trust every other.
115
+ * @beta
116
+ */
117
+ get trustedCredentialsOrigins() {
118
+ return this._trustedCredentialsOrigins;
119
+ }
120
+ set trustedCredentialsOrigins(origins) {
121
+ const normalized = [];
122
+ for (const entry of origins) {
123
+ const origin = (0, internal_1.tryGetOrigin)(entry);
124
+ if (origin !== undefined)
125
+ normalized.push(origin);
126
+ else
127
+ core_bentley_1.Logger.logWarning(loggerCategory, `trustedCredentialsOrigins: ignoring '${entry}'; entries must be http or https URLs.`);
128
+ }
129
+ this._trustedCredentialsOrigins = normalized;
130
+ }
131
+ /** Returns true if a request to the given URL may be retried with browser credentials included
132
+ * (i.e. SSO / Windows Authentication) after an NTLM or Negotiate http 401 challenge.
133
+ * Always true unless [[restrictCredentialsToTrustedOrigins]] is enabled (opt-in).
134
+ * When enabled, the URL's origin must be explicitly listed in [[trustedCredentialsOrigins]];
135
+ * unlike basic-auth, the settings-URL origin is NOT implicitly trusted because SSO shares the user's
136
+ * ambient identity, and map-layer URLs may originate from untrusted user input.
137
+ * @internal
138
+ */
139
+ isSsoAllowed(url) {
140
+ if (!this.restrictCredentialsToTrustedOrigins)
141
+ return true;
142
+ const origin = (0, internal_1.tryGetOrigin)(url);
143
+ // Entries are normalized to their origin by the [[trustedCredentialsOrigins]] setter.
144
+ return origin !== undefined && this._trustedCredentialsOrigins.includes(origin);
145
+ }
146
+ /** Returns true if the basic-auth credentials belonging to a map-layer source or settings URL may be
147
+ * attached to a request to the given URL. Always true unless [[restrictCredentialsToTrustedOrigins]]
148
+ * is enabled (opt-in). When enabled, the origin of `settingsUrl` is implicitly trusted (the credentials
149
+ * belong to that server); any other origin must be listed in [[trustedCredentialsOrigins]].
150
+ * @internal
151
+ */
152
+ isCredentialsSharingAllowed(url, settingsUrl) {
153
+ if (!this.restrictCredentialsToTrustedOrigins)
154
+ return true;
155
+ const origin = (0, internal_1.tryGetOrigin)(url);
156
+ if (origin === undefined)
157
+ return false;
158
+ if (origin === (0, internal_1.tryGetOrigin)(settingsUrl))
159
+ return true;
160
+ // Entries are normalized to their origin by the [[trustedCredentialsOrigins]] setter.
161
+ return this._trustedCredentialsOrigins.includes(origin);
162
+ }
163
+ /** Origins for which a "credentials sent to untrusted origin" warning was already logged;
164
+ * used to log the discovery warning only once per origin.
165
+ */
166
+ _untrustedUseLogged = new Set();
167
+ /** Logs a warning (once per origin) when credentials are sent to an origin that would be blocked
168
+ * if [[restrictCredentialsToTrustedOrigins]] were enabled.
169
+ * Helps applications discover the origins they need to whitelist before opting in to the restriction.
170
+ * If `settingsUrl` is supplied, requests sharing its origin are not logged, since that origin is
171
+ * implicitly trusted for basic-auth.
172
+ * @internal
173
+ */
174
+ logUntrustedOriginUse(url, settingsUrl) {
175
+ if (this.restrictCredentialsToTrustedOrigins)
176
+ return; // restriction active; nothing to preview
177
+ const origin = (0, internal_1.tryGetOrigin)(url) ?? url;
178
+ if (settingsUrl !== undefined && origin === (0, internal_1.tryGetOrigin)(settingsUrl))
179
+ return; // implicitly trusted for basic-auth
180
+ if (this._untrustedUseLogged.has(origin) || this._trustedCredentialsOrigins.includes(origin))
181
+ return;
182
+ this._untrustedUseLogged.add(origin);
183
+ core_bentley_1.Logger.logWarning(loggerCategory, `Credentials sent to origin '${origin}' which is not in MapLayerFormatRegistry.trustedCredentialsOrigins; `
184
+ + "this request would be blocked if restrictCredentialsToTrustedOrigins were enabled.");
185
+ }
74
186
  _formats = new Map();
75
187
  isRegistered(formatId) { return this._formats.get(formatId) !== undefined; }
76
188
  register(formatClass) {
@@ -1 +1 @@
1
- {"version":3,"file":"MapLayerFormatRegistry.js","sourceRoot":"","sources":["../../../../src/tile/map/MapLayerFormatRegistry.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAoE;AAEpE,+CAA4C;AAE5C,0CAAuO;AACvO,MAAM,cAAc,GAAG,uBAAuB,CAAC;AAE/C;;;;;;;;GAQG;AACH,MAAa,cAAc;IAClB,MAAM,CAAC,QAAQ,CAAS;IAE/B,qEAAqE;IAC9D,MAAM,CAAC,QAAQ,KAAK,qBAAS,CAAC,sBAAsB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAE7E;;;;;;;OAOG;IACI,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,IAAY,EAAE,SAAkB,EAAE,SAAkB,EAAE,YAAsB,EAAE,SAAuB,IAAuC,OAAO,EAAE,MAAM,EAAE,+BAAoB,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IAE/N;;MAEE;IACK,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAwB;QACnD,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IAC5G,CAAC;IAED;;;;;OAKG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I,CAAC,IAAI,IAAI,CAAC,MAAM;YAClB,OAAO,EAAE,MAAM,EAAE,+BAAoB,CAAC,aAAa,EAAE,CAAC;QAExD,OAAO,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;CACF;AAnGD,wDAmGC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module MapLayers\r\n */\r\n\r\nimport { assert, expectDefined, Logger } from \"@itwin/core-bentley\";\r\nimport { ImageMapLayerSettings, MapLayerKey, MapLayerSettings, MapSubLayerProps } from \"@itwin/core-common\";\r\nimport { IModelApp } from \"../../IModelApp\";\r\nimport { IModelConnection } from \"../../IModelConnection\";\r\nimport { ImageryMapLayerTreeReference, internalMapLayerImageryFormats, MapLayerAccessClient, MapLayerAuthenticationInfo, MapLayerImageryProvider, MapLayerSource, MapLayerSourceStatus, MapLayerTileTreeReference } from \"../internal\";\r\nconst loggerCategory = \"ArcGISFeatureProvider\";\r\n\r\n/**\r\n * Class representing a map-layer format.\r\n * Each format has it's unique 'formatId' string, used to uniquely identify a format in the [[MapLayerFormatRegistry]].\r\n * When creating an [[ImageMapLayerSettings]] object, a format needs to be specified this 'formatId'.\r\n * The MapLayerFormat object can later be used to validate a source, or create a provider.\r\n *\r\n * Subclasses should override formatId, [[MapLayerFormat.createImageryProvider]], and [[MapLayerFormat.createMapLayerTree]].\r\n * @public\r\n */\r\nexport class MapLayerFormat {\r\n public static formatId: string;\r\n\r\n /** Register the current format in the [[MapLayerFormatRegistry]]. */\r\n public static register() { IModelApp.mapLayerFormatRegistry.register(this); }\r\n\r\n /**\r\n * Allow a source of a specific format to be validated before being attached as a map-layer.\r\n * @param _url The URL of the source.\r\n * @param _userName The username to access the source if needed.\r\n * @param _password The password to access the source if needed.\r\n * @param _ignoreCache Flag to skip cache lookup (i.e. force a new server request).\r\n * @returns Validation Status. If successful, a list of available sub-layers may also be returned.\r\n */\r\n public static async validateSource(_url: string, _userName?: string, _password?: string, _ignoreCache?: boolean, _accesKey?: MapLayerKey): Promise<MapLayerSourceValidation> { return { status: MapLayerSourceStatus.Valid }; }\r\n\r\n /** Allow a source object to be validated before being attached as a map-layer.\r\n * @beta\r\n */\r\n public static async validate(args: ValidateSourceArgs): Promise<MapLayerSourceValidation> {\r\n return this.validateSource(args.source.url, args.source.userName, args.source.password, args.ignoreCache);\r\n }\r\n\r\n /**\r\n * Create a [[MapLayerImageryProvider]] that will be used to feed data in a map-layer tile tree.\r\n * @param _settings The map layer settings to be applied to the imagery provider.\r\n * @returns Returns the new imagery provider.\r\n * @beta\r\n */\r\n public static createImageryProvider(_settings: MapLayerSettings): MapLayerImageryProvider | undefined { assert(false); }\r\n\r\n /**\r\n * Creates a MapLayerTileTreeReference for this map layer format.\r\n * @param _layerSettings Map layer settings that are applied to the MapLayerTileTreeReference.\r\n * @param _layerIndex The index of the associated map layer.\r\n * @param _iModel The iModel containing the MapLayerTileTreeReference.\r\n * @returns Returns the new tile tree reference.\r\n * @beta\r\n */\r\n public static createMapLayerTree(_layerSettings: MapLayerSettings, _layerIndex: number, _iModel: IModelConnection): MapLayerTileTreeReference | undefined {\r\n assert(false);\r\n return undefined;\r\n }\r\n\r\n}\r\n\r\n/** Options for validating sources\r\n * @beta\r\n */\r\nexport interface ValidateSourceArgs {\r\n source: MapLayerSource;\r\n /** Disable cache lookup during validate process */\r\n ignoreCache?: boolean;\r\n}\r\n\r\n/**\r\n * The type of a map layer format.\r\n * @public\r\n */\r\nexport type MapLayerFormatType = typeof MapLayerFormat;\r\n\r\n/** @public */\r\nexport interface MapLayerSourceValidation {\r\n status: MapLayerSourceStatus;\r\n subLayers?: MapSubLayerProps[];\r\n\r\n /** @beta */\r\n authInfo?: MapLayerAuthenticationInfo;\r\n}\r\n\r\n/**\r\n * Options supplied at startup via [[IModelAppOptions.mapLayerOptions]] to specify access keys for various map layer formats.\r\n * 'BingMaps' must have it's key value set to 'key'\r\n * 'MapboxImagery' must have it's key value set to 'access_token'\r\n * Some format-specific options, including `BingMaps`, are retained for compatibility.\r\n *\r\n * @public\r\n */\r\nexport interface MapLayerOptions {\r\n /** Access key for Azure Maps in the format `{ key: \"subscription-key\", value: \"your-azure-maps-key\" }`. */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n AzureMaps?: MapLayerKey;\r\n /** Access key for Mapbox in the format `{ key: \"access_token\", value: \"your-mapbox-key\" }`. */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n MapboxImagery?: MapLayerKey;\r\n /** Access key for Bing Maps in the format `{ key: \"key\", value: \"your-bing-maps-key\" }`.\r\n * @deprecated in 5.11.0 - will not be removed until after 2027-07-03. All Bing Maps APIs are deprecated. Supply custom providers via\r\n * [[IModelAppOptions.geospatialProviders]].\r\n * For basemap imagery, use `@itwin/map-layers-formats`.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n BingMaps?: MapLayerKey;\r\n /** Access keys for additional map layer formats. */\r\n [format: string]: MapLayerKey | undefined;\r\n}\r\n\r\n/** @internal */\r\nexport interface MapLayerFormatEntry {\r\n type: MapLayerFormatType;\r\n accessClient?: MapLayerAccessClient;\r\n}\r\n\r\n/**\r\n * A registry of MapLayerFormats identified by their unique format IDs. The registry can be accessed via [[IModelApp.mapLayerFormatRegistry]].\r\n * @public\r\n */\r\nexport class MapLayerFormatRegistry {\r\n private _configOptions: MapLayerOptions;\r\n constructor(opts?: MapLayerOptions) {\r\n this._configOptions = opts ?? {};\r\n internalMapLayerImageryFormats.forEach((format) => this.register(format));\r\n }\r\n private _formats = new Map<string, MapLayerFormatEntry>();\r\n\r\n public isRegistered(formatId: string) { return this._formats.get(formatId) !== undefined; }\r\n\r\n public register(formatClass: MapLayerFormatType) {\r\n if (formatClass.formatId.length === 0)\r\n return; // must be an abstract class, ignore it\r\n\r\n this._formats.set(formatClass.formatId, { type: formatClass });\r\n }\r\n\r\n /** @beta */\r\n public setAccessClient(formatId: string, accessClient: MapLayerAccessClient): boolean {\r\n const entry = this._formats.get(formatId);\r\n if (entry !== undefined) {\r\n entry.accessClient = accessClient;\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n /** @beta */\r\n public getAccessClient(formatId: string): MapLayerAccessClient | undefined {\r\n if (formatId.length === 0)\r\n return undefined;\r\n\r\n return this._formats.get(formatId)?.accessClient;\r\n }\r\n\r\n public get configOptions(): MapLayerOptions {\r\n return this._configOptions;\r\n }\r\n\r\n /** @internal */\r\n public createImageryMapLayerTree(layerSettings: ImageMapLayerSettings, layerIndex: number, iModel: IModelConnection): ImageryMapLayerTreeReference | undefined {\r\n const entry = this._formats.get(layerSettings.formatId);\r\n const format = entry?.type;\r\n if (format === undefined) {\r\n Logger.logError(loggerCategory, `Could not find format '${layerSettings.formatId}' in registry`);\r\n return undefined;\r\n }\r\n return format.createMapLayerTree(layerSettings, layerIndex, iModel);\r\n }\r\n\r\n /**\r\n * Returns a [[MapLayerImageryProvider]] based on the provided [[ImageMapLayerSettings]] object.\r\n * @internal\r\n */\r\n public createImageryProvider(layerSettings: ImageMapLayerSettings): MapLayerImageryProvider | undefined {\r\n const entry = this._formats.get(layerSettings.formatId);\r\n const format = entry?.type;\r\n if (this._configOptions[layerSettings.formatId] !== undefined) {\r\n const keyValuePair = expectDefined(this._configOptions[layerSettings.formatId]);\r\n const key: MapLayerKey = { key: keyValuePair.key, value: keyValuePair.value };\r\n layerSettings = layerSettings.clone({ accessKey: key });\r\n }\r\n return (format === undefined) ? undefined : format.createImageryProvider(layerSettings);\r\n }\r\n\r\n /** @beta*/\r\n public async validateSource(opts: ValidateSourceArgs): Promise<MapLayerSourceValidation>;\r\n\r\n public async validateSource(formatId: string, url: string, userName?: string, password?: string, ignoreCache?: boolean): Promise<MapLayerSourceValidation>;\r\n\r\n /** @internal*/\r\n public async validateSource(formatIdOrArgs: string|ValidateSourceArgs, url?: string, userName?: string, password?: string, ignoreCache?: boolean): Promise<MapLayerSourceValidation> {\r\n let format: typeof MapLayerFormat | undefined;\r\n let args: ValidateSourceArgs | undefined;\r\n\r\n if (typeof formatIdOrArgs == \"string\" && url !== undefined) {\r\n const formatId = formatIdOrArgs;\r\n const entry = this._formats.get(formatId);\r\n format = entry?.type;\r\n if (format !== undefined) {\r\n const source = MapLayerSource.fromJSON({name: \"\", formatId, url});\r\n if (source !== undefined) {\r\n args = {source, ignoreCache};\r\n source.userName = userName;\r\n source.password = password;\r\n }\r\n\r\n }\r\n } else if (typeof formatIdOrArgs !== \"string\") {\r\n const entry = this._formats.get(formatIdOrArgs.source.formatId);\r\n format = entry?.type;\r\n args = formatIdOrArgs;\r\n }\r\n\r\n if (!args || !format)\r\n return { status: MapLayerSourceStatus.InvalidFormat };\r\n\r\n return format.validate(args);\r\n }\r\n}\r\n\r\n"]}
1
+ {"version":3,"file":"MapLayerFormatRegistry.js","sourceRoot":"","sources":["../../../../src/tile/map/MapLayerFormatRegistry.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAoE;AAEpE,+CAA4C;AAE5C,0CAAqP;AACrP,MAAM,cAAc,GAAG,wBAAwB,CAAC;AAEhD;;;;;;;;GAQG;AACH,MAAa,cAAc;IAClB,MAAM,CAAC,QAAQ,CAAS;IAE/B,qEAAqE;IAC9D,MAAM,CAAC,QAAQ,KAAK,qBAAS,CAAC,sBAAsB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAE7E;;;;;;;OAOG;IACI,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,IAAY,EAAE,SAAkB,EAAE,SAAkB,EAAE,YAAsB,EAAE,SAAuB,IAAuC,OAAO,EAAE,MAAM,EAAE,+BAAoB,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IAE/N;;MAEE;IACK,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAwB;QACnD,OAA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;QAExD,OAAO,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;CACF;AAnND,wDAmNC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module MapLayers\r\n */\r\n\r\nimport { assert, expectDefined, Logger } from \"@itwin/core-bentley\";\r\nimport { ImageMapLayerSettings, MapLayerKey, MapLayerSettings, MapSubLayerProps } from \"@itwin/core-common\";\r\nimport { IModelApp } from \"../../IModelApp\";\r\nimport { IModelConnection } from \"../../IModelConnection\";\r\nimport { ImageryMapLayerTreeReference, internalMapLayerImageryFormats, MapLayerAccessClient, MapLayerAuthenticationInfo, MapLayerImageryProvider, MapLayerSource, MapLayerSourceStatus, MapLayerTileTreeReference, tryGetOrigin } from \"../internal\";\r\nconst loggerCategory = \"MapLayerFormatRegistry\";\r\n\r\n/**\r\n * Class representing a map-layer format.\r\n * Each format has it's unique 'formatId' string, used to uniquely identify a format in the [[MapLayerFormatRegistry]].\r\n * When creating an [[ImageMapLayerSettings]] object, a format needs to be specified this 'formatId'.\r\n * The MapLayerFormat object can later be used to validate a source, or create a provider.\r\n *\r\n * Subclasses should override formatId, [[MapLayerFormat.createImageryProvider]], and [[MapLayerFormat.createMapLayerTree]].\r\n * @public\r\n */\r\nexport class MapLayerFormat {\r\n public static formatId: string;\r\n\r\n /** Register the current format in the [[MapLayerFormatRegistry]]. */\r\n public static register() { IModelApp.mapLayerFormatRegistry.register(this); }\r\n\r\n /**\r\n * Allow a source of a specific format to be validated before being attached as a map-layer.\r\n * @param _url The URL of the source.\r\n * @param _userName The username to access the source if needed.\r\n * @param _password The password to access the source if needed.\r\n * @param _ignoreCache Flag to skip cache lookup (i.e. force a new server request).\r\n * @returns Validation Status. If successful, a list of available sub-layers may also be returned.\r\n */\r\n public static async validateSource(_url: string, _userName?: string, _password?: string, _ignoreCache?: boolean, _accesKey?: MapLayerKey): Promise<MapLayerSourceValidation> { return { status: MapLayerSourceStatus.Valid }; }\r\n\r\n /** Allow a source object to be validated before being attached as a map-layer.\r\n * @beta\r\n */\r\n public static async validate(args: ValidateSourceArgs): Promise<MapLayerSourceValidation> {\r\n return this.validateSource(args.source.url, args.source.userName, args.source.password, args.ignoreCache);\r\n }\r\n\r\n /**\r\n * Create a [[MapLayerImageryProvider]] that will be used to feed data in a map-layer tile tree.\r\n * @param _settings The map layer settings to be applied to the imagery provider.\r\n * @returns Returns the new imagery provider.\r\n * @beta\r\n */\r\n public static createImageryProvider(_settings: MapLayerSettings): MapLayerImageryProvider | undefined { assert(false); }\r\n\r\n /**\r\n * Creates a MapLayerTileTreeReference for this map layer format.\r\n * @param _layerSettings Map layer settings that are applied to the MapLayerTileTreeReference.\r\n * @param _layerIndex The index of the associated map layer.\r\n * @param _iModel The iModel containing the MapLayerTileTreeReference.\r\n * @returns Returns the new tile tree reference.\r\n * @beta\r\n */\r\n public static createMapLayerTree(_layerSettings: MapLayerSettings, _layerIndex: number, _iModel: IModelConnection): MapLayerTileTreeReference | undefined {\r\n assert(false);\r\n return undefined;\r\n }\r\n\r\n}\r\n\r\n/** Options for validating sources\r\n * @beta\r\n */\r\nexport interface ValidateSourceArgs {\r\n source: MapLayerSource;\r\n /** Disable cache lookup during validate process */\r\n ignoreCache?: boolean;\r\n}\r\n\r\n/**\r\n * The type of a map layer format.\r\n * @public\r\n */\r\nexport type MapLayerFormatType = typeof MapLayerFormat;\r\n\r\n/** Error thrown when an NTLM or Negotiate http 401 challenge could not be answered because the request\r\n * URL's origin is not listed in [[MapLayerFormatRegistry.trustedCredentialsOrigins]]\r\n * (see [[MapLayerFormatRegistry.restrictCredentialsToTrustedOrigins]]).\r\n * Thrown by the static map-layer utilities (e.g. capabilities / service-metadata fetches) that have no\r\n * provider instance on which to report the blocked origin; callers convert it to\r\n * [[MapLayerImageryProviderStatus.UntrustedOrigin]] (provider initialization) or\r\n * [[MapLayerSourceStatus.UntrustedOrigin]] (source validation).\r\n * @internal\r\n */\r\nexport class MapLayerUntrustedOriginError extends Error {\r\n /** The URL of the request whose authentication challenge was left unanswered. */\r\n public readonly url: string;\r\n\r\n constructor(url: string) {\r\n super(`Authentication blocked: origin of '${url}' is not listed in MapLayerFormatRegistry.trustedCredentialsOrigins`);\r\n this.url = url;\r\n }\r\n}\r\n\r\n/** @public */\r\nexport interface MapLayerSourceValidation {\r\n status: MapLayerSourceStatus;\r\n subLayers?: MapSubLayerProps[];\r\n\r\n /** @beta */\r\n authInfo?: MapLayerAuthenticationInfo;\r\n\r\n /** The origin of the URL that triggered an `UntrustedOrigin` validation failure, if known. Applications\r\n * can use this to whitelist the correct origin in [[MapLayerFormatRegistry.trustedCredentialsOrigins]].\r\n * @beta\r\n */\r\n blockedOrigin?: string;\r\n}\r\n\r\n/**\r\n * Options supplied at startup via [[IModelAppOptions.mapLayerOptions]] to specify access keys for various map layer formats.\r\n * 'BingMaps' must have it's key value set to 'key'\r\n * 'MapboxImagery' must have it's key value set to 'access_token'\r\n * Some format-specific options, including `BingMaps`, are retained for compatibility.\r\n *\r\n * @public\r\n */\r\nexport interface MapLayerOptions {\r\n /** Access key for Azure Maps in the format `{ key: \"subscription-key\", value: \"your-azure-maps-key\" }`. */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n AzureMaps?: MapLayerKey;\r\n /** Access key for Mapbox in the format `{ key: \"access_token\", value: \"your-mapbox-key\" }`. */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n MapboxImagery?: MapLayerKey;\r\n /** Access key for Bing Maps in the format `{ key: \"key\", value: \"your-bing-maps-key\" }`.\r\n * @deprecated in 5.11.0 - will not be removed until after 2027-07-03. All Bing Maps APIs are deprecated. Supply custom providers via\r\n * [[IModelAppOptions.geospatialProviders]].\r\n * For basemap imagery, use `@itwin/map-layers-formats`.\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n BingMaps?: MapLayerKey;\r\n /** Access keys for additional map layer formats. */\r\n [format: string]: MapLayerKey | undefined;\r\n}\r\n\r\n/** @internal */\r\nexport interface MapLayerFormatEntry {\r\n type: MapLayerFormatType;\r\n accessClient?: MapLayerAccessClient;\r\n}\r\n\r\n/**\r\n * A registry of MapLayerFormats identified by their unique format IDs. The registry can be accessed via [[IModelApp.mapLayerFormatRegistry]].\r\n * @public\r\n */\r\nexport class MapLayerFormatRegistry {\r\n private _configOptions: MapLayerOptions;\r\n private _trustedCredentialsOrigins: string[] = [];\r\n\r\n /** Opt-in enforcement of origin restrictions on map-layer credentials.\r\n * When enabled, map layer providers:\r\n * - attach the basic-auth credentials stored in the layer settings only to requests targeting the origin\r\n * of the layer's settings URL or an origin listed in [[trustedCredentialsOrigins]];\r\n * - retry a request with browser credentials included (i.e. SSO / Windows Authentication) after an NTLM\r\n * or Negotiate http 401 challenge only for origins explicitly listed in [[trustedCredentialsOrigins]]\r\n * (the settings-URL origin is NOT implicitly trusted for SSO, since map-layer URLs may originate from\r\n * untrusted user input while SSO shares the user's ambient identity).\r\n * Default is false, preserving the legacy behavior of sending credentials to any request URL.\r\n * @beta\r\n */\r\n public restrictCredentialsToTrustedOrigins = false;\r\n\r\n constructor(opts?: MapLayerOptions) {\r\n this._configOptions = opts ?? {};\r\n internalMapLayerImageryFormats.forEach((format) => this.register(format));\r\n }\r\n\r\n /** Origins (e.g. \"https://tiles.example.com\") to which map layer providers may send credentials —\r\n * both the basic-auth credentials stored in the layer settings and browser credentials for\r\n * SSO (i.e. Windows Authentication) retries after an NTLM or Negotiate http 401 challenge.\r\n * Only enforced when [[restrictCredentialsToTrustedOrigins]] is enabled.\r\n * For basic-auth, the origin of each map layer's settings URL is always implicitly trusted; for SSO,\r\n * origins must be explicitly listed here.\r\n * Entries are normalized to their origin (scheme + host + port); only `http:` and `https:` URLs are accepted,\r\n * and any other entry is ignored and logged. Opaque schemes such as `file:`, `data:`, `about:` and custom\r\n * Electron protocols are rejected because they all share the same serialized origin, so trusting one would\r\n * trust every other.\r\n * @beta\r\n */\r\n public get trustedCredentialsOrigins(): ReadonlyArray<string> {\r\n return this._trustedCredentialsOrigins;\r\n }\r\n\r\n public set trustedCredentialsOrigins(origins: ReadonlyArray<string>) {\r\n const normalized: string[] = [];\r\n for (const entry of origins) {\r\n const origin = tryGetOrigin(entry);\r\n if (origin !== undefined)\r\n normalized.push(origin);\r\n else\r\n Logger.logWarning(loggerCategory, `trustedCredentialsOrigins: ignoring '${entry}'; entries must be http or https URLs.`);\r\n }\r\n this._trustedCredentialsOrigins = normalized;\r\n }\r\n\r\n /** Returns true if a request to the given URL may be retried with browser credentials included\r\n * (i.e. SSO / Windows Authentication) after an NTLM or Negotiate http 401 challenge.\r\n * Always true unless [[restrictCredentialsToTrustedOrigins]] is enabled (opt-in).\r\n * When enabled, the URL's origin must be explicitly listed in [[trustedCredentialsOrigins]];\r\n * unlike basic-auth, the settings-URL origin is NOT implicitly trusted because SSO shares the user's\r\n * ambient identity, and map-layer URLs may originate from untrusted user input.\r\n * @internal\r\n */\r\n public isSsoAllowed(url: string): boolean {\r\n if (!this.restrictCredentialsToTrustedOrigins)\r\n return true;\r\n\r\n const origin = tryGetOrigin(url);\r\n\r\n // Entries are normalized to their origin by the [[trustedCredentialsOrigins]] setter.\r\n return origin !== undefined && this._trustedCredentialsOrigins.includes(origin);\r\n }\r\n\r\n /** Returns true if the basic-auth credentials belonging to a map-layer source or settings URL may be\r\n * attached to a request to the given URL. Always true unless [[restrictCredentialsToTrustedOrigins]]\r\n * is enabled (opt-in). When enabled, the origin of `settingsUrl` is implicitly trusted (the credentials\r\n * belong to that server); any other origin must be listed in [[trustedCredentialsOrigins]].\r\n * @internal\r\n */\r\n public isCredentialsSharingAllowed(url: string, settingsUrl: string): boolean {\r\n if (!this.restrictCredentialsToTrustedOrigins)\r\n return true;\r\n\r\n const origin = tryGetOrigin(url);\r\n if (origin === undefined)\r\n return false;\r\n\r\n if (origin === tryGetOrigin(settingsUrl))\r\n return true;\r\n\r\n // Entries are normalized to their origin by the [[trustedCredentialsOrigins]] setter.\r\n return this._trustedCredentialsOrigins.includes(origin);\r\n }\r\n\r\n /** Origins for which a \"credentials sent to untrusted origin\" warning was already logged;\r\n * used to log the discovery warning only once per origin.\r\n */\r\n private readonly _untrustedUseLogged = new Set<string>();\r\n\r\n /** Logs a warning (once per origin) when credentials are sent to an origin that would be blocked\r\n * if [[restrictCredentialsToTrustedOrigins]] were enabled.\r\n * Helps applications discover the origins they need to whitelist before opting in to the restriction.\r\n * If `settingsUrl` is supplied, requests sharing its origin are not logged, since that origin is\r\n * implicitly trusted for basic-auth.\r\n * @internal\r\n */\r\n public logUntrustedOriginUse(url: string, settingsUrl?: string): void {\r\n if (this.restrictCredentialsToTrustedOrigins)\r\n return; // restriction active; nothing to preview\r\n\r\n const origin = tryGetOrigin(url) ?? url;\r\n\r\n if (settingsUrl !== undefined && origin === tryGetOrigin(settingsUrl))\r\n return; // implicitly trusted for basic-auth\r\n\r\n if (this._untrustedUseLogged.has(origin) || this._trustedCredentialsOrigins.includes(origin))\r\n return;\r\n\r\n this._untrustedUseLogged.add(origin);\r\n Logger.logWarning(loggerCategory, `Credentials sent to origin '${origin}' which is not in MapLayerFormatRegistry.trustedCredentialsOrigins; `\r\n + \"this request would be blocked if restrictCredentialsToTrustedOrigins were enabled.\");\r\n }\r\n\r\n private _formats = new Map<string, MapLayerFormatEntry>();\r\n\r\n public isRegistered(formatId: string) { return this._formats.get(formatId) !== undefined; }\r\n\r\n public register(formatClass: MapLayerFormatType) {\r\n if (formatClass.formatId.length === 0)\r\n return; // must be an abstract class, ignore it\r\n\r\n this._formats.set(formatClass.formatId, { type: formatClass });\r\n }\r\n\r\n /** @beta */\r\n public setAccessClient(formatId: string, accessClient: MapLayerAccessClient): boolean {\r\n const entry = this._formats.get(formatId);\r\n if (entry !== undefined) {\r\n entry.accessClient = accessClient;\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n /** @beta */\r\n public getAccessClient(formatId: string): MapLayerAccessClient | undefined {\r\n if (formatId.length === 0)\r\n return undefined;\r\n\r\n return this._formats.get(formatId)?.accessClient;\r\n }\r\n\r\n public get configOptions(): MapLayerOptions {\r\n return this._configOptions;\r\n }\r\n\r\n /** @internal */\r\n public createImageryMapLayerTree(layerSettings: ImageMapLayerSettings, layerIndex: number, iModel: IModelConnection): ImageryMapLayerTreeReference | undefined {\r\n const entry = this._formats.get(layerSettings.formatId);\r\n const format = entry?.type;\r\n if (format === undefined) {\r\n Logger.logError(loggerCategory, `Could not find format '${layerSettings.formatId}' in registry`);\r\n return undefined;\r\n }\r\n return format.createMapLayerTree(layerSettings, layerIndex, iModel);\r\n }\r\n\r\n /**\r\n * Returns a [[MapLayerImageryProvider]] based on the provided [[ImageMapLayerSettings]] object.\r\n * @internal\r\n */\r\n public createImageryProvider(layerSettings: ImageMapLayerSettings): MapLayerImageryProvider | undefined {\r\n const entry = this._formats.get(layerSettings.formatId);\r\n const format = entry?.type;\r\n if (this._configOptions[layerSettings.formatId] !== undefined) {\r\n const keyValuePair = expectDefined(this._configOptions[layerSettings.formatId]);\r\n const key: MapLayerKey = { key: keyValuePair.key, value: keyValuePair.value };\r\n layerSettings = layerSettings.clone({ accessKey: key });\r\n }\r\n return (format === undefined) ? undefined : format.createImageryProvider(layerSettings);\r\n }\r\n\r\n /** @beta*/\r\n public async validateSource(opts: ValidateSourceArgs): Promise<MapLayerSourceValidation>;\r\n\r\n public async validateSource(formatId: string, url: string, userName?: string, password?: string, ignoreCache?: boolean): Promise<MapLayerSourceValidation>;\r\n\r\n /** @internal*/\r\n public async validateSource(formatIdOrArgs: string|ValidateSourceArgs, url?: string, userName?: string, password?: string, ignoreCache?: boolean): Promise<MapLayerSourceValidation> {\r\n let format: typeof MapLayerFormat | undefined;\r\n let args: ValidateSourceArgs | undefined;\r\n\r\n if (typeof formatIdOrArgs == \"string\" && url !== undefined) {\r\n const formatId = formatIdOrArgs;\r\n const entry = this._formats.get(formatId);\r\n format = entry?.type;\r\n if (format !== undefined) {\r\n const source = MapLayerSource.fromJSON({name: \"\", formatId, url});\r\n if (source !== undefined) {\r\n args = {source, ignoreCache};\r\n source.userName = userName;\r\n source.password = password;\r\n }\r\n\r\n }\r\n } else if (typeof formatIdOrArgs !== \"string\") {\r\n const entry = this._formats.get(formatIdOrArgs.source.formatId);\r\n format = entry?.type;\r\n args = formatIdOrArgs;\r\n }\r\n\r\n if (!args || !format)\r\n return { status: MapLayerSourceStatus.InvalidFormat };\r\n\r\n return format.validate(args);\r\n }\r\n}\r\n\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"MapLayerImageryFormats.d.ts","sourceRoot":"","sources":["../../../../src/tile/map/MapLayerImageryFormats.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,OAAO,EAAE,qBAAqB,EAAoB,MAAM,oBAAoB,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAML,cAAc,EACd,uBAAuB,EAIvB,yBAAyB,EAQ1B,MAAM,aAAa,CAAC;AAErB;;;;GAIG;AACH,qBAAa,qBAAsB,SAAQ,cAAc;IACvD,gBAAgB;WACO,kBAAkB,CAAC,aAAa,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB,GAAG,yBAAyB,GAAG,SAAS;CAGrK;AAoLD,2KAA2K;AAC3K,cAAM,sBAAuB,SAAQ,qBAAqB;IACxD,OAAuB,QAAQ,SAAc;WACtB,qBAAqB,CAAC,QAAQ,EAAE,qBAAqB,GAAG,uBAAuB,GAAG,SAAS;CAInH;AAaD,gBAAgB;AAEhB,eAAO,MAAM,8BAA8B,mCAA4I,CAAC"}
1
+ {"version":3,"file":"MapLayerImageryFormats.d.ts","sourceRoot":"","sources":["../../../../src/tile/map/MapLayerImageryFormats.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,OAAO,EAAE,qBAAqB,EAAoB,MAAM,oBAAoB,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAML,cAAc,EACd,uBAAuB,EAIvB,yBAAyB,EAS1B,MAAM,aAAa,CAAC;AAErB;;;;GAIG;AACH,qBAAa,qBAAsB,SAAQ,cAAc;IACvD,gBAAgB;WACO,kBAAkB,CAAC,aAAa,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB,GAAG,yBAAyB,GAAG,SAAS;CAGrK;AA8LD,2KAA2K;AAC3K,cAAM,sBAAuB,SAAQ,qBAAqB;IACxD,OAAuB,QAAQ,SAAc;WACtB,qBAAqB,CAAC,QAAQ,EAAE,qBAAqB,GAAG,uBAAuB,GAAG,SAAS;CAInH;AAaD,gBAAgB;AAEhB,eAAO,MAAM,8BAA8B,mCAA4I,CAAC"}
@@ -74,6 +74,14 @@ class WmsMapLayerFormat extends ImageryMapLayerFormat {
74
74
  return { status: internal_1.MapLayerSourceStatus.Valid, subLayers };
75
75
  }
76
76
  catch (err) {
77
+ if (err instanceof internal_1.MapLayerUntrustedOriginError) {
78
+ let blockedOrigin;
79
+ try {
80
+ blockedOrigin = new URL(err.url).origin;
81
+ }
82
+ catch { /* non-hierarchical URL */ }
83
+ return { status: internal_1.MapLayerSourceStatus.UntrustedOrigin, blockedOrigin };
84
+ }
77
85
  let status = internal_1.MapLayerSourceStatus.InvalidUrl;
78
86
  if (err?.status === 401) {
79
87
  status = ((userName && password) ? internal_1.MapLayerSourceStatus.InvalidCredentials : internal_1.MapLayerSourceStatus.RequireAuth);
@@ -139,6 +147,14 @@ class WmtsMapLayerFormat extends ImageryMapLayerFormat {
139
147
  return { status: internal_1.MapLayerSourceStatus.Valid, subLayers };
140
148
  }
141
149
  catch (err) {
150
+ if (err instanceof internal_1.MapLayerUntrustedOriginError) {
151
+ let blockedOrigin;
152
+ try {
153
+ blockedOrigin = new URL(err.url).origin;
154
+ }
155
+ catch { /* non-hierarchical URL */ }
156
+ return { status: internal_1.MapLayerSourceStatus.UntrustedOrigin, blockedOrigin };
157
+ }
142
158
  let status = internal_1.MapLayerSourceStatus.InvalidUrl;
143
159
  if (err?.status === 401) {
144
160
  status = ((userName && password) ? internal_1.MapLayerSourceStatus.InvalidCredentials : internal_1.MapLayerSourceStatus.RequireAuth);
@@ -1 +1 @@
1
- {"version":3,"file":"MapLayerImageryFormats.js","sourceRoot":"","sources":["../../../../src/tile/map/MapLayerImageryFormats.ts"],"names":[],"mappings":";;;AASA,0CAmBqB;AAErB;;;;GAIG;AACH,MAAa,qBAAsB,SAAQ,yBAAc;IACvD,gBAAgB;IACT,MAAM,CAAU,kBAAkB,CAAC,aAAoC,EAAE,UAAkB,EAAE,MAAwB;QAC1H,OAAO,IAAI,uCAA4B,CAAC,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,CAAC;IACjF,CAAC;CACF;AALD,sDAKC;AAED,MAAM,iBAAkB,SAAQ,qBAAqB;IAC5C,MAAM,CAAU,QAAQ,GAAG,KAAK,CAAC;IAEjC,MAAM,CAAU,qBAAqB,CAAC,QAA+B;QAC1E,OAAO,IAAI,qCAA0B,CAAC,QAAQ,CAAC,CAAC;IAClD,CAAC;IACM,MAAM,CAAU,KAAK,CAAC,cAAc,CAAC,GAAW,EAAE,QAAiB,EAAE,QAAiB,EAAE,WAAqB;QAClH,MAAM,MAAM,GAAI,yBAAc,CAAC,QAAQ,CAAC,EAAC,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,iBAAiB,CAAC,QAAQ,EAAE,GAAG,EAAC,CAAC,CAAC;QAC/F,IAAI,MAAM,KAAK,SAAS;YACtB,OAAO,EAAE,MAAM,EAAE,+BAAoB,CAAC,aAAa,EAAE,CAAC;QACxD,MAAM,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAC3B,MAAM,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAC3B,OAAO,iBAAiB,CAAC,QAAQ,CAAC,EAAC,MAA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;QAC1E,OAAO,IAAI,qCAA0B,CAAC,QAAQ,CAAC,CAAC;IAClD,CAAC;;AAEH,MAAM,qBAAsB,SAAQ,qBAAqB;IAChD,MAAM,CAAU,QAAQ,GAAG,SAAS,CAAC;IACrC,MAAM,CAAU,qBAAqB,CAAC,QAA+B,IAAyC,OAAO,IAAI,iCAAsB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;;AAGrK,gBAAgB;AAChB,4JAA4J;AAC/I,QAAA,8BAA8B,GAAG,CAAC,iBAAiB,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,2BAA2B,EAAE,qBAAqB,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module MapLayers\r\n */\r\nimport { ImageMapLayerSettings, MapSubLayerProps } from \"@itwin/core-common\";\r\nimport { IModelConnection } from \"../../IModelConnection\";\r\nimport {\r\n ArcGISMapLayerImageryProvider,\r\n ArcGisUtilities,\r\n BingMapsImageryLayerProvider,\r\n ImageryMapLayerTreeReference,\r\n MapBoxLayerImageryProvider,\r\n MapLayerFormat,\r\n MapLayerImageryProvider,\r\n MapLayerSource,\r\n MapLayerSourceStatus,\r\n MapLayerSourceValidation,\r\n MapLayerTileTreeReference,\r\n TileUrlImageryProvider,\r\n ValidateSourceArgs,\r\n WmsCapabilities,\r\n WmsMapLayerImageryProvider,\r\n WmtsCapabilities,\r\n WmtsCapability,\r\n WmtsMapLayerImageryProvider,\r\n} from \"../internal\";\r\n\r\n/** Base class imagery map layer formats.\r\n * Subclasses should override formatId and [[MapLayerFormat.createImageryProvider]].\r\n * @see [[MapLayerFormat]]\r\n * @beta\r\n */\r\nexport class ImageryMapLayerFormat extends MapLayerFormat {\r\n /** @internal */\r\n public static override createMapLayerTree(layerSettings: ImageMapLayerSettings, layerIndex: number, iModel: IModelConnection): MapLayerTileTreeReference | undefined {\r\n return new ImageryMapLayerTreeReference({ layerSettings, layerIndex, iModel });\r\n }\r\n}\r\n\r\nclass WmsMapLayerFormat extends ImageryMapLayerFormat {\r\n public static override formatId = \"WMS\";\r\n\r\n public static override createImageryProvider(settings: ImageMapLayerSettings): MapLayerImageryProvider | undefined {\r\n return new WmsMapLayerImageryProvider(settings);\r\n }\r\n public static override async validateSource(url: string, userName?: string, password?: string, ignoreCache?: boolean): Promise<MapLayerSourceValidation> {\r\n const source = MapLayerSource.fromJSON({name: \"\", formatId: WmsMapLayerFormat.formatId, url});\r\n if (source === undefined)\r\n return { status: MapLayerSourceStatus.InvalidFormat };\r\n source.userName = userName;\r\n source.password = password;\r\n return WmsMapLayerFormat.validate({source, ignoreCache});\r\n }\r\n\r\n public static override async validate(args: ValidateSourceArgs): Promise<MapLayerSourceValidation> {\r\n const {source, ignoreCache} = args;\r\n const { url, userName, password } = source;\r\n\r\n try {\r\n let subLayers: MapSubLayerProps[] | undefined;\r\n const maxVisibleSubLayers = 50;\r\n const capabilities = await WmsCapabilities.create(url, (userName && password ? {user: userName, password} : undefined), ignoreCache, source.collectQueryParams());\r\n if (capabilities !== undefined) {\r\n subLayers = capabilities.getSubLayers(false);\r\n const rootsSubLayer = subLayers?.find((sublayer) => sublayer.parent === undefined);\r\n const hasTooManyLayers = subLayers && subLayers.length > maxVisibleSubLayers;\r\n\r\n if (!Array.isArray(subLayers))\r\n return { status: MapLayerSourceStatus.Valid, subLayers };\r\n\r\n for (const subLayer of subLayers) {\r\n // In general for WMS, we prefer to have the children of root node visible, but not the root itself.\r\n // Thats simply to give more flexibility in the UI.\r\n // Two exceptions to this rule: If there are too many layers or the root node is not named.\r\n if (subLayer.id && subLayer.id === rootsSubLayer?.id\r\n && (!(subLayer.name && subLayer.name.length > 0) || hasTooManyLayers)) {\r\n subLayer.visible = true;\r\n break; // if root node is visible, don't bother turning ON any other layers\r\n }\r\n\r\n // Make children of the root node visible.\r\n if (subLayer.parent && subLayer.parent === rootsSubLayer?.id && !hasTooManyLayers) {\r\n const isUnnamedGroup = (layer: MapSubLayerProps) => {\r\n return layer.children && layer.children.length > 0 && (!layer.name || layer.name.length === 0);\r\n };\r\n\r\n const makeChildrenVisible = (layers: MapSubLayerProps[] | undefined, layer: MapSubLayerProps) => {\r\n layer?.children?.forEach((childId) => {\r\n const childSubLayer = subLayers?.find((child) => child?.id === childId);\r\n if (childSubLayer) {\r\n childSubLayer.visible = true;\r\n if (isUnnamedGroup(childSubLayer))\r\n makeChildrenVisible(layers, childSubLayer);\r\n }\r\n });\r\n };\r\n\r\n subLayer.visible = true;\r\n\r\n // If we got a unnamed group, make children visible recursively until we have a leaf or named group\r\n if (isUnnamedGroup(subLayer))\r\n makeChildrenVisible(subLayers, subLayer);\r\n }\r\n }\r\n }\r\n\r\n return { status: MapLayerSourceStatus.Valid, subLayers };\r\n } catch (err: any) {\r\n let status = MapLayerSourceStatus.InvalidUrl;\r\n if (err?.status === 401) {\r\n status = ((userName && password) ? MapLayerSourceStatus.InvalidCredentials : MapLayerSourceStatus.RequireAuth);\r\n }\r\n return { status};\r\n }\r\n }\r\n\r\n}\r\n\r\nclass WmtsMapLayerFormat extends ImageryMapLayerFormat {\r\n public static override formatId = \"WMTS\";\r\n\r\n public static override createImageryProvider(settings: ImageMapLayerSettings): MapLayerImageryProvider | undefined {\r\n return new WmtsMapLayerImageryProvider(settings);\r\n }\r\n\r\n public static override async validateSource(url: string, userName?: string, password?: string, ignoreCache?: boolean): Promise<MapLayerSourceValidation> {\r\n const source = MapLayerSource.fromJSON({name: \"\", formatId: WmtsMapLayerFormat.formatId, url});\r\n if (source === undefined)\r\n return { status: MapLayerSourceStatus.InvalidFormat };\r\n source.userName = userName;\r\n source.password = password;\r\n return WmtsMapLayerFormat.validate({source, ignoreCache});\r\n }\r\n\r\n public static override async validate(args: ValidateSourceArgs): Promise<MapLayerSourceValidation> {\r\n const {source, ignoreCache} = args;\r\n const { url, userName, password } = source;\r\n try {\r\n const subLayers: MapSubLayerProps[] = [];\r\n const capabilities = await WmtsCapabilities.create(url, (userName && password ? {user: userName, password} : undefined), ignoreCache, source.collectQueryParams());\r\n if (!capabilities)\r\n return { status: MapLayerSourceStatus.InvalidUrl };\r\n\r\n // Only returns layer that can be published in the Google maps or WGS84 aligned tile trees.\r\n let supportedTms: WmtsCapability.TileMatrixSet[] = [];\r\n const googleMapsTms = capabilities?.contents?.getGoogleMapsCompatibleTileMatrixSet();\r\n if (googleMapsTms) {\r\n supportedTms = googleMapsTms;\r\n }\r\n const wsg84Tms = capabilities?.contents?.getEpsg4326CompatibleTileMatrixSet();\r\n if (wsg84Tms) {\r\n supportedTms = supportedTms.concat(wsg84Tms);\r\n }\r\n\r\n if (supportedTms.length === 0) {\r\n // This WMTS server doesn't support either GoogleMaps or WSG84\r\n return { status: MapLayerSourceStatus.InvalidCoordinateSystem };\r\n }\r\n\r\n let subLayerId = 0;\r\n capabilities?.contents?.layers.forEach((layer) => {\r\n const hasSupportedTms = supportedTms?.some((tms) => {\r\n return layer.tileMatrixSetLinks.some((tmls) => tmls.tileMatrixSet === tms.identifier);\r\n });\r\n if (hasSupportedTms) {\r\n subLayers.push({\r\n name: layer.identifier,\r\n title: layer.title ?? layer.identifier,\r\n visible: (subLayers.length === 0), // Make the first layer visible.\r\n parent: undefined,\r\n children: undefined,\r\n id: subLayerId++,\r\n });\r\n }\r\n });\r\n\r\n // Return error if we could find a single compatible layer.\r\n if (subLayers.length === 0)\r\n return { status: MapLayerSourceStatus.InvalidTileTree };\r\n\r\n return { status: MapLayerSourceStatus.Valid, subLayers };\r\n } catch (err: any) {\r\n let status = MapLayerSourceStatus.InvalidUrl;\r\n if (err?.status === 401) {\r\n status = ((userName && password) ? MapLayerSourceStatus.InvalidCredentials : MapLayerSourceStatus.RequireAuth);\r\n }\r\n return { status};\r\n }\r\n }\r\n\r\n}\r\n\r\nclass ArcGISMapLayerFormat extends ImageryMapLayerFormat {\r\n public static override formatId = \"ArcGIS\";\r\n public static override async validateSource(url: string, userName?: string, password?: string, ignoreCache?: boolean): Promise<MapLayerSourceValidation> {\r\n const source = MapLayerSource.fromJSON({name: \"\", formatId: WmtsMapLayerFormat.formatId, url});\r\n if (source === undefined)\r\n return { status: MapLayerSourceStatus.InvalidFormat };\r\n source.userName = userName;\r\n source.password = password;\r\n return WmtsMapLayerFormat.validate({source, ignoreCache});\r\n }\r\n\r\n public static override async validate(args: ValidateSourceArgs): Promise<MapLayerSourceValidation> {\r\n const urlValidation = ArcGisUtilities.validateUrl(args.source.url, \"MapServer\");\r\n if (urlValidation !== MapLayerSourceStatus.Valid)\r\n return {status: urlValidation};\r\n\r\n // Some Map service supporting only tiles don't include the 'Map' capabilities, thus we can't make it mandatory.\r\n return ArcGisUtilities.validateSource({...args, capabilitiesFilter: []});\r\n }\r\n\r\n public static override createImageryProvider(settings: ImageMapLayerSettings): MapLayerImageryProvider | undefined {\r\n return new ArcGISMapLayerImageryProvider(settings);\r\n }\r\n}\r\n\r\n/** @deprecated in 5.11.0 - will not be removed until after 2027-07-03. Bing Maps imagery is deprecated. For basemap imagery providers, see `@itwin/map-layers-formats`. */\r\nclass BingMapsMapLayerFormat extends ImageryMapLayerFormat {\r\n public static override formatId = \"BingMaps\";\r\n public static override createImageryProvider(settings: ImageMapLayerSettings): MapLayerImageryProvider | undefined {\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n return new BingMapsImageryLayerProvider(settings);\r\n }\r\n}\r\n\r\nclass MapBoxImageryMapLayerFormat extends ImageryMapLayerFormat {\r\n public static override formatId = \"MapboxImagery\";\r\n public static override createImageryProvider(settings: ImageMapLayerSettings): MapLayerImageryProvider | undefined {\r\n return new MapBoxLayerImageryProvider(settings);\r\n }\r\n}\r\nclass TileUrlMapLayerFormat extends ImageryMapLayerFormat {\r\n public static override formatId = \"TileURL\";\r\n public static override createImageryProvider(settings: ImageMapLayerSettings): MapLayerImageryProvider | undefined { return new TileUrlImageryProvider(settings); }\r\n}\r\n\r\n/** @internal */\r\n// eslint-disable-next-line @typescript-eslint/no-deprecated -- BingMapsMapLayerFormat is deprecated but must remain registered for legacy persisted styles.\r\nexport const internalMapLayerImageryFormats = [WmsMapLayerFormat, WmtsMapLayerFormat, ArcGISMapLayerFormat, BingMapsMapLayerFormat, MapBoxImageryMapLayerFormat, TileUrlMapLayerFormat];\r\n"]}
1
+ {"version":3,"file":"MapLayerImageryFormats.js","sourceRoot":"","sources":["../../../../src/tile/map/MapLayerImageryFormats.ts"],"names":[],"mappings":";;;AASA,0CAoBqB;AAErB;;;;GAIG;AACH,MAAa,qBAAsB,SAAQ,yBAAc;IACvD,gBAAgB;IACT,MAAM,CAAU,kBAAkB,CAAC,aAAoC,EAAE,UAAkB,EAAE,MAAwB;QAC1H,OAAO,IAAI,uCAA4B,CAAC,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,CAAC;IACjF,CAAC;CACF;AALD,sDAKC;AAED,MAAM,iBAAkB,SAAQ,qBAAqB;IAC5C,MAAM,CAAU,QAAQ,GAAG,KAAK,CAAC;IAEjC,MAAM,CAAU,qBAAqB,CAAC,QAA+B;QAC1E,OAAO,IAAI,qCAA0B,CAAC,QAAQ,CAAC,CAAC;IAClD,CAAC;IACM,MAAM,CAAU,KAAK,CAAC,cAAc,CAAC,GAAW,EAAE,QAAiB,EAAE,QAAiB,EAAE,WAAqB;QAClH,MAAM,MAAM,GAAI,yBAAc,CAAC,QAAQ,CAAC,EAAC,IAAI,EAAE,EAAE,EAAE,QAAQ,EAAE,iBAAiB,CAAC,QAAQ,EAAE,GAAG,EAAC,CAAC,CAAC;QAC/F,IAAI,MAAM,KAAK,SAAS;YACtB,OAAO,EAAE,MAAM,EAAE,+BAAoB,CAAC,aAAa,EAAE,CAAC;QACxD,MAAM,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAC3B,MAAM,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAC3B,OAAO,iBAAiB,CAAC,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,aAAa,KAAK,+BAAoB,CAAC,KAAK;YAC9C,OAAO,EAAC,MAAM,EAAE,aAAa,EAAC,CAAC;QAEjC,gHAAgH;QAChH,OAAO,0BAAe,CAAC,cAAc,CAAC,EAAC,GAAG,IAAI,EAAE,kBAAkB,EAAE,EAAE,EAAC,CAAC,CAAC;IAC3E,CAAC;IAEM,MAAM,CAAU,qBAAqB,CAAC,QAA+B;QAC1E,OAAO,IAAI,wCAA6B,CAAC,QAAQ,CAAC,CAAC;IACrD,CAAC;;AAGH,2KAA2K;AAC3K,MAAM,sBAAuB,SAAQ,qBAAqB;IACjD,MAAM,CAAU,QAAQ,GAAG,UAAU,CAAC;IACtC,MAAM,CAAU,qBAAqB,CAAC,QAA+B;QAC1E,4DAA4D;QAC5D,OAAO,IAAI,uCAA4B,CAAC,QAAQ,CAAC,CAAC;IACpD,CAAC;;AAGH,MAAM,2BAA4B,SAAQ,qBAAqB;IACtD,MAAM,CAAU,QAAQ,GAAG,eAAe,CAAC;IAC3C,MAAM,CAAU,qBAAqB,CAAC,QAA+B;QAC1E,OAAO,IAAI,qCAA0B,CAAC,QAAQ,CAAC,CAAC;IAClD,CAAC;;AAEH,MAAM,qBAAsB,SAAQ,qBAAqB;IAChD,MAAM,CAAU,QAAQ,GAAG,SAAS,CAAC;IACrC,MAAM,CAAU,qBAAqB,CAAC,QAA+B,IAAyC,OAAO,IAAI,iCAAsB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;;AAGrK,gBAAgB;AAChB,4JAA4J;AAC/I,QAAA,8BAA8B,GAAG,CAAC,iBAAiB,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,2BAA2B,EAAE,qBAAqB,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module MapLayers\r\n */\r\nimport { ImageMapLayerSettings, MapSubLayerProps } from \"@itwin/core-common\";\r\nimport { IModelConnection } from \"../../IModelConnection\";\r\nimport {\r\n ArcGISMapLayerImageryProvider,\r\n ArcGisUtilities,\r\n BingMapsImageryLayerProvider,\r\n ImageryMapLayerTreeReference,\r\n MapBoxLayerImageryProvider,\r\n MapLayerFormat,\r\n MapLayerImageryProvider,\r\n MapLayerSource,\r\n MapLayerSourceStatus,\r\n MapLayerSourceValidation,\r\n MapLayerTileTreeReference,\r\n MapLayerUntrustedOriginError,\r\n TileUrlImageryProvider,\r\n ValidateSourceArgs,\r\n WmsCapabilities,\r\n WmsMapLayerImageryProvider,\r\n WmtsCapabilities,\r\n WmtsCapability,\r\n WmtsMapLayerImageryProvider,\r\n} from \"../internal\";\r\n\r\n/** Base class imagery map layer formats.\r\n * Subclasses should override formatId and [[MapLayerFormat.createImageryProvider]].\r\n * @see [[MapLayerFormat]]\r\n * @beta\r\n */\r\nexport class ImageryMapLayerFormat extends MapLayerFormat {\r\n /** @internal */\r\n public static override createMapLayerTree(layerSettings: ImageMapLayerSettings, layerIndex: number, iModel: IModelConnection): MapLayerTileTreeReference | undefined {\r\n return new ImageryMapLayerTreeReference({ layerSettings, layerIndex, iModel });\r\n }\r\n}\r\n\r\nclass WmsMapLayerFormat extends ImageryMapLayerFormat {\r\n public static override formatId = \"WMS\";\r\n\r\n public static override createImageryProvider(settings: ImageMapLayerSettings): MapLayerImageryProvider | undefined {\r\n return new WmsMapLayerImageryProvider(settings);\r\n }\r\n public static override async validateSource(url: string, userName?: string, password?: string, ignoreCache?: boolean): Promise<MapLayerSourceValidation> {\r\n const source = MapLayerSource.fromJSON({name: \"\", formatId: WmsMapLayerFormat.formatId, url});\r\n if (source === undefined)\r\n return { status: MapLayerSourceStatus.InvalidFormat };\r\n source.userName = userName;\r\n source.password = password;\r\n return WmsMapLayerFormat.validate({source, ignoreCache});\r\n }\r\n\r\n public static override async validate(args: ValidateSourceArgs): Promise<MapLayerSourceValidation> {\r\n const {source, ignoreCache} = args;\r\n const { url, userName, password } = source;\r\n\r\n try {\r\n let subLayers: MapSubLayerProps[] | undefined;\r\n const maxVisibleSubLayers = 50;\r\n const capabilities = await WmsCapabilities.create(url, (userName && password ? {user: userName, password} : undefined), ignoreCache, source.collectQueryParams());\r\n if (capabilities !== undefined) {\r\n subLayers = capabilities.getSubLayers(false);\r\n const rootsSubLayer = subLayers?.find((sublayer) => sublayer.parent === undefined);\r\n const hasTooManyLayers = subLayers && subLayers.length > maxVisibleSubLayers;\r\n\r\n if (!Array.isArray(subLayers))\r\n return { status: MapLayerSourceStatus.Valid, subLayers };\r\n\r\n for (const subLayer of subLayers) {\r\n // In general for WMS, we prefer to have the children of root node visible, but not the root itself.\r\n // Thats simply to give more flexibility in the UI.\r\n // Two exceptions to this rule: If there are too many layers or the root node is not named.\r\n if (subLayer.id && subLayer.id === rootsSubLayer?.id\r\n && (!(subLayer.name && subLayer.name.length > 0) || hasTooManyLayers)) {\r\n subLayer.visible = true;\r\n break; // if root node is visible, don't bother turning ON any other layers\r\n }\r\n\r\n // Make children of the root node visible.\r\n if (subLayer.parent && subLayer.parent === rootsSubLayer?.id && !hasTooManyLayers) {\r\n const isUnnamedGroup = (layer: MapSubLayerProps) => {\r\n return layer.children && layer.children.length > 0 && (!layer.name || layer.name.length === 0);\r\n };\r\n\r\n const makeChildrenVisible = (layers: MapSubLayerProps[] | undefined, layer: MapSubLayerProps) => {\r\n layer?.children?.forEach((childId) => {\r\n const childSubLayer = subLayers?.find((child) => child?.id === childId);\r\n if (childSubLayer) {\r\n childSubLayer.visible = true;\r\n if (isUnnamedGroup(childSubLayer))\r\n makeChildrenVisible(layers, childSubLayer);\r\n }\r\n });\r\n };\r\n\r\n subLayer.visible = true;\r\n\r\n // If we got a unnamed group, make children visible recursively until we have a leaf or named group\r\n if (isUnnamedGroup(subLayer))\r\n makeChildrenVisible(subLayers, subLayer);\r\n }\r\n }\r\n }\r\n\r\n return { status: MapLayerSourceStatus.Valid, subLayers };\r\n } catch (err: any) {\r\n if (err instanceof MapLayerUntrustedOriginError) {\r\n let blockedOrigin: string | undefined;\r\n try { blockedOrigin = new URL(err.url).origin; } catch { /* non-hierarchical URL */ }\r\n return { status: MapLayerSourceStatus.UntrustedOrigin, blockedOrigin };\r\n }\r\n let status = MapLayerSourceStatus.InvalidUrl;\r\n if (err?.status === 401) {\r\n status = ((userName && password) ? MapLayerSourceStatus.InvalidCredentials : MapLayerSourceStatus.RequireAuth);\r\n }\r\n return { status};\r\n }\r\n }\r\n\r\n}\r\n\r\nclass WmtsMapLayerFormat extends ImageryMapLayerFormat {\r\n public static override formatId = \"WMTS\";\r\n\r\n public static override createImageryProvider(settings: ImageMapLayerSettings): MapLayerImageryProvider | undefined {\r\n return new WmtsMapLayerImageryProvider(settings);\r\n }\r\n\r\n public static override async validateSource(url: string, userName?: string, password?: string, ignoreCache?: boolean): Promise<MapLayerSourceValidation> {\r\n const source = MapLayerSource.fromJSON({name: \"\", formatId: WmtsMapLayerFormat.formatId, url});\r\n if (source === undefined)\r\n return { status: MapLayerSourceStatus.InvalidFormat };\r\n source.userName = userName;\r\n source.password = password;\r\n return WmtsMapLayerFormat.validate({source, ignoreCache});\r\n }\r\n\r\n public static override async validate(args: ValidateSourceArgs): Promise<MapLayerSourceValidation> {\r\n const {source, ignoreCache} = args;\r\n const { url, userName, password } = source;\r\n try {\r\n const subLayers: MapSubLayerProps[] = [];\r\n const capabilities = await WmtsCapabilities.create(url, (userName && password ? {user: userName, password} : undefined), ignoreCache, source.collectQueryParams());\r\n if (!capabilities)\r\n return { status: MapLayerSourceStatus.InvalidUrl };\r\n\r\n // Only returns layer that can be published in the Google maps or WGS84 aligned tile trees.\r\n let supportedTms: WmtsCapability.TileMatrixSet[] = [];\r\n const googleMapsTms = capabilities?.contents?.getGoogleMapsCompatibleTileMatrixSet();\r\n if (googleMapsTms) {\r\n supportedTms = googleMapsTms;\r\n }\r\n const wsg84Tms = capabilities?.contents?.getEpsg4326CompatibleTileMatrixSet();\r\n if (wsg84Tms) {\r\n supportedTms = supportedTms.concat(wsg84Tms);\r\n }\r\n\r\n if (supportedTms.length === 0) {\r\n // This WMTS server doesn't support either GoogleMaps or WSG84\r\n return { status: MapLayerSourceStatus.InvalidCoordinateSystem };\r\n }\r\n\r\n let subLayerId = 0;\r\n capabilities?.contents?.layers.forEach((layer) => {\r\n const hasSupportedTms = supportedTms?.some((tms) => {\r\n return layer.tileMatrixSetLinks.some((tmls) => tmls.tileMatrixSet === tms.identifier);\r\n });\r\n if (hasSupportedTms) {\r\n subLayers.push({\r\n name: layer.identifier,\r\n title: layer.title ?? layer.identifier,\r\n visible: (subLayers.length === 0), // Make the first layer visible.\r\n parent: undefined,\r\n children: undefined,\r\n id: subLayerId++,\r\n });\r\n }\r\n });\r\n\r\n // Return error if we could find a single compatible layer.\r\n if (subLayers.length === 0)\r\n return { status: MapLayerSourceStatus.InvalidTileTree };\r\n\r\n return { status: MapLayerSourceStatus.Valid, subLayers };\r\n } catch (err: any) {\r\n if (err instanceof MapLayerUntrustedOriginError) {\r\n let blockedOrigin: string | undefined;\r\n try { blockedOrigin = new URL(err.url).origin; } catch { /* non-hierarchical URL */ }\r\n return { status: MapLayerSourceStatus.UntrustedOrigin, blockedOrigin };\r\n }\r\n let status = MapLayerSourceStatus.InvalidUrl;\r\n if (err?.status === 401) {\r\n status = ((userName && password) ? MapLayerSourceStatus.InvalidCredentials : MapLayerSourceStatus.RequireAuth);\r\n }\r\n return { status};\r\n }\r\n }\r\n\r\n}\r\n\r\nclass ArcGISMapLayerFormat extends ImageryMapLayerFormat {\r\n public static override formatId = \"ArcGIS\";\r\n public static override async validateSource(url: string, userName?: string, password?: string, ignoreCache?: boolean): Promise<MapLayerSourceValidation> {\r\n const source = MapLayerSource.fromJSON({name: \"\", formatId: WmtsMapLayerFormat.formatId, url});\r\n if (source === undefined)\r\n return { status: MapLayerSourceStatus.InvalidFormat };\r\n source.userName = userName;\r\n source.password = password;\r\n return WmtsMapLayerFormat.validate({source, ignoreCache});\r\n }\r\n\r\n public static override async validate(args: ValidateSourceArgs): Promise<MapLayerSourceValidation> {\r\n const urlValidation = ArcGisUtilities.validateUrl(args.source.url, \"MapServer\");\r\n if (urlValidation !== MapLayerSourceStatus.Valid)\r\n return {status: urlValidation};\r\n\r\n // Some Map service supporting only tiles don't include the 'Map' capabilities, thus we can't make it mandatory.\r\n return ArcGisUtilities.validateSource({...args, capabilitiesFilter: []});\r\n }\r\n\r\n public static override createImageryProvider(settings: ImageMapLayerSettings): MapLayerImageryProvider | undefined {\r\n return new ArcGISMapLayerImageryProvider(settings);\r\n }\r\n}\r\n\r\n/** @deprecated in 5.11.0 - will not be removed until after 2027-07-03. Bing Maps imagery is deprecated. For basemap imagery providers, see `@itwin/map-layers-formats`. */\r\nclass BingMapsMapLayerFormat extends ImageryMapLayerFormat {\r\n public static override formatId = \"BingMaps\";\r\n public static override createImageryProvider(settings: ImageMapLayerSettings): MapLayerImageryProvider | undefined {\r\n // eslint-disable-next-line @typescript-eslint/no-deprecated\r\n return new BingMapsImageryLayerProvider(settings);\r\n }\r\n}\r\n\r\nclass MapBoxImageryMapLayerFormat extends ImageryMapLayerFormat {\r\n public static override formatId = \"MapboxImagery\";\r\n public static override createImageryProvider(settings: ImageMapLayerSettings): MapLayerImageryProvider | undefined {\r\n return new MapBoxLayerImageryProvider(settings);\r\n }\r\n}\r\nclass TileUrlMapLayerFormat extends ImageryMapLayerFormat {\r\n public static override formatId = \"TileURL\";\r\n public static override createImageryProvider(settings: ImageMapLayerSettings): MapLayerImageryProvider | undefined { return new TileUrlImageryProvider(settings); }\r\n}\r\n\r\n/** @internal */\r\n// eslint-disable-next-line @typescript-eslint/no-deprecated -- BingMapsMapLayerFormat is deprecated but must remain registered for legacy persisted styles.\r\nexport const internalMapLayerImageryFormats = [WmsMapLayerFormat, WmtsMapLayerFormat, ArcGISMapLayerFormat, BingMapsMapLayerFormat, MapBoxImageryMapLayerFormat, TileUrlMapLayerFormat];\r\n"]}
@@ -7,12 +7,35 @@ import { ScreenViewport } from "../../Viewport";
7
7
  import { ImageryMapTile, ImageryMapTileTree, MapCartoRectangle, MapFeatureInfoOptions, MapLayerFeatureInfo, MapTilingScheme, QuadId } from "../internal";
8
8
  import { HitDetail } from "../../HitDetail";
9
9
  import { DecorateContext } from "../../ViewContext";
10
+ /** Escapes HTML metacharacters so the text renders literally when assigned to `innerHTML`.
11
+ * Use for any server- or user-supplied string that ends up in the map tooltip, which is rendered
12
+ * as HTML by [[MapLayerTileTreeReference.getToolTip]].
13
+ * @internal
14
+ */
15
+ export declare function escapeHtml(text: string): string;
16
+ /** Returns the origin (scheme + host + port) of the given URL, or undefined if it cannot be parsed or does
17
+ * not denote a distinct network origin.
18
+ *
19
+ * Only `http:` and `https:` URLs yield an origin. Every other scheme is rejected because opaque URLs
20
+ * — `file:`, `data:`, `about:`, `blob:null`, and the custom protocols Electron hosts commonly register —
21
+ * all serialize to the literal string `"null"`. Comparing those would make unrelated URLs look same-origin,
22
+ * so a single trusted entry could unlock all of them. Callers use this for credential-trust decisions, and
23
+ * returning `undefined` keeps those decisions fail-closed.
24
+ * @internal
25
+ */
26
+ export declare function tryGetOrigin(url: string): string | undefined;
10
27
  /** The status of the map layer imagery provider that lets you know if authentication is needed to request tiles.
11
28
  * @public
12
29
  */
13
30
  export declare enum MapLayerImageryProviderStatus {
14
31
  Valid = 0,
15
- RequireAuth = 1
32
+ RequireAuth = 1,
33
+ /** A request received an authentication challenge, but credentials were withheld because the request origin
34
+ * is not trusted (see [[MapLayerFormatRegistry.restrictCredentialsToTrustedOrigins]]).
35
+ * The blocked origins are available via [[MapLayerImageryProvider.blockedOrigins]].
36
+ * @beta
37
+ */
38
+ UntrustedOrigin = 2
16
39
  }
17
40
  /** @internal */
18
41
  export interface WGS84Extent {
@@ -37,7 +60,34 @@ export declare abstract class MapLayerImageryProvider {
37
60
  /** @internal */
38
61
  private _status;
39
62
  /** @internal */
40
- protected _includeUserCredentials: boolean;
63
+ private readonly _blockedOrigins;
64
+ /** Origins of requests for which credentials were withheld because they are not trusted
65
+ * (see [[MapLayerFormatRegistry.restrictCredentialsToTrustedOrigins]]).
66
+ * Populated when [[status]] transitions to [[MapLayerImageryProviderStatus.UntrustedOrigin]];
67
+ * [[onStatusChanged]] is raised again each time a new origin is added. Cleared by [[resetStatus]].
68
+ * @beta
69
+ */
70
+ get blockedOrigins(): ReadonlyArray<string>;
71
+ /** Origins for which a previous SSO handshake (i.e. Windows Authentication) succeeded.
72
+ * Browser credentials are only included for subsequent requests targeting these origins,
73
+ * so that a successful handshake with one host does not leak credentials to other hosts
74
+ * this provider may contact.
75
+ * @internal
76
+ */
77
+ private readonly _ssoSucceededOrigins;
78
+ /** Returns true if browser credentials should be included for the given URL because a previous
79
+ * SSO handshake succeeded for its origin AND the origin is still allowed by the current policy
80
+ * (see [[MapLayerFormatRegistry.isSsoAllowed]]). Re-checking the policy ensures a handshake recorded
81
+ * while enforcement was disabled — or before an origin was removed from
82
+ * [[MapLayerFormatRegistry.trustedCredentialsOrigins]] — does not keep latching credentials on.
83
+ * @internal
84
+ */
85
+ protected includeUserCredentials(url: string): boolean;
86
+ /** Records that an SSO handshake succeeded for the given URL's origin, so subsequent requests
87
+ * to that origin include browser credentials without going through another 401 challenge.
88
+ * @internal
89
+ */
90
+ protected recordSsoSucceeded(url: string): void;
41
91
  /** @internal */
42
92
  protected readonly onFirstRequestCompleted: BeEvent<() => void>;
43
93
  /** @internal */
@@ -53,6 +103,13 @@ export declare abstract class MapLayerImageryProvider {
53
103
  * @public
54
104
  */
55
105
  get supportsMapFeatureInfo(): boolean;
106
+ /** Reset the provider's status to [[MapLayerImageryProviderStatus.Valid]] and clear the list of
107
+ * [[blockedOrigins]] accumulated while in the [[MapLayerImageryProviderStatus.UntrustedOrigin]] state.
108
+ * Raises [[onStatusChanged]] if the status actually changes.
109
+ * Typically called after the user has provided credentials or the application has updated
110
+ * [[MapLayerFormatRegistry.trustedCredentialsOrigins]], so that subsequent requests are re-attempted.
111
+ * @beta
112
+ */
56
113
  resetStatus(): void;
57
114
  /** @internal */
58
115
  get tileSize(): number;
@@ -152,8 +209,67 @@ export declare abstract class MapLayerImageryProvider {
152
209
  protected onStatusUpdated(_newStatus: MapLayerImageryProviderStatus): void;
153
210
  /** @internal */
154
211
  protected setRequestAuthorization(headers: Headers): void;
212
+ /** Returns true if the given URL has the same origin as this layer's settings URL.
213
+ * Used to avoid leaking credentials to third-party hosts.
214
+ * @internal
215
+ */
216
+ protected matchesSettingsUrlOrigin(url: string): boolean;
217
+ /** Returns true if the basic-auth credentials from the layer settings may be attached to a request to the given URL.
218
+ * Always true unless [[MapLayerFormatRegistry.restrictCredentialsToTrustedOrigins]] is enabled (opt-in).
219
+ * When enabled, the origin of this layer's settings URL is implicitly trusted (the credentials belong to that
220
+ * server); other origins must be listed in [[MapLayerFormatRegistry.trustedCredentialsOrigins]].
221
+ * See [[MapLayerFormatRegistry.isCredentialsSharingAllowed]].
222
+ * @internal
223
+ */
224
+ protected isCredentialsSharingAllowed(url: string): boolean;
225
+ /** Returns true if a request to the given URL may be retried with browser credentials included
226
+ * (i.e. SSO / Windows Authentication) after an NTLM or Negotiate http 401 challenge.
227
+ * See [[MapLayerFormatRegistry.isSsoAllowed]].
228
+ * @internal
229
+ */
230
+ protected isSsoAllowed(url: string): boolean;
155
231
  /** @internal */
156
232
  makeTileRequest(url: string, timeoutMs?: number, authorization?: string): Promise<Response>;
233
+ /** Records the given URL's origin and transitions the status to [[MapLayerImageryProviderStatus.UntrustedOrigin]].
234
+ * Called when a request received an authentication challenge that could not be answered because the origin
235
+ * is not trusted (see [[MapLayerFormatRegistry.restrictCredentialsToTrustedOrigins]]).
236
+ * Raises [[onStatusChanged]] on the status transition, and again whenever a new origin is added.
237
+ * @internal
238
+ */
239
+ protected reportBlockedOrigin(url: string): void;
240
+ /** Logs a warning (once per origin, app-wide) when credentials are sent to an origin that would be blocked
241
+ * if [[MapLayerFormatRegistry.restrictCredentialsToTrustedOrigins]] were enabled.
242
+ * Helps applications discover the origins they need to whitelist before opting in to the restriction.
243
+ * See [[MapLayerFormatRegistry.logUntrustedOriginUse]].
244
+ * @internal
245
+ */
246
+ protected logUntrustedOriginUse(url: string): void;
247
+ /** The redirect policy to apply to a request that carries browser credentials (see [[includeUserCredentials]]).
248
+ *
249
+ * When [[MapLayerFormatRegistry.restrictCredentialsToTrustedOrigins]] is enabled, redirects are refused
250
+ * outright (`"error"`). `fetch` cannot be asked to follow only same-origin redirects, and by the time a
251
+ * followed redirect can be inspected the credentials have already been delivered to the destination — so
252
+ * refusing is the only way to honour the guarantee that credentials reach none but the origins listed in
253
+ * [[MapLayerFormatRegistry.trustedCredentialsOrigins]]. Legitimate same-origin redirects fail as a result;
254
+ * that is the cost of the opt-in restriction.
255
+ *
256
+ * When the restriction is disabled (the default), redirects are followed as before and
257
+ * [[checkCredentialedRedirect]] reports the destination after the fact.
258
+ * @internal
259
+ */
260
+ protected get credentialedRedirect(): RequestRedirect | undefined;
261
+ /** Detects that a request carrying browser credentials (see [[includeUserCredentials]]) was transparently
262
+ * redirected to a different origin, and reports or logs that origin.
263
+ *
264
+ * This is a **best-effort, after-the-fact** signal used only while
265
+ * [[MapLayerFormatRegistry.restrictCredentialsToTrustedOrigins]] is disabled, where credentialed requests
266
+ * still follow redirects (see [[credentialedRedirect]]). It cannot prevent the exposure — the credentials
267
+ * have already been sent — and it does not fire at all when the destination denies CORS, because `fetch`
268
+ * then rejects instead of returning a `Response`. The destination origin is never latched as SSO-succeeded,
269
+ * so credentials do not keep flowing to it.
270
+ * @internal
271
+ */
272
+ protected checkCredentialedRedirect(requestedUrl: string, response: Response): void;
157
273
  /** @internal */
158
274
  makeRequest(url: string, timeoutMs?: number, authorization?: string): Promise<Response>;
159
275
  /** Returns a map layer tile at the specified settings. */
@@ -1 +1 @@
1
- {"version":3,"file":"MapLayerImageryProvider.d.ts","sourceRoot":"","sources":["../../../../src/tile/map/MapLayerImageryProvider.ts"],"names":[],"mappings":"A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