Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
case AuthScheme.BEARER:
const token = CommonUtil.getCookie(AuthHelper.TOKEN_ID);
if (!CommonUtil.isEmpty(token)) {
headers.set('Authorization', 'Bearer ' + token);
}
break;
case AuthScheme.DIGEST:
if (!CommonUtil.isEmpty(user)) {
// TODO check from where arrive this fields
const nonce = 'dcd98b7102dd2f0e8b11d0f600bfb0c093';
const nc = '00000001';
const cnonce = '0a4f113b';
const opaque = '5ccc069c403ebaf9f0171e9517f40e41';
const qop = 'auth';
const HA1 = Md5.hashStr(user.username + ':' + user.email + ':' + user.password);
const HA2 = Md5.hashStr(method + ':' + uri);
const response = Md5.hashStr(HA1 + ':' + nonce + ':' + nc + ':' + cnonce + ':' + qop + ':' + HA2);
headers.set('Authorization', 'Digest ' +
' username="' + user.username + '",' +
' realm="' + user.email + '",' +
' nonce="' + nonce + '",' +
' uri="' + uri + '",' +
' qop=auth,' +
' nc=' + nc + ',' +
' cnonce="' + cnonce + '",' +
' response="' + response + '",' +
' opaque="' + opaque + '"');
}
break;
case AuthScheme.HOBA:
private convertCommit(projectName: string, commit: any): GitCommit {
const emailMD5 = Md5.hashStr(commit.author_email);
const avatarURL = `https://secure.gravatar.com/avatar/${emailMD5}?s=120&d=identicon`;
return {
html_url: this.getCommitURL(projectName, commit.id),
author: {
id: null,
login: null,
avatar_url: avatarURL,
html_url: null
},
commit: {
author: {
date: commit.created_at,
name: commit.author_name,
email: commit.author_email
},
resetPassword(email, password, nav) {
let url = this.BASE_URL + 'auth/reset';
let body = JSON.stringify({'email': email, 'password': Md5.hashStr(password)});
let headers = new Headers({'Content-Type': 'application/json'});
return new Promise(resolve => {
this.http.patch(url, body, {headers: headers})
.map(res => res.json())
.subscribe(data => {
console.log(data.msg);
if (data.status == 200) {
resolve();
} else {
this.showToast('修改失败...', 2000, nav);
}
}, error => {
this.showToast('无法连接到服务器...', 2000, nav);
});
});
}
public exists(key: string): boolean {
var encryptedKeyString = Md5.hashStr(key).toString();
var valueExists = this.cacheMap.has(encryptedKeyString);
if (valueExists) {
return true;
}
return false;
}
public objectExists(key: any): boolean {
get md5password(): string {
return Md5.hashStr(this.password) as string;
}
userEmailHash(email) {
return Md5.hashStr(email);
}
private persistReportFor({ value }: SceneFinished) {
const filename = `${ Md5.hashStr(value.subject.id) }.json`;
this.stage.manager.informOfWorkInProgress(
RehearsalReport.from(this.stage.manager.readNewJournalEntriesAs('SerenityBDDReporter'))
.exportedUsing(new SerenityBDDReportExporter())
.then((fullReport: FullReport) => Promise.all(
fullReport.scenes.map(
(scene: SceneReport) => this.fs.store(filename, JSON.stringify(scene)),
),
)),
);
}
}
public set(key: string, value: any, options?: any): void {
var encryptedKeyString = Md5.hashStr(key).toString();
this.cacheMap.set(encryptedKeyString, value);
}
public setObject(key: any, value: any, options?: any): void {
initViewArticle() {
const articleView = new ArticleViewParamModel();
articleView.userId = this.article.user.id;
articleView.articleId = this.article.id;
articleView.viewCount = 1;
const hashStr = this.deviceService.userAgent + this.deviceService.browser +
+ this.deviceService.browser_version + + this.deviceService.os + this.deviceService.os_version
+ articleView.userId + articleView.articleId;
articleView.device = Md5.hashStr(hashStr);
this.articleService.viewArticle(articleView).subscribe(
result => {
}
);
}
protected generateId() {
const layer = this.options.layer;
const chain = 'wmts' + this.options.url + layer;
return Md5.hashStr(chain) as string;
}