Skip to content

Commit 30461f0

Browse files
authored
Merge pull request #813 from GSA/apitoken-name
X-CKAN-API-Key as apitoken_header_name
2 parents 336e976 + 66780c5 commit 30461f0

File tree

6 files changed

+16
-16
lines changed

6 files changed

+16
-16
lines changed

.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ CKAN__AUTH__CREATE_USER_VIA_WEB=false
7575
CKAN__AUTH__ROLES_THAT_CASCADE_TO_SUB_GROUPS=admin
7676
CKAN__AUTH__PUBLIC_USER_DETAILS=false
7777

78-
CKAN___APITOKEN_HEADER_NAME=Authorization
78+
CKAN___APITOKEN_HEADER_NAME=X-CKAN-API-Key
7979

8080
# Xloader Settings
8181
# Even though datapusher is ignored, we still have to include a URL in the config?

config/ckan.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ ckan.auth.create_user_via_web = false
110110
ckan.auth.roles_that_cascade_to_sub_groups = admin
111111
ckan.auth.public_user_details = false
112112

113-
apitoken_header_name = Authorization
113+
apitoken_header_name = X-CKAN-API-Key
114114

115115
## Search Settings
116116
#ckan.site_id = $CKAN_SITE_ID

e2e/cypress/integration/ckan_token.cy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ describe('CKAN Token', () => {
3232
method: 'GET',
3333
url: '/api/action/package_search',
3434
headers: {
35-
'Authorization': token_data.api_token
35+
'X-CKAN-API-Key': token_data.api_token
3636
}
3737
}).then((response) => {
3838
expect(response.status).to.eq(200);

e2e/cypress/integration/dataset.cy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ describe('Dataset', () => {
4646
body: formData,
4747
headers: {
4848
'Content-Type': 'multipart/form-data',
49-
'Authorization': token_data.api_token
49+
'X-CKAN-API-Key': token_data.api_token
5050
}
5151
}).then((response) => {
5252
expect(response.status).to.eq(200);

e2e/cypress/integration/datastore.cy.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ describe('Datastore', () => {
1919
method: 'GET',
2020
url: '/api/3/action/datastore_search?resource_id=_table_metadata',
2121
headers: {
22-
'Authorization': token_data.api_token
22+
'X-CKAN-API-Key': token_data.api_token
2323
}
2424
}).should((response) => {
2525
expect(response.body).to.have.property('success', true)
@@ -40,7 +40,7 @@ describe('Datastore', () => {
4040
'headers': {
4141
'cache-control': 'no-cache',
4242
'content-type': 'application/json',
43-
'Authorization': token_data.api_token
43+
'X-CKAN-API-Key': token_data.api_token
4444
},
4545
body: JSON.stringify({
4646
"resource": {"package_id": response.body.result.id},
@@ -61,7 +61,7 @@ describe('Datastore', () => {
6161
method: 'GET',
6262
url: '/api/action/package_show?id=test-dataset-1',
6363
headers: {
64-
'Authorization': token_data.api_token
64+
'X-CKAN-API-Key': token_data.api_token
6565
}
6666
}).then((response) => {
6767
expect(response.body).to.have.property('success', true);
@@ -70,7 +70,7 @@ describe('Datastore', () => {
7070
method: 'GET',
7171
url: `/api/action/datastore_search?resource_id=${resource_id}`,
7272
headers: {
73-
'Authorization': token_data.api_token
73+
'X-CKAN-API-Key': token_data.api_token
7474
}
7575
}).should((response) => {
7676
expect(response.body).to.have.property('success', true);
@@ -85,7 +85,7 @@ describe('Datastore', () => {
8585
method: 'GET',
8686
url: '/api/action/package_show?id=test-dataset-1',
8787
headers: {
88-
'Authorization': token_data.api_token
88+
'X-CKAN-API-Key': token_data.api_token
8989
}
9090
}).then((response) => {
9191
expect(response.body).to.have.property('success', true);
@@ -97,7 +97,7 @@ describe('Datastore', () => {
9797
'headers': {
9898
'cache-control': 'no-cache',
9999
'content-type': 'application/json',
100-
'Authorization': token_data.api_token
100+
'X-CKAN-API-Key': token_data.api_token
101101
},
102102
body: JSON.stringify({
103103
"resource_id": resource_id,

e2e/cypress/support/command.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ Cypress.Commands.add('revoke_token', (tokenName) => {
9999
url: '/api/3/action/api_token_revoke',
100100
method: 'POST',
101101
headers: {
102-
'Authorization': token_data.api_token,
102+
'X-CKAN-API-Key': token_data.api_token,
103103
'Content-Type': 'application/json'
104104
},
105105
body: {jti: token_data.jti}
@@ -141,7 +141,7 @@ Cypress.Commands.add('create_organization', (orgName, orgDesc, extras = null) =>
141141
url: '/api/action/organization_create',
142142
method: 'POST',
143143
headers: {
144-
'Authorization': token_data.api_token,
144+
'X-CKAN-API-Key': token_data.api_token,
145145
'Content-Type': 'application/json'
146146
},
147147
body: {
@@ -180,7 +180,7 @@ Cypress.Commands.add('delete_organization', (orgName) => {
180180
method: 'POST',
181181
failOnStatusCode: false,
182182
headers: {
183-
'Authorization': token_data.api_token,
183+
'X-CKAN-API-Key': token_data.api_token,
184184
'Content-Type': 'application/json'
185185
},
186186
body: {
@@ -193,7 +193,7 @@ Cypress.Commands.add('delete_organization', (orgName) => {
193193
method: 'POST',
194194
failOnStatusCode: false,
195195
headers: {
196-
'Authorization': token_data.api_token,
196+
'X-CKAN-API-Key': token_data.api_token,
197197
'Content-Type': 'application/json'
198198
},
199199
body: {
@@ -215,7 +215,7 @@ Cypress.Commands.add('delete_dataset', (datasetName) => {
215215
method: 'POST',
216216
failOnStatusCode: false,
217217
headers: {
218-
'Authorization': token_data.api_token,
218+
'X-CKAN-API-Key': token_data.api_token,
219219
'Content-Type': 'application/json'
220220
},
221221
body: {
@@ -289,7 +289,7 @@ Cypress.Commands.add('create_dataset', (ckan_dataset) => {
289289
headers: {
290290
'cache-control': 'no-cache',
291291
'content-type': 'application/json',
292-
'Authorization': token_data.api_token,
292+
'X-CKAN-API-Key': token_data.api_token,
293293
},
294294
body: JSON.stringify(ckan_dataset),
295295
};

0 commit comments

Comments
 (0)