-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add token authentication option for DICOMweb
When the user is creating a DICOMweb assetstore, if they select the "token" authentication type, an input box will appear where the user must enter the token. This token is saved in MongoDB, and is used for making all requests for this DICOMweb assetstore. That includes requests for importing the data (which may only be done by an admin), and requests for viewing the data (which may be done by anyone with access to the folder). If an admin wishes to restrict users from viewing DICOMweb assets that were imported using this token, the admin must restrict access to the imported items via girder's folder access controls. Signed-off-by: Patrick Avery <[email protected]>
- Loading branch information
Showing
12 changed files
with
149 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
sources/dicom/large_image_source_dicom/web_client/templates/dicomwebAssetstoreEditFields.pug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
include dicomwebAssetstoreMixins | ||
|
||
+g-dwas-parameters | ||
+g-dwas-parameters("edit") |
57 changes: 45 additions & 12 deletions
57
sources/dicom/large_image_source_dicom/web_client/templates/dicomwebAssetstoreMixins.pug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,52 @@ | ||
mixin g-dwas-parameters | ||
mixin g-dwas-parameters(label_key) | ||
- const key = label_key; | ||
|
||
//- We need to make sure the html elements all have unique ids when this | ||
//- mixin is reused in different places, so that we can locate the correct | ||
//- html elements in the script. | ||
- const url_id = `g-${key}-dwas-url`; | ||
- const qido_id = `g-${key}-dwas-qido-prefix`; | ||
- const wado_id = `g-${key}-dwas-wado-prefix`; | ||
- const auth_type_id = `g-${key}-dwas-auth-type`; | ||
- const auth_type_container_id = `g-${key}-dwas-auth-type-container`; | ||
- const auth_token_id = `g-${key}-dwas-auth-token`; | ||
- const auth_token_container_id = `g-${key}-dwas-auth-token-container`; | ||
|
||
.form-group | ||
label.control-label(for="g-edit-dwas-url") DICOMweb server URL | ||
input#g-edit-dwas-url.input-sm.form-control( | ||
label.control-label(for=url_id) DICOMweb server URL | ||
input.input-sm.form-control( | ||
id=url_id, | ||
type="text", | ||
placeholder="URL") | ||
label.control-label(for="g-edit-dwas-qido-prefix") DICOMweb QIDO prefix (optional) | ||
input#g-edit-dwas-qido-prefix.input-sm.form-control( | ||
label.control-label(for=qido_id) DICOMweb QIDO prefix (optional) | ||
input.input-sm.form-control( | ||
id=qido_id, | ||
type="text", | ||
placeholder="QIDO prefix") | ||
label.control-label(for="g-edit-dwas-wado-prefix") DICOMweb WADO prefix (optional) | ||
input#g-edit-dwas-wado-prefix.input-sm.form-control( | ||
label.control-label(for=wado_id) DICOMweb WADO prefix (optional) | ||
input.input-sm.form-control( | ||
id=wado_id, | ||
type="text", | ||
placeholder="WADO prefix") | ||
//- COMMENTED OUT UNTIL WE ADD AUTHENTICATION | ||
label.control-label(for="g-edit-dwas-auth-type") DICOMweb authentication type (optional) | ||
input#g-edit-dwas-auth-type.input-sm.form-control( | ||
type="text", | ||
placeholder="Authentication type") | ||
label.control-label(for=auth_type_id) DICOMweb authentication type (optional) | ||
- const auth_type = (assetstore && assetstore.attributes.dicomweb_meta.auth_type) || null; | ||
- const updateFuncName = `${key}UpdateVisibilities`; | ||
script. | ||
var #{updateFuncName} = function () { | ||
const isToken = document.getElementById('#{auth_type_id}').value === 'token'; | ||
const display = isToken ? 'block' : 'none'; | ||
document.getElementById('#{auth_token_container_id}').style.display = display; | ||
}; | ||
div(id=auth_type_container_id) | ||
select.form-control( | ||
id=auth_type_id, | ||
onchange=updateFuncName + '()') | ||
each auth_option in authOptions | ||
option(value=auth_option.value, selected=(auth_type === auth_option.value)) #{auth_option.label} | ||
- const display = auth_type === 'token' ? 'block': 'none'; | ||
div(id=auth_token_container_id, style='display: ' + display + ';') | ||
label.control-label(for=auth_token_id) DICOMweb authentication token | ||
input.input-sm.form-control( | ||
id=auth_token_id, | ||
type="text", | ||
placeholder="Token") |
13 changes: 13 additions & 0 deletions
13
sources/dicom/large_image_source_dicom/web_client/views/AuthOptions.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
const authOptions = [ | ||
{ | ||
// HTML can't accept null, but it can accept an empty string | ||
value: '', | ||
label: 'None' | ||
}, | ||
{ | ||
value: 'token', | ||
label: 'Token' | ||
} | ||
]; | ||
|
||
export default authOptions; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters