diff --git a/rossa-tech-cli/src/app/components/indexPage/index.component.css b/rossa-tech-cli/src/app/components/indexPage/index.component.css deleted file mode 100644 index 9225045..0000000 --- a/rossa-tech-cli/src/app/components/indexPage/index.component.css +++ /dev/null @@ -1,3 +0,0 @@ -.link_click { - cursor:pointer; -} \ No newline at end of file diff --git a/rossa-tech-cli/src/app/components/indexPage/index.component.html b/rossa-tech-cli/src/app/components/indexPage/index.component.html deleted file mode 100644 index f2bce89..0000000 --- a/rossa-tech-cli/src/app/components/indexPage/index.component.html +++ /dev/null @@ -1,28 +0,0 @@ -
-
-
- - - - - - - - - - - - - - - - - - - - - -
#Game TitlePublisherDeveloped byPublishing YearRetail Price
{{i}}{{title.gameTitleValue}}{{title.publisherValue}}{{title.devStudioNameValue}}{{title.publishingYearValue}}${{title.retailPriceValue}}
-
-
-
\ No newline at end of file diff --git a/rossa-tech-cli/src/app/components/indexPage/index.component.ts b/rossa-tech-cli/src/app/components/indexPage/index.component.ts deleted file mode 100644 index e415fc9..0000000 --- a/rossa-tech-cli/src/app/components/indexPage/index.component.ts +++ /dev/null @@ -1,90 +0,0 @@ -import { Component, OnInit } from "@angular/core"; -import { HttpErrorResponse } from "@angular/common/http"; -// import { PageSecurityService } from "../common/pageSecurity.service"; -import { GameTitlesService } from "../../services/gameTitles.service"; -import { LoginService } from "../../auth/login.service"; -import { GameTitle } from "../../dataModels/gameTitle.type"; -import { PageSecurityService } from "src/app/services/pageSecurity.service"; -import { AuthService } from "src/app/auth/auth.service"; - -@Component({ - selector: "app-root", - templateUrl: "./index.component.html", - styleUrls: ["./index.component.css"], -}) -export class IndexComponent implements OnInit { - private _allTitles: Array = []; - public testArray: Array = []; - - constructor( - private loginService: LoginService, - private pageSecurityService: PageSecurityService, - private gameTitlesService: GameTitlesService, - private authService: AuthService - ) { - this.testArray.push("Test1"); - this.testArray.push("Test2"); - this.testArray.push("Test3"); - this.testArray.push("Test4"); - this.testArray.push("Test5"); - } - - public get allTitles(): Array { - return this._allTitles; - } - - public set allTitles(val: Array) { - this._allTitles = val; - } - - ngOnInit(): void { - // let userLoggedIn: Boolean = this.authService.checkUserLoggedIn(); - // if (!userLoggedIn) { - // this.pageSecurityService.gotoLoginPage(); - // } else { - this.loadAllGameTitles(); - // } - } - - private loadAllGameTitles(): void { - let self = this; - self.gameTitlesService.getAllGameTitles().subscribe( - (resp: any) => { - if (resp && resp.length > 0) { - for (var itm of resp) { - if (itm) { - let titleToAdd: GameTitle = new GameTitle( - itm.gameTitle, - itm.publisher, - itm.devStudioName, - itm.publishingYear, - itm.retailPrice - ); - self._allTitles.push(titleToAdd); - } - } - } - }, - (error: HttpErrorResponse) => { - if (error != null) { - if (error.status === 0) { - // XXX - console.log("Client error."); - } else if (error.status === 401 || error.status === 403) { - // XXX - alert("You are not authorized."); - console.log("You are not authorized."); - self.loginService.removeSessionCurrentUser(); - self.pageSecurityService.gotoLoginPage(); - } else if (error.status === 500) { - alert("Server error."); - console.log("Server error occurred."); - } else { - alert("Unknown error."); - console.log("Unknown error: " + error.status); - } - } - } - ); - } -} diff --git a/rossa-tech-cli/src/app/services/auth.service.spec.ts b/rossa-tech-cli/src/app/services/auth.service.spec.ts deleted file mode 100644 index 1515212..0000000 --- a/rossa-tech-cli/src/app/services/auth.service.spec.ts +++ /dev/null @@ -1,16 +0,0 @@ -// import { TestBed } from '@angular/core/testing'; - -// import { AuthService } from './auth.service'; - -// describe('AuthService', () => { -// let service: AuthService; - -// beforeEach(() => { -// TestBed.configureTestingModule({}); -// service = TestBed.inject(AuthService); -// }); - -// it('should be created', () => { -// expect(service).toBeTruthy(); -// }); -// }); diff --git a/rossa-tech-cli/src/app/services/auth.service.ts b/rossa-tech-cli/src/app/services/auth.service.ts deleted file mode 100644 index 4a6a99b..0000000 --- a/rossa-tech-cli/src/app/services/auth.service.ts +++ /dev/null @@ -1,65 +0,0 @@ -// import { HttpClient } from '@angular/common/http'; -// import { Injectable } from '@angular/core'; -// import { map } from 'rxjs/operators'; - -// @Injectable({ -// providedIn: 'root', -// }) -// export class AuthenticationService { -// // BASE_PATH: 'http://localhost:8080' -// USER_NAME_SESSION_ATTRIBUTE_NAME = 'authenticatedUser'; - -// public username: string | undefined; -// public password: string | undefined; - -// constructor(private http: HttpClient) {} - -// authenticationService(username: string, password: string) { -// // return this.http -// // .get(`http://localhost:8080/authenticate`, { -// // // .get(`http://localhost:8080/`, { -// // headers: { -// // 'Content-Type': 'application/json', -// // Authorization: this.createBasicAuthToken(username, password), -// // }, -// // }) -// return this.http -// .post('http://localhost:8080/hello', { -// userName: username, -// userPass: password, -// }) -// .pipe( -// map((res) => { -// this.username = username; -// this.password = password; -// this.registerSuccessfulLogin(username, password); -// }) -// ); -// } - -// createBasicAuthToken(username: string, password: string) { -// return 'Basic ' + window.btoa(username + ':' + password); -// } - -// registerSuccessfulLogin(username: string, password: string) { -// sessionStorage.setItem(this.USER_NAME_SESSION_ATTRIBUTE_NAME, username); -// } - -// logout() { -// sessionStorage.removeItem(this.USER_NAME_SESSION_ATTRIBUTE_NAME); -// this.username = undefined; -// this.password = undefined; -// } - -// isUserLoggedIn() { -// let user = sessionStorage.getItem(this.USER_NAME_SESSION_ATTRIBUTE_NAME); -// if (user === undefined) return false; -// return true; -// } - -// getLoggedInUserName() { -// let user = sessionStorage.getItem(this.USER_NAME_SESSION_ATTRIBUTE_NAME); -// if (user === undefined) return ''; -// return user; -// } -// } diff --git a/rossa-tech-cli/src/app/services/gameTitles.service.ts b/rossa-tech-cli/src/app/services/gameTitles.service.ts deleted file mode 100644 index 3d31943..0000000 --- a/rossa-tech-cli/src/app/services/gameTitles.service.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { Injectable } from "@angular/core"; -import { HttpClient, HttpHeaders } from "@angular/common/http"; -import { Observable } from "rxjs"; - -import { environment } from "../../environments/environment"; -import { LoginService } from "../auth/login.service"; - -@Injectable({ - providedIn: "root", -}) -export class GameTitlesService { - constructor(private http: HttpClient, private userService: LoginService) {} - - public getAllGameTitles(): Observable { - let jwtToken: String = this.userService.getUserSecurityToken(), - headers: HttpHeaders = new HttpHeaders({ - authorization: "bearer " + jwtToken, - }), - options = { headers: headers }; - return this.http.get( - environment.apiBaseUrl + "secure/allGameTitles", - options - ); - } -} diff --git a/rossa-tech-cli/src/app/services/pageSecurity.service.ts b/rossa-tech-cli/src/app/services/pageSecurity.service.ts deleted file mode 100644 index 7b080e5..0000000 --- a/rossa-tech-cli/src/app/services/pageSecurity.service.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { Injectable } from "@angular/core"; -import { Router } from "@angular/router"; -import { HttpErrorResponse } from "@angular/common/http"; - -@Injectable({ - providedIn: "root", -}) -export class PageSecurityService { - constructor(private router: Router) {} - - public gotoLoginPage() { - this.router.navigate(["/login"]); - } - - public checkPageSecurityError(httpError: HttpErrorResponse) { - if (!httpError || httpError.status == null) { - throw new Error("Invalid http error object."); - } - - if (httpError.status === 401) { - this.gotoLoginPage(); - } - - if (httpError.status === 403) { - this.router.navigate(["/accessDenied"]); - } - } -} diff --git a/rossa-tech-cli/src/app/services/token-storage.service.spec.ts b/rossa-tech-cli/src/app/services/token-storage.service.spec.ts deleted file mode 100644 index f2b1cd7..0000000 --- a/rossa-tech-cli/src/app/services/token-storage.service.spec.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { TestBed } from '@angular/core/testing'; - -import { TokenStorageService } from './token-storage.service'; - -describe('TokenStorageService', () => { - let service: TokenStorageService; - - beforeEach(() => { - TestBed.configureTestingModule({}); - service = TestBed.inject(TokenStorageService); - }); - - it('should be created', () => { - expect(service).toBeTruthy(); - }); -}); diff --git a/rossa-tech-cli/src/app/services/token-storage.service.ts b/rossa-tech-cli/src/app/services/token-storage.service.ts deleted file mode 100644 index 5d67efb..0000000 --- a/rossa-tech-cli/src/app/services/token-storage.service.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { Injectable } from '@angular/core'; - -@Injectable({ - providedIn: 'root' -}) -export class TokenStorageService { - - constructor() { } -}