请教grpc 证书的单向认证和双向认证是怎样配置的,文档说明不详细 #3738
Unanswered
hisunny520
asked this question in
Q&A
Replies: 1 comment
-
只用过 inSecure,其他的查 grpc 文档吧。https://grpc.io/docs/guides/auth/#nodejs |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Describe the problem(描述问题)
2024-03-31 12:01:24.313 ERROR 14460 [-/::ffff:127.0.0.1/-/47ms GET /] Error: 1 CANCELLED: Call cancelled at callErrorFromStatus (E:\Projects\union\product-admin\user\node_modules\.pnpm\@grpc+grpc-js@1.10.3\node_modules\@grpc\grpc-js\src\call.ts:82:17)
Midway Versions(Midway 版本)
`import { MidwayAppInfo, MidwayConfig } from '@midwayjs/core';
import { ServerCredentials } from '@midwayjs/grpc';
import { readFileSync } from 'fs';
import { join } from 'path';
const cert = readFileSync(join(__dirname, './cert/server.crt'));
const pem = readFileSync(join(__dirname, './cert/server.pem'));
const key = readFileSync(join(__dirname, './cert/server.key'));
export default (appInfo: MidwayAppInfo): MidwayConfig => {
return {
// ...
grpcServer: {
// ...
credentials: ServerCredentials.createSsl(cert, [{ private_key: key, cert_chain: pem }]);
}
};
}`
文档的这个证书配置是服务端的,功能是客户端验证服务器?按文档一直不成功
如要只要服务器对客户端验证怎样配置或者双向认证呢?
Beta Was this translation helpful? Give feedback.
All reactions