Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何保护用于客户登录的Api,而不使其易受他人攻击_Php_Json_Angularjs_Security_Authentication - Fatal编程技术网

Php 如何保护用于客户登录的Api,而不使其易受他人攻击

Php 如何保护用于客户登录的Api,而不使其易受他人攻击,php,json,angularjs,security,authentication,Php,Json,Angularjs,Security,Authentication,我对angularjs的开发非常陌生。 我正在使用angularjs创建一个用户登录系统。 我使用json数据使用angularjs创建了一个用户登录系统。 但是,在控制器中使用我的api链接容易受到源代码中的任何人的攻击 我想确保我的api对任何人都是不受攻击的。使用源代码可以帮助任何人查看我平台上的所有用户。另外,如果我对密码进行哈希运算,那么一些技术人员可能会解码密码 请使用angular或json帮助我保护我的登录平台。当您创建哈希密码时,您可以在该密码中添加salt值,然后再创建安全的

我对angularjs的开发非常陌生。 我正在使用angularjs创建一个用户登录系统。 我使用json数据使用angularjs创建了一个用户登录系统。 但是,在控制器中使用我的api链接容易受到源代码中的任何人的攻击

我想确保我的api对任何人都是不受攻击的。使用源代码可以帮助任何人查看我平台上的所有用户。另外,如果我对密码进行哈希运算,那么一些技术人员可能会解码密码


请使用angular或json帮助我保护我的登录平台。

当您创建哈希密码时,您可以在该密码中添加salt值,然后再创建安全的哈希密码

您可以使用:


另一个用户可以解码此密码,但他们无法创建相同的密码。

很抱歉Intrupt,但我对这里的所有概念都很陌生。我想更清楚地了解盐。我们使用解码只是为了得到正确的真值?如果一个人正在解码密码,那么解码的值必须是一个人试图解码的确切块,不是吗?
bcrypt is not an encryption function, it's a password hashing function. Hashing is mathematical one-way functions, meaning there is no* way to reverse the output string to get the input string.

*of course only Siths deal in absolutes and there are a few attacks against hashes. But none of them are "reversing" the hashing.

create a password:

const salt = bcrypt.genSaltSync(+20);
const generatedPassword = bcrypt.hashSync(data, salt);

we can compare a hash password 
data=Test@123
hash=******
ex:const comparePassword = bcrypt.compareSync(data, hash);
You will get your password is matched or not
bcrypt is not an encryption function, it's a password hashing function. Hashing is mathematical one-way functions, meaning there is no* way to reverse the output string to get the input string.

*of course only Siths deal in absolutes and there are a few attacks against hashes. But none of them are "reversing" the hashing.

create a password:

const salt = bcrypt.genSaltSync(+20);
const generatedPassword = bcrypt.hashSync(data, salt);

we can compare a hash password 
data=Test@123
hash=******
ex:const comparePassword = bcrypt.compareSync(data, hash);
You will get your password is matched or not