diff --git a/frontend/src/app/component/login/login.component.ts b/frontend/src/app/component/login/login.component.ts index 9769e52..887cb4a 100644 --- a/frontend/src/app/component/login/login.component.ts +++ b/frontend/src/app/component/login/login.component.ts @@ -49,10 +49,19 @@ export class LoginComponent implements OnInit { '&prompt=consent' + '&redirect_uri=http://localhost:4200' + '&scope=openid%20profile' + - '&nonce=abcdef'; + '&nonce=' + this.randomString(20); window.location.replace(url); } + randomString(length: number) { + let text = ''; + const possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; + for (let i = 0; i < length; i++) { + text += possible.charAt(Math.floor(Math.random() * possible.length)); + } + return text; + } + logout() { const url = this.openid_endpoint + '/logout' + '?id_token_hint=' + this.id_token + '&' +