Skip to content

Commit

Permalink
Merge pull request #813 from GSA/apitoken-name
Browse files Browse the repository at this point in the history
X-CKAN-API-Key as apitoken_header_name
  • Loading branch information
FuhuXia authored Feb 14, 2025
2 parents 336e976 + 66780c5 commit 30461f0
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ CKAN__AUTH__CREATE_USER_VIA_WEB=false
CKAN__AUTH__ROLES_THAT_CASCADE_TO_SUB_GROUPS=admin
CKAN__AUTH__PUBLIC_USER_DETAILS=false

CKAN___APITOKEN_HEADER_NAME=Authorization
CKAN___APITOKEN_HEADER_NAME=X-CKAN-API-Key

# Xloader Settings
# Even though datapusher is ignored, we still have to include a URL in the config?
Expand Down
2 changes: 1 addition & 1 deletion config/ckan.ini
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ ckan.auth.create_user_via_web = false
ckan.auth.roles_that_cascade_to_sub_groups = admin
ckan.auth.public_user_details = false

apitoken_header_name = Authorization
apitoken_header_name = X-CKAN-API-Key

## Search Settings
#ckan.site_id = $CKAN_SITE_ID
Expand Down
2 changes: 1 addition & 1 deletion e2e/cypress/integration/ckan_token.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('CKAN Token', () => {
method: 'GET',
url: '/api/action/package_search',
headers: {
'Authorization': token_data.api_token
'X-CKAN-API-Key': token_data.api_token
}
}).then((response) => {
expect(response.status).to.eq(200);
Expand Down
2 changes: 1 addition & 1 deletion e2e/cypress/integration/dataset.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ describe('Dataset', () => {
body: formData,
headers: {
'Content-Type': 'multipart/form-data',
'Authorization': token_data.api_token
'X-CKAN-API-Key': token_data.api_token
}
}).then((response) => {
expect(response.status).to.eq(200);
Expand Down
12 changes: 6 additions & 6 deletions e2e/cypress/integration/datastore.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('Datastore', () => {
method: 'GET',
url: '/api/3/action/datastore_search?resource_id=_table_metadata',
headers: {
'Authorization': token_data.api_token
'X-CKAN-API-Key': token_data.api_token
}
}).should((response) => {
expect(response.body).to.have.property('success', true)
Expand All @@ -40,7 +40,7 @@ describe('Datastore', () => {
'headers': {
'cache-control': 'no-cache',
'content-type': 'application/json',
'Authorization': token_data.api_token
'X-CKAN-API-Key': token_data.api_token
},
body: JSON.stringify({
"resource": {"package_id": response.body.result.id},
Expand All @@ -61,7 +61,7 @@ describe('Datastore', () => {
method: 'GET',
url: '/api/action/package_show?id=test-dataset-1',
headers: {
'Authorization': token_data.api_token
'X-CKAN-API-Key': token_data.api_token
}
}).then((response) => {
expect(response.body).to.have.property('success', true);
Expand All @@ -70,7 +70,7 @@ describe('Datastore', () => {
method: 'GET',
url: `/api/action/datastore_search?resource_id=${resource_id}`,
headers: {
'Authorization': token_data.api_token
'X-CKAN-API-Key': token_data.api_token
}
}).should((response) => {
expect(response.body).to.have.property('success', true);
Expand All @@ -85,7 +85,7 @@ describe('Datastore', () => {
method: 'GET',
url: '/api/action/package_show?id=test-dataset-1',
headers: {
'Authorization': token_data.api_token
'X-CKAN-API-Key': token_data.api_token
}
}).then((response) => {
expect(response.body).to.have.property('success', true);
Expand All @@ -97,7 +97,7 @@ describe('Datastore', () => {
'headers': {
'cache-control': 'no-cache',
'content-type': 'application/json',
'Authorization': token_data.api_token
'X-CKAN-API-Key': token_data.api_token
},
body: JSON.stringify({
"resource_id": resource_id,
Expand Down
12 changes: 6 additions & 6 deletions e2e/cypress/support/command.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ Cypress.Commands.add('revoke_token', (tokenName) => {
url: '/api/3/action/api_token_revoke',
method: 'POST',
headers: {
'Authorization': token_data.api_token,
'X-CKAN-API-Key': token_data.api_token,
'Content-Type': 'application/json'
},
body: {jti: token_data.jti}
Expand Down Expand Up @@ -141,7 +141,7 @@ Cypress.Commands.add('create_organization', (orgName, orgDesc, extras = null) =>
url: '/api/action/organization_create',
method: 'POST',
headers: {
'Authorization': token_data.api_token,
'X-CKAN-API-Key': token_data.api_token,
'Content-Type': 'application/json'
},
body: {
Expand Down Expand Up @@ -180,7 +180,7 @@ Cypress.Commands.add('delete_organization', (orgName) => {
method: 'POST',
failOnStatusCode: false,
headers: {
'Authorization': token_data.api_token,
'X-CKAN-API-Key': token_data.api_token,
'Content-Type': 'application/json'
},
body: {
Expand All @@ -193,7 +193,7 @@ Cypress.Commands.add('delete_organization', (orgName) => {
method: 'POST',
failOnStatusCode: false,
headers: {
'Authorization': token_data.api_token,
'X-CKAN-API-Key': token_data.api_token,
'Content-Type': 'application/json'
},
body: {
Expand All @@ -215,7 +215,7 @@ Cypress.Commands.add('delete_dataset', (datasetName) => {
method: 'POST',
failOnStatusCode: false,
headers: {
'Authorization': token_data.api_token,
'X-CKAN-API-Key': token_data.api_token,
'Content-Type': 'application/json'
},
body: {
Expand Down Expand Up @@ -289,7 +289,7 @@ Cypress.Commands.add('create_dataset', (ckan_dataset) => {
headers: {
'cache-control': 'no-cache',
'content-type': 'application/json',
'Authorization': token_data.api_token,
'X-CKAN-API-Key': token_data.api_token,
},
body: JSON.stringify(ckan_dataset),
};
Expand Down

0 comments on commit 30461f0

Please sign in to comment.