@itwin/map-layers-auth 4.0.0-dev.89 → 4.0.0-dev.91
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.
- package/package.json +8 -9
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/map-layers-auth",
|
|
3
|
-
"version": "4.0.0-dev.
|
|
3
|
+
"version": "4.0.0-dev.91",
|
|
4
4
|
"description": "Extension that adds a Map Layers Widget",
|
|
5
5
|
"main": "lib/cjs/map-layers-auth.js",
|
|
6
6
|
"module": "lib/esm/map-layers-auth.js",
|
|
@@ -22,10 +22,6 @@
|
|
|
22
22
|
"url": "http://www.bentley.com"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@itwin/build-tools": "4.0.0-dev.89",
|
|
26
|
-
"@itwin/core-bentley": "4.0.0-dev.89",
|
|
27
|
-
"@itwin/core-common": "4.0.0-dev.89",
|
|
28
|
-
"@itwin/core-frontend": "4.0.0-dev.89",
|
|
29
25
|
"@itwin/eslint-plugin": "^4.0.0-dev.33",
|
|
30
26
|
"@types/chai": "4.3.1",
|
|
31
27
|
"@types/mocha": "^8.2.2",
|
|
@@ -41,10 +37,14 @@
|
|
|
41
37
|
"sinon": "^9.0.2",
|
|
42
38
|
"sinon-chai": "^3.2.0",
|
|
43
39
|
"source-map-support": "^0.5.6",
|
|
44
|
-
"typescript": "~5.0.2"
|
|
40
|
+
"typescript": "~5.0.2",
|
|
41
|
+
"@itwin/build-tools": "4.0.0-dev.91",
|
|
42
|
+
"@itwin/core-bentley": "4.0.0-dev.91",
|
|
43
|
+
"@itwin/core-frontend": "4.0.0-dev.91",
|
|
44
|
+
"@itwin/core-common": "4.0.0-dev.91"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
|
-
"@itwin/core-bentley": "4.0.0-dev.
|
|
47
|
+
"@itwin/core-bentley": "4.0.0-dev.91"
|
|
48
48
|
},
|
|
49
49
|
"nyc": {
|
|
50
50
|
"extends": "./node_modules/@itwin/build-tools/.nycrc",
|
|
@@ -87,6 +87,5 @@
|
|
|
87
87
|
"lint": "eslint -f visualstudio \"./src/**/*.{ts,tsx}\" 1>&2",
|
|
88
88
|
"test": "mocha \"./lib/cjs/test/**/*.test.js\"",
|
|
89
89
|
"rebuild": "npm run -s clean && npm run -s build"
|
|
90
|
-
}
|
|
91
|
-
"readme": "# @itwin/map-layers-auth\r\n\r\nCopyright © Bentley Systems, Incorporated. All rights reserved. See LICENSE.md for license terms and full copyright notice.\r\n\r\n## Description\r\n\r\nThe __@itwin/map-layers-auth__ package contains classes for enabling various authentification methods, such as OAuth2.\r\n\r\n## ArcGIS OAuth2 support\r\n\r\nTo enable the ArcGIS OAuth2 support, an 'ArcGisAccessClient' object needs to be created and registered in the MapLayerFormatRegistry from __@itwin/imodeljs-frontend__ for the 'ArcGIS' format.\r\n\r\nAlso the following configuration will be required:\r\n\r\n1. __Callback URL__\\\r\nHosting application needs to implement its own callback page, and sets its corresponding public URL on the `ArcGisAccessClient` object.\\\r\nFollowing code demonstrates how a callback page can be implemented as a simple React hook:\r\n\r\n```\r\nimport * as React from \"react\";\r\nexport function ArcGisOauthRedirect() {\r\n const completeLogin = () => {\r\n if (window.opener) {\r\n const opener = (window.opener);\r\n if (opener?.arcGisOAuth2Callback) {\r\n opener.arcGisOAuth2Callback(window.location);\r\n }\r\n }\r\n };\r\n React.useEffect(() => {\r\n completeLogin();\r\n }, []);\r\n}\r\n```\r\n\r\n1. __Client IDs__\\\r\nThe hosting application must be registered in either the ArcGIS Online server (cloud offering) or in ArcGIS enterprise server (on-premise). The registered application must then provide its associated clientID and redirectUri to the `ArcGisAccessClient` object. The ui-test-app application provides a complete sample configuration.\r\nThe map-layers widget has also been updated to support OAuth2: if needed, a popup window will be displayed to trigger the external OAuth process with the remote ArcGIS server. When the process completes, the focus returns to the map-layers widget and layer is ready to be added/displayed.\\\r\n\\\r\nMore details on how to configure the ArcGis Server can be found in the [ESRI documentation](https://developers.arcgis.com/documentation/mapping-apis-and-services/security/tutorials/register-your-application/)\\\r\n\\\r\n`ArcGisAccessClient` initialization example:\r\n\r\n```ts\r\n const enterpriseClientIds = [{\r\n serviceBaseUrl: SampleAppIModelApp.testAppConfiguration.arcGisEnterpriseBaseUrl,\r\n clientId: SampleAppIModelApp.testAppConfiguration?.arcGisEnterpriseClientId,\r\n }];\r\n const accessClient = new ArcGisAccessClient();\r\n const initStatus = accessClient.initialize({\r\n redirectUri: \"http://localhost:3000/esri-oauth2-callback\",\r\n clientIds: {\r\n arcgisOnlineClientId: SampleAppIModelApp?.testAppConfiguration?.arcGisOnlineClientId,\r\n enterpriseClientIds,\r\n }});\r\n IModelApp.mapLayerFormatRegistry.setAccessClient(\"ArcGIS\", accessClient);\r\n```\r\n"
|
|
90
|
+
}
|
|
92
91
|
}
|