Create & Init Project...

This commit is contained in:
2019-04-22 18:49:16 +08:00
commit fc4fa37393
25440 changed files with 4054998 additions and 0 deletions

View File

@@ -0,0 +1,58 @@
load(
"@io_bazel_rules_go//proto:def.bzl",
"go_proto_library",
)
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
proto_library(
name = "model_proto",
srcs = ["auth.proto"],
tags = ["automanaged"],
deps = ["@gogo_special_proto//github.com/gogo/protobuf/gogoproto"],
)
go_proto_library(
name = "model_go_proto",
compilers = ["@io_bazel_rules_go//proto:gogofast_proto"],
importmap = "go-common/app/service/main/passport-auth/model",
importpath = "go-common/app/service/main/passport-auth/model",
proto = ":model_proto",
tags = ["automanaged"],
deps = ["@com_github_gogo_protobuf//gogoproto:go_default_library"],
)
go_library(
name = "go_default_library",
srcs = [
"model.go",
"rpc.go",
],
embed = [":model_go_proto"],
importpath = "go-common/app/service/main/passport-auth/model",
tags = ["automanaged"],
visibility = ["//visibility:public"],
deps = [
"@com_github_gogo_protobuf//gogoproto:go_default_library",
"@com_github_golang_protobuf//proto:go_default_library",
],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,44 @@
syntax = "proto3";
package passport.service.auth;
option go_package = "model";
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
// AuthReply auth reply
message AuthReply {
// if cookie or token in life time, login is true
// else login is false and mid csrf expires is empty
bool Login = 1 [(gogoproto.jsontag) = "login"];
// user identify id
int64 Mid = 2 [(gogoproto.jsontag) = "mid"];
// use cookie request this field will return
// use token request ignore this field
string CSRF = 3 [(gogoproto.jsontag) = "csrf_token"];
// expiration date
// unix timestamp
int64 Expires = 4 [(gogoproto.jsontag) = "expires"];
}
message Cookie {
int64 Mid = 1 [(gogoproto.jsontag) = "mid"];
string Session = 2 [(gogoproto.jsontag) = "session"];
string CSRF = 3 [(gogoproto.jsontag) = "csrf"];
int64 Type = 4 [(gogoproto.jsontag) = "type"];
int64 Expires = 5 [(gogoproto.jsontag) = "expires"];
}
message Token {
int64 Mid = 1 [(gogoproto.jsontag) = "mid"];
int32 AppID = 2 [(gogoproto.jsontag) = "appid"];
string Token = 3 [(gogoproto.jsontag) = "token"];
int64 Type = 4 [(gogoproto.jsontag) = "type"];
int64 Expires = 5 [(gogoproto.jsontag) = "expires"];
}
message Refresh {
int64 Mid = 1 [(gogoproto.jsontag) = "mid"];
int32 AppID = 2 [(gogoproto.jsontag) = "appid"];
string Refresh = 3 [(gogoproto.jsontag) = "refresh"];
string Token = 4 [(gogoproto.jsontag) = "token"];
int64 Expires = 5 [(gogoproto.jsontag) = "expires"];
}

View File

@@ -0,0 +1,17 @@
package model
// RefreshTokenResp refreshToken response
type RefreshTokenResp struct {
Mid int64 `json:"mid"`
AccessToken string `json:"access_token"`
RefreshToken string `json:"refresh_token"`
Expires int64 `json:"expires"`
}
// CookieResp cookie response
type CookieResp struct {
Mid int64 `json:"mid"`
Session string `json:"session"`
CSRF string `json:"csrf"`
Expires int64 `json:"expires"`
}

View File

@@ -0,0 +1,7 @@
#! /bin/sh
# proto.sh
gopath=$GOPATH/src
gogopath=$GOPATH/src/go-common/vendor/github.com/gogo/protobuf
protoc --gofast_out=. --proto_path=$gopath:$gogopath:. *.proto

View File

@@ -0,0 +1,19 @@
package model
// ArgRefreshToken rpc refreshToken arg
type ArgRefreshToken struct {
AppID int32
RefreshToken string
}
// ArgToken rpc token arg.
type ArgToken struct {
AppID, SubID int32
Mid int64
}
// ArgCookie rpc cookie arg.
type ArgCookie struct {
Mid, Expires int64
PWD string
}