mingyang-admin-iot-app/rpc/desc/app/auth.proto

61 lines
1.2 KiB
Protocol Buffer

syntax = "proto3";
package app;
option go_package = "./app";
import "google/protobuf/timestamp.proto";
// ClaimStrings 用于表示 JWT 中的 audience 字段
message ClaimStrings {
repeated string values = 1;
}
// NumericDate 使用 timestamp 表示 JWT 中的时间字段
message NumericDate {
google.protobuf.Timestamp timestamp = 1;
}
// RegisteredClaims 是 JWT 声明集的结构化版本
message RegisteredClaims {
// iss (Issuer) - 签发者
string issuer = 1;
// sub (Subject) - 主题
string subject = 2;
// aud (Audience) - 受众
ClaimStrings audience = 3;
// exp (Expiration Time) - 过期时间
NumericDate expires_at = 4;
// nbf (Not Before) - 生效时间
NumericDate not_before = 5;
// iat (Issued At) - 签发时间
NumericDate issued_at = 6;
// jti (JWT ID) - JWT ID
string id = 7;
}
// AuthInfoResp 是认证信息的响应
message AuthInfoResp {
uint64 user_id = 1;
string type = 2;
RegisteredClaims claims = 3;
}
message AuthReq {
string token = 1;
google.protobuf.Timestamp time = 2;
}
// App 服务定义
service App {
// 校验token
// group: auth
rpc AuthToken(AuthReq) returns (AuthInfoResp);
}