我想将加密密码和解密密码从 React js 发送到 WSO2 IS 5.9.0?

I want to send encrypted password and decrypted password from react js to WSO2 IS 5.9.0?

我正在使用 React JS 作为前端,我想在使用

时将加密密码发送到 WSO2 IS 5.9.0
curl --location --request POST 'https://x.x.x.x/oauth2/token' \
--header 'Content-Type: text/plain' \
--header 'Authorization: Basic xxxx' \
--data-urlencode 'grant_type=password' \
--data-urlencode 'username=xxxxxxxxx' \
--data-urlencode 'password=abc12345' \
--data-urlencode 'scope=openid'

我想以加密形式发送密码,并在WSO2 IS端解密密码。 我该如何执行此操作......?

根据 OAuth spec,只有在客户端和服务器之间存在信任的情况下才能使用密码授权。

规范如下:

The resource owner password credentials (i.e., username and password) can be used directly as an authorization grant to obtain an access
token. The credentials should only be used when there is a high
degree of trust between the resource owner and the client (e.g., the
client is part of the device operating system or a highly privileged
application), and when other authorization grant types are not
available (such as an authorization code).

因此不建议在浏览器客户端中使用密码授予流程。

无法将密码以加密形式发送到 WSO2 IS 并在 WSO2-IS 端解密。看你是不是用的是OAuth2 Password Grant,这里你要把密码发回服务器,同理,用户已经输入了。鉴于您使用的是安全连接 (https),​​您实际上不需要在前端对其进行加密。

但是,强烈不建议使用密码授予,您应该考虑使用 OAuth 社区的 authorization code grant. You can refer to this [draft]OAuth 2.0 for Browser-Based Apps 以获得一些最佳实践。