Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #56237 from rhcs-dashboard/store-token-in-cookie
mgr/dashboard: securely store remote cluster token Reviewed-by: Ankush Behl <cloudbehl@gmail.com> Reviewed-by: ivoalmeida <NOT@FOUND>
- Loading branch information
Showing
7 changed files
with
76 additions
and
8 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
16 changes: 16 additions & 0 deletions
16
src/pybind/mgr/dashboard/frontend/src/app/shared/services/cookie.service.spec.ts
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,16 @@ | ||
import { TestBed } from '@angular/core/testing'; | ||
|
||
import { CookiesService } from './cookie.service'; | ||
|
||
describe('CookieService', () => { | ||
let service: CookiesService; | ||
|
||
beforeEach(() => { | ||
TestBed.configureTestingModule({}); | ||
service = TestBed.inject(CookiesService); | ||
}); | ||
|
||
it('should be created', () => { | ||
expect(service).toBeTruthy(); | ||
}); | ||
}); |
21 changes: 21 additions & 0 deletions
21
src/pybind/mgr/dashboard/frontend/src/app/shared/services/cookie.service.ts
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,21 @@ | ||
import { Injectable } from '@angular/core'; | ||
import { CookieService } from 'ngx-cookie-service'; | ||
|
||
@Injectable({ | ||
providedIn: 'root' | ||
}) | ||
export class CookiesService { | ||
constructor(private cookieService: CookieService) {} | ||
|
||
setToken(name: string, token: string) { | ||
this.cookieService.set(name, token, null, null, null, true, 'Strict'); | ||
} | ||
|
||
getToken(name: string): string { | ||
return this.cookieService.get(name); | ||
} | ||
|
||
deleteToken(name: string) { | ||
this.cookieService.delete(name); | ||
} | ||
} |