@itwin/map-layers-auth 3.4.0-dev.9 → 3.5.0-dev.4
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/CHANGELOG.md +23 -1
- package/README.md +10 -10
- package/lib/cjs/ArcGis/ArcGisAccessClient.d.ts +66 -66
- package/lib/cjs/ArcGis/ArcGisAccessClient.js +294 -294
- package/lib/cjs/ArcGis/ArcGisAccessClient.js.map +1 -1
- package/lib/cjs/ArcGis/ArcGisOAuth2Endpoint.d.ts +22 -22
- package/lib/cjs/ArcGis/ArcGisOAuth2Endpoint.js +46 -46
- package/lib/cjs/ArcGis/ArcGisOAuth2Endpoint.js.map +1 -1
- package/lib/cjs/ArcGis/ArcGisTokenGenerator.d.ts +41 -41
- package/lib/cjs/ArcGis/ArcGisTokenGenerator.js +110 -110
- package/lib/cjs/ArcGis/ArcGisTokenGenerator.js.map +1 -1
- package/lib/cjs/ArcGis/ArcGisTokenManager.d.ts +20 -20
- package/lib/cjs/ArcGis/ArcGisTokenManager.js +109 -109
- package/lib/cjs/ArcGis/ArcGisTokenManager.js.map +1 -1
- package/lib/cjs/ArcGis/ArcGisUrl.d.ts +6 -6
- package/lib/cjs/ArcGis/ArcGisUrl.js +49 -49
- package/lib/cjs/ArcGis/ArcGisUrl.js.map +1 -1
- package/lib/cjs/map-layers-auth.d.ts +5 -5
- package/lib/cjs/map-layers-auth.js +21 -21
- package/lib/cjs/map-layers-auth.js.map +1 -1
- package/lib/esm/ArcGis/ArcGisAccessClient.d.ts +66 -66
- package/lib/esm/ArcGis/ArcGisAccessClient.js +290 -290
- package/lib/esm/ArcGis/ArcGisAccessClient.js.map +1 -1
- package/lib/esm/ArcGis/ArcGisOAuth2Endpoint.d.ts +22 -22
- package/lib/esm/ArcGis/ArcGisOAuth2Endpoint.js +42 -42
- package/lib/esm/ArcGis/ArcGisOAuth2Endpoint.js.map +1 -1
- package/lib/esm/ArcGis/ArcGisTokenGenerator.d.ts +41 -41
- package/lib/esm/ArcGis/ArcGisTokenGenerator.js +106 -106
- package/lib/esm/ArcGis/ArcGisTokenGenerator.js.map +1 -1
- package/lib/esm/ArcGis/ArcGisTokenManager.d.ts +20 -20
- package/lib/esm/ArcGis/ArcGisTokenManager.js +105 -105
- package/lib/esm/ArcGis/ArcGisTokenManager.js.map +1 -1
- package/lib/esm/ArcGis/ArcGisUrl.d.ts +6 -6
- package/lib/esm/ArcGis/ArcGisUrl.js +45 -45
- package/lib/esm/ArcGis/ArcGisUrl.js.map +1 -1
- package/lib/esm/map-layers-auth.d.ts +5 -5
- package/lib/esm/map-layers-auth.js +9 -9
- package/lib/esm/map-layers-auth.js.map +1 -1
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,28 @@
|
|
|
1
1
|
# Change Log - @itwin/map-layers-auth
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Thu, 01 Sep 2022 14:37:22 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 3.3.2
|
|
6
|
+
Thu, 01 Sep 2022 14:37:22 GMT
|
|
7
|
+
|
|
8
|
+
_Version update only_
|
|
9
|
+
|
|
10
|
+
## 3.3.1
|
|
11
|
+
Fri, 26 Aug 2022 15:40:02 GMT
|
|
12
|
+
|
|
13
|
+
_Version update only_
|
|
14
|
+
|
|
15
|
+
## 3.3.0
|
|
16
|
+
Thu, 18 Aug 2022 19:08:02 GMT
|
|
17
|
+
|
|
18
|
+
### Updates
|
|
19
|
+
|
|
20
|
+
- upgrade mocha to version 10.0.0
|
|
21
|
+
|
|
22
|
+
## 3.2.9
|
|
23
|
+
Fri, 26 Aug 2022 14:21:40 GMT
|
|
24
|
+
|
|
25
|
+
_Version update only_
|
|
4
26
|
|
|
5
27
|
## 3.2.8
|
|
6
28
|
Tue, 09 Aug 2022 15:52:41 GMT
|
package/README.md
CHANGED
|
@@ -6,15 +6,16 @@ Copyright © Bentley Systems, Incorporated. All rights reserved. See LICENSE.md
|
|
|
6
6
|
|
|
7
7
|
The __@itwin/map-layers-auth__ package contains classes for enabling various authentification methods, such as OAuth2.
|
|
8
8
|
|
|
9
|
-
## ArcGIS OAuth2
|
|
9
|
+
## ArcGIS OAuth2 support
|
|
10
10
|
|
|
11
|
-
To enable the ArcGIS OAuth2
|
|
11
|
+
To 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.
|
|
12
12
|
|
|
13
|
-
Also the following configuration will be required:
|
|
13
|
+
Also the following configuration will be required:
|
|
14
14
|
|
|
15
15
|
1. __Callback URL__\
|
|
16
|
-
Hosting application needs implement its own callback page, and
|
|
17
|
-
Following code demonstrates how
|
|
16
|
+
Hosting application needs to implement its own callback page, and sets its corresponding public URL on the `ArcGisAccessClient` object.\
|
|
17
|
+
Following code demonstrates how a callback page can be implemented as a simple React hook:
|
|
18
|
+
|
|
18
19
|
```
|
|
19
20
|
import * as React from "react";
|
|
20
21
|
export function ArcGisOauthRedirect() {
|
|
@@ -32,13 +33,14 @@ export function ArcGisOauthRedirect() {
|
|
|
32
33
|
}
|
|
33
34
|
```
|
|
34
35
|
|
|
35
|
-
|
|
36
|
-
The hosting application must be registered in either the ArcGIS Online server (cloud offering) or
|
|
37
|
-
The
|
|
36
|
+
1. __Client IDs__\
|
|
37
|
+
The 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.
|
|
38
|
+
The 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.\
|
|
38
39
|
\
|
|
39
40
|
More 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/)\
|
|
40
41
|
\
|
|
41
42
|
`ArcGisAccessClient` initialization example:
|
|
43
|
+
|
|
42
44
|
```ts
|
|
43
45
|
const enterpriseClientIds = [{
|
|
44
46
|
serviceBaseUrl: SampleAppIModelApp.testAppConfiguration.arcGisEnterpriseBaseUrl,
|
|
@@ -53,5 +55,3 @@ More details on how to configure the ArcGis Server can be found in the [ESRI doc
|
|
|
53
55
|
}});
|
|
54
56
|
IModelApp.mapLayerFormatRegistry.setAccessClient("ArcGIS", accessClient);
|
|
55
57
|
```
|
|
56
|
-
|
|
57
|
-
|
|
@@ -1,67 +1,67 @@
|
|
|
1
|
-
/** @packageDocumentation
|
|
2
|
-
* @module Tiles
|
|
3
|
-
*/
|
|
4
|
-
import { BeEvent } from "@itwin/core-bentley";
|
|
5
|
-
import { MapLayerAccessClient, MapLayerAccessToken, MapLayerAccessTokenParams, MapLayerTokenEndpoint } from "@itwin/core-frontend";
|
|
6
|
-
/** @beta */
|
|
7
|
-
export interface ArcGisEnterpriseClientId {
|
|
8
|
-
serviceBaseUrl: string;
|
|
9
|
-
clientId: string;
|
|
10
|
-
}
|
|
11
|
-
/** @beta */
|
|
12
|
-
export interface ArcGisOAuthClientIds {
|
|
13
|
-
arcgisOnlineClientId?: string;
|
|
14
|
-
enterpriseClientIds?: ArcGisEnterpriseClientId[];
|
|
15
|
-
}
|
|
16
|
-
/** @beta
|
|
17
|
-
* ArcGIS OAuth configurations parameters.
|
|
18
|
-
* See https://developers.arcgis.com/documentation/mapping-apis-and-services/security/arcgis-identity/serverless-web-apps/
|
|
19
|
-
* more details.
|
|
20
|
-
*/
|
|
21
|
-
export interface ArcGisOAuthConfig {
|
|
22
|
-
redirectUri: string;
|
|
23
|
-
tokenExpiration?: number;
|
|
24
|
-
clientIds: ArcGisOAuthClientIds;
|
|
25
|
-
}
|
|
26
|
-
/** @beta */
|
|
27
|
-
export declare class ArcGisAccessClient implements MapLayerAccessClient {
|
|
28
|
-
readonly onOAuthProcessEnd: BeEvent<import("@itwin/core-bentley").Listener>;
|
|
29
|
-
private _redirectUri;
|
|
30
|
-
private _expiration;
|
|
31
|
-
private _clientIds;
|
|
32
|
-
constructor();
|
|
33
|
-
initialize(oAuthConfig?: ArcGisOAuthConfig): boolean;
|
|
34
|
-
private initOauthCallbackFunction;
|
|
35
|
-
unInitialize(): void;
|
|
36
|
-
getAccessToken(params: MapLayerAccessTokenParams): Promise<MapLayerAccessToken | undefined>;
|
|
37
|
-
getTokenServiceEndPoint(mapLayerUrl: string): Promise<MapLayerTokenEndpoint | undefined>;
|
|
38
|
-
invalidateToken(token: MapLayerAccessToken): boolean;
|
|
39
|
-
get redirectUri(): string | undefined;
|
|
40
|
-
getMatchingEnterpriseClientId(url: string): string | undefined;
|
|
41
|
-
get expiration(): number | undefined;
|
|
42
|
-
get arcGisOnlineClientId(): string | undefined;
|
|
43
|
-
set arcGisOnlineClientId(clientId: string | undefined);
|
|
44
|
-
get arcGisEnterpriseClientIds(): ArcGisEnterpriseClientId[] | undefined;
|
|
45
|
-
setEnterpriseClientId(serviceBaseUrl: string, clientId: string): void;
|
|
46
|
-
removeEnterpriseClientId(clientId: ArcGisEnterpriseClientId): void;
|
|
47
|
-
/** @internal */
|
|
48
|
-
private getOAuthTokenForMapLayerUrl;
|
|
49
|
-
/**
|
|
50
|
-
* Test if Oauth2 endpoint is accessible and has an associated appId
|
|
51
|
-
* @internal
|
|
52
|
-
*/
|
|
53
|
-
private validateOAuth2Endpoint;
|
|
54
|
-
private _oauthAuthorizeEndPointsCache;
|
|
55
|
-
private _oauthTokenEndPointsCache;
|
|
56
|
-
/**
|
|
57
|
-
* Get OAuth2 endpoint that must be cause to get the Oauth2 token
|
|
58
|
-
* @internal
|
|
59
|
-
*/
|
|
60
|
-
private getOAuth2Endpoint;
|
|
61
|
-
/**
|
|
62
|
-
* Construct the complete Authorize url to starts the Oauth process
|
|
63
|
-
* @internal
|
|
64
|
-
*/
|
|
65
|
-
private constructLoginUrl;
|
|
66
|
-
}
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module Tiles
|
|
3
|
+
*/
|
|
4
|
+
import { BeEvent } from "@itwin/core-bentley";
|
|
5
|
+
import { MapLayerAccessClient, MapLayerAccessToken, MapLayerAccessTokenParams, MapLayerTokenEndpoint } from "@itwin/core-frontend";
|
|
6
|
+
/** @beta */
|
|
7
|
+
export interface ArcGisEnterpriseClientId {
|
|
8
|
+
serviceBaseUrl: string;
|
|
9
|
+
clientId: string;
|
|
10
|
+
}
|
|
11
|
+
/** @beta */
|
|
12
|
+
export interface ArcGisOAuthClientIds {
|
|
13
|
+
arcgisOnlineClientId?: string;
|
|
14
|
+
enterpriseClientIds?: ArcGisEnterpriseClientId[];
|
|
15
|
+
}
|
|
16
|
+
/** @beta
|
|
17
|
+
* ArcGIS OAuth configurations parameters.
|
|
18
|
+
* See https://developers.arcgis.com/documentation/mapping-apis-and-services/security/arcgis-identity/serverless-web-apps/
|
|
19
|
+
* more details.
|
|
20
|
+
*/
|
|
21
|
+
export interface ArcGisOAuthConfig {
|
|
22
|
+
redirectUri: string;
|
|
23
|
+
tokenExpiration?: number;
|
|
24
|
+
clientIds: ArcGisOAuthClientIds;
|
|
25
|
+
}
|
|
26
|
+
/** @beta */
|
|
27
|
+
export declare class ArcGisAccessClient implements MapLayerAccessClient {
|
|
28
|
+
readonly onOAuthProcessEnd: BeEvent<import("@itwin/core-bentley").Listener>;
|
|
29
|
+
private _redirectUri;
|
|
30
|
+
private _expiration;
|
|
31
|
+
private _clientIds;
|
|
32
|
+
constructor();
|
|
33
|
+
initialize(oAuthConfig?: ArcGisOAuthConfig): boolean;
|
|
34
|
+
private initOauthCallbackFunction;
|
|
35
|
+
unInitialize(): void;
|
|
36
|
+
getAccessToken(params: MapLayerAccessTokenParams): Promise<MapLayerAccessToken | undefined>;
|
|
37
|
+
getTokenServiceEndPoint(mapLayerUrl: string): Promise<MapLayerTokenEndpoint | undefined>;
|
|
38
|
+
invalidateToken(token: MapLayerAccessToken): boolean;
|
|
39
|
+
get redirectUri(): string | undefined;
|
|
40
|
+
getMatchingEnterpriseClientId(url: string): string | undefined;
|
|
41
|
+
get expiration(): number | undefined;
|
|
42
|
+
get arcGisOnlineClientId(): string | undefined;
|
|
43
|
+
set arcGisOnlineClientId(clientId: string | undefined);
|
|
44
|
+
get arcGisEnterpriseClientIds(): ArcGisEnterpriseClientId[] | undefined;
|
|
45
|
+
setEnterpriseClientId(serviceBaseUrl: string, clientId: string): void;
|
|
46
|
+
removeEnterpriseClientId(clientId: ArcGisEnterpriseClientId): void;
|
|
47
|
+
/** @internal */
|
|
48
|
+
private getOAuthTokenForMapLayerUrl;
|
|
49
|
+
/**
|
|
50
|
+
* Test if Oauth2 endpoint is accessible and has an associated appId
|
|
51
|
+
* @internal
|
|
52
|
+
*/
|
|
53
|
+
private validateOAuth2Endpoint;
|
|
54
|
+
private _oauthAuthorizeEndPointsCache;
|
|
55
|
+
private _oauthTokenEndPointsCache;
|
|
56
|
+
/**
|
|
57
|
+
* Get OAuth2 endpoint that must be cause to get the Oauth2 token
|
|
58
|
+
* @internal
|
|
59
|
+
*/
|
|
60
|
+
private getOAuth2Endpoint;
|
|
61
|
+
/**
|
|
62
|
+
* Construct the complete Authorize url to starts the Oauth process
|
|
63
|
+
* @internal
|
|
64
|
+
*/
|
|
65
|
+
private constructLoginUrl;
|
|
66
|
+
}
|
|
67
67
|
//# sourceMappingURL=ArcGisAccessClient.d.ts.map
|