File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
src/app/shared/upload/uploader Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,11 @@ import { DragService } from '../../../core/drag.service';
2323
2424export class UploaderComponent {
2525
26+ /**
27+ * Header key to impersonate a user
28+ */
29+ private readonly ON_BEHALF_HEADER = 'X-On-Behalf-Of' ;
30+
2631 /**
2732 * The message to show when drag files on the drop zone
2833 */
@@ -139,7 +144,13 @@ export class UploaderComponent {
139144 item . url = this . uploader . options . url ;
140145 }
141146 // Ensure the current XSRF token is included in every upload request (token may change between items uploaded)
142- this . uploader . options . headers = [ { name : XSRF_REQUEST_HEADER , value : this . tokenExtractor . getToken ( ) } ] ;
147+ // Ensure the behalf header is set if impersonating
148+ this . uploader . options . headers = [
149+ { name : XSRF_REQUEST_HEADER , value : this . tokenExtractor . getToken ( ) } ,
150+ ...( hasValue ( this . uploadFilesOptions . impersonatingID )
151+ ? [ { name : this . ON_BEHALF_HEADER , value : this . uploadFilesOptions . impersonatingID } ]
152+ : [ ] )
153+ ] ;
143154 this . onBeforeUpload ( ) ;
144155 this . isOverDocumentDropZone = observableOf ( false ) ;
145156 } ;
You can’t perform that action at this time.
0 commit comments