Added nonce value generator
This commit is contained in:
parent
4c0e7406f5
commit
7f4e260532
@ -49,10 +49,19 @@ export class LoginComponent implements OnInit {
|
|||||||
'&prompt=consent' +
|
'&prompt=consent' +
|
||||||
'&redirect_uri=http://localhost:4200' +
|
'&redirect_uri=http://localhost:4200' +
|
||||||
'&scope=openid%20profile' +
|
'&scope=openid%20profile' +
|
||||||
'&nonce=abcdef';
|
'&nonce=' + this.randomString(20);
|
||||||
window.location.replace(url);
|
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() {
|
logout() {
|
||||||
const url = this.openid_endpoint + '/logout' +
|
const url = this.openid_endpoint + '/logout' +
|
||||||
'?id_token_hint=' + this.id_token + '&' +
|
'?id_token_hint=' + this.id_token + '&' +
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user