@openeo/js-client 2.9.0 → 2.10.0

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.
@@ -88,15 +88,23 @@ class AuthProvider {
88
88
  *
89
89
  * Returns `null` if no access token has been set yet (i.e. not authenticated any longer).
90
90
  *
91
+ * Checks whether the server supports the JWT conformance class.
92
+ *
91
93
  * @returns {string | null}
92
94
  */
93
95
  getToken() {
96
+ //check conformance
97
+ const isJWT = this.connection.capabilities().hasConformance(
98
+ "https://api.openeo.org/*/authentication/jwt"
99
+ );
94
100
  if (typeof this.token === 'string') {
95
- return this.getType() + "/" + this.getProviderId() + "/" + this.token;
96
- }
97
- else {
98
- return null;
101
+ if(isJWT) {
102
+ return this.token; // JWT since API v1.3.0
103
+ } else {
104
+ return this.getType() + "/" + this.getProviderId() + "/" + this.token; // legacy
105
+ }
99
106
  }
107
+ return null;
100
108
  }
101
109
 
102
110
  /**
package/src/connection.js CHANGED
@@ -745,7 +745,7 @@ class Connection {
745
745
  const response = await this._post('/validation', this._normalizeUserProcess(process).process);
746
746
  if (Array.isArray(response.data.errors)) {
747
747
  const errors = response.data.errors;
748
- errors['federation:backends'] = Array.isArray(response.data['federation:missing']) ? response.data['federation:missing'] : [];
748
+ errors['federation:backends'] = Array.isArray(response.data['federation:backends']) ? response.data['federation:backends'] : [];
749
749
  return errors;
750
750
  }
751
751
  else {
@@ -127,6 +127,16 @@ class OidcProvider extends AuthProvider {
127
127
  */
128
128
  this.defaultClients = Array.isArray(options.default_clients) ? options.default_clients : [];
129
129
 
130
+ /**
131
+ * Additional parameters to include in authorization requests.
132
+ *
133
+ * As defined by the API, these parameters MUST be included when
134
+ * requesting the authorization endpoint.
135
+ *
136
+ * @type {object.<string, *>}
137
+ */
138
+ this.authorizationParameters = Utils.isObject(options.authorization_parameters) ? options.authorization_parameters : {};
139
+
130
140
  /**
131
141
  * The detected default Client.
132
142
  *
@@ -244,7 +254,8 @@ class OidcProvider extends AuthProvider {
244
254
  scope: scope.join(' '),
245
255
  validateSubOnSilentRenew: true,
246
256
  response_type,
247
- response_mode: response_type.includes('code') ? 'query' : 'fragment'
257
+ response_mode: response_type.includes('code') ? 'query' : 'fragment',
258
+ extraQueryParams: this.authorizationParameters
248
259
  }, options);
249
260
  }
250
261
 
package/src/openeo.js CHANGED
@@ -109,7 +109,7 @@ class OpenEO {
109
109
  * @returns {string} Version number (according to SemVer).
110
110
  */
111
111
  static clientVersion() {
112
- return "2.9.0";
112
+ return "2.10.0";
113
113
  }
114
114
 
115
115
  }