angular - 是否有任何解决方案可以从请求标头中隐藏授权或隐藏令牌
问题描述
我正在尝试保护我的网站,我想隐藏授权或只是隐藏令牌。
我正在使用 Angular 7 和 IIS 服务器。
这是我在前端使用我的令牌时:
var headerOptions = new Headers({
'Content-Type': 'application/json',
'Authorization': 'Bearer ' + this.token,
'contrat_token': this.contrat_token
});
let options = new RequestOptions({
search: params,
headers: headerOptions
});
return this._http.get(url, options).pipe(map(resp => {
if (resp.status === 401 || resp.status == 401 || resp.status.toString() == "401") {
this.clearCookie();
}
else {
let reponse = JSON.parse(resp.json());
if (reponse == -1 || reponse == "-1") {
this.router.navigate(["/"]);
}
}
return JSON.parse(resp.json())
}
), catchError((error) => {
if (error.status == 401 || error.status == "401") {
this.clearCookie();
}
return of();
})
);
我在请求标头中看到:
Authorization: Bearer THL8iBl4y4QTMh8sz8UluO3vDbtVib2Axp-_zYcPRGQVesnzDJVdFVq3GsYXeo4znSMbGqKNmLcGL_inNsMWAtc22
我想看到类似的东西:
Authorization: Bearer ******************
解决方案
推荐阅读
- r - 在循环 R 中切片数据帧
- ios - X次后如何显示评分应用程序的对话框?
- jquery - 如何创建一个可以在检查类时从类中删除复选框的函数?
- c# - C#,我希望主线程在所有子线程结束后输出“num”,怎么做?现在我只能得到'0'
- javascript - {Signature for this request is not valid}币安提款错误
- c - 在C中找到大整数的所有质因子的更好方法?
- node.js - Class-Validator node.js 提供自定义错误
- git - 如何查看 Git 的工作日志(不是提交历史,而是 Git 的进程)
- c# - 如何使 Xamarin 应用全屏(全屏)
- java - 如何将默认的snackbbar动画更改为“Top-to-button”?