bug[TW24514]: Make changes for authentication to access change report

Change-Id: I1f9cc21d16a46dfacbe7aeb86096fb55ec16bd58
diff --git a/plugins/org.eclipse.osee.web/src/app/diff-report/diff-table/diff-table.component.html b/plugins/org.eclipse.osee.web/src/app/diff-report/diff-table/diff-table.component.html
index 5aba85d..47dfc1b 100644
--- a/plugins/org.eclipse.osee.web/src/app/diff-report/diff-table/diff-table.component.html
+++ b/plugins/org.eclipse.osee.web/src/app/diff-report/diff-table/diff-table.component.html
@@ -70,21 +70,29 @@
 			class="tw-h-0 tw-border-x-[0.1rem] tw-border-b-[0.1rem] tw-border-primary tw-p-0 tw-pl-2 tw-pr-[0.2rem]"
 			*matCellDef="let artifact">
 			{{ artifact.workflowID }}
-			<ng-container *ngIf="link | async as _link">
+			<ng-container *ngIf="endPointUrl | async as _link">
 				<ng-container *ngIf="artifact.changeReport">
-					<br /><a
-						class="tw-font-bold tw-text-blue-900 tw-underline"
-						href="{{ _link + '/' + artifact.changeReport }}"
-						>REQ</a
-					>
+					<br />
+					<button
+						mat-raised-button
+						color="primary"
+						class="tw-mt-4"
+						(click)="
+							getChangeReport(_link + '/' + artifact.changeReport)
+						">
+						REQ
+					</button>
 				</ng-container>
 				<ng-container *ngIf="artifact.icdDiff">
-					<br /><a
-						class="tw-font-bold tw-text-blue-900 tw-underline"
-						target="_blank"
-						href="{{ _link + '/' + artifact.icdDiff }}"
-						>ICD</a
-					>
+					<br /><button
+						mat-raised-button
+						color="primary"
+						class="tw-mt-4"
+						(click)="
+							getChangeReport(_link + '/' + artifact.icdDiff)
+						">
+						ICD
+					</button>
 				</ng-container>
 			</ng-container>
 		</td>
diff --git a/plugins/org.eclipse.osee.web/src/app/diff-report/diff-table/diff-table.component.ts b/plugins/org.eclipse.osee.web/src/app/diff-report/diff-table/diff-table.component.ts
index 79a64db..20fd627 100644
--- a/plugins/org.eclipse.osee.web/src/app/diff-report/diff-table/diff-table.component.ts
+++ b/plugins/org.eclipse.osee.web/src/app/diff-report/diff-table/diff-table.component.ts
@@ -82,10 +82,12 @@
 	}
 
 	workflowFilter = new FormControl('');
+
 	endPointUrl = this.reportService.diffEndpoint.pipe(
 		take(1),
 		shareReplay({ bufferSize: 1, refCount: true })
 	);
+
 	link = this.endPointUrl.pipe(map((endUrl) => apiURL + endUrl));
 
 	constructor(private reportService: ReportService) {
@@ -164,6 +166,17 @@
 		this.allRowsExpanded = flag;
 	}
 
+	getChangeReport(report: string) {
+		let data: string;
+		this.reportService.getReport(report).subscribe((resp: any) => {
+			data = resp;
+			this.downloadAsXmlFile(
+				data,
+				report.substring(report.lastIndexOf('/') + 1)
+			);
+		});
+	}
+
 	updateRowsforCSV(results: Array<workflow>) {
 		var rows = [];
 		for (var i = 0; i < results.length; i++) {
@@ -241,6 +254,20 @@
 		}
 	}
 
+	downloadAsXmlFile(data: string, filename: string) {
+		let blob = new Blob([data], {
+			type: 'text/xml;',
+		});
+		let dwldLink = document.createElement('a');
+		let url = URL.createObjectURL(blob);
+		dwldLink.setAttribute('href', url);
+		dwldLink.setAttribute('download', filename);
+		dwldLink.style.visibility = 'hidden';
+		document.body.appendChild(dwldLink);
+		dwldLink.click();
+		document.body.removeChild(dwldLink);
+	}
+
 	downloadAsCsvFile(csvData: string, filename: string) {
 		let blob = new Blob(['\ufeff' + csvData], {
 			type: 'text/csv;charset=utf-8;',
diff --git a/plugins/org.eclipse.osee.web/src/app/diff-report/services/report.service.ts b/plugins/org.eclipse.osee.web/src/app/diff-report/services/report.service.ts
index 9a04a55..eea2a00 100644
--- a/plugins/org.eclipse.osee.web/src/app/diff-report/services/report.service.ts
+++ b/plugins/org.eclipse.osee.web/src/app/diff-report/services/report.service.ts
@@ -12,7 +12,7 @@
  **********************************************************************/
 import { Injectable } from '@angular/core';
 import { HttpClient } from '@angular/common/http';
-import { BehaviorSubject, combineLatest, Observable, of, Subject } from 'rxjs';
+import { BehaviorSubject, combineLatest, iif, Observable, of } from 'rxjs';
 import {
 	debounceTime,
 	distinctUntilChanged,
@@ -26,6 +26,8 @@
 import { DiffEndPoint } from '../model/types';
 import { Config } from '../model/types';
 import { apiURL } from '@osee/environments';
+import { FilesService } from '@osee/shared/services';
+import { HttpMethods } from '@osee/shared/types';
 
 @Injectable({
 	providedIn: 'root',
@@ -46,7 +48,10 @@
 
 	private _displayTable$ = new BehaviorSubject<boolean>(false);
 
-	constructor(private http: HttpClient) {}
+	constructor(
+		private http: HttpClient,
+		private fileService: FilesService
+	) {}
 
 	diffEndpoint = this.http
 		.get<DiffEndPoint>(apiURL + '/ats/teamwf/diff')
@@ -177,4 +182,16 @@
 			});
 		} else return of();
 	}
+
+	getReport(reportUrl: string) {
+		return iif(
+			() => reportUrl !== undefined,
+			this.fileService.getFileAsBlob(
+				HttpMethods.GET,
+				reportUrl,
+				undefined
+			),
+			of(new Blob())
+		);
+	}
 }