Files
ca/api/pb/auth_grpc.pb.go
2026-10-21 20:56:44 -05:00

466 lines
18 KiB
Go

// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.2
// - protoc v7.36.2
// source: auth.proto
package pb
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
emptypb "google.golang.org/protobuf/types/known/emptypb"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
Auth_GetProviders_FullMethodName = "/pb.Auth/GetProviders"
Auth_GetUserToken_FullMethodName = "/pb.Auth/GetUserToken"
Auth_RevokeToken_FullMethodName = "/pb.Auth/RevokeToken"
Auth_Caller_FullMethodName = "/pb.Auth/Caller"
Auth_ExchangeCode_FullMethodName = "/pb.Auth/ExchangeCode"
Auth_SelectOrg_FullMethodName = "/pb.Auth/SelectOrg"
Auth_AuthenticateAPIKey_FullMethodName = "/pb.Auth/AuthenticateAPIKey"
Auth_GetAllowedMethods_FullMethodName = "/pb.Auth/GetAllowedMethods"
Auth_GetCallerScope_FullMethodName = "/pb.Auth/GetCallerScope"
)
// AuthClient is the client API for Auth service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type AuthClient interface {
// GetProviders returns the list of supported providers
GetProviders(ctx context.Context, in *AuthProvidersRequest, opts ...grpc.CallOption) (*AuthProvidersResponse, error)
// GetUserToken returns the user token info
GetUserToken(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*UserTokenResponse, error)
// RevokeToken revokes the user token
RevokeToken(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error)
// Caller returns the caller status.
Caller(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*CallerStatusResponse, error)
// ExchangeCode exchanges the one-time code for a token.
// The returned token only contains the Access Token.
// The client should call GetUserToken for full info.
ExchangeCode(ctx context.Context, in *ExchangeCodeRequest, opts ...grpc.CallOption) (*Token, error)
// SelectOrg verifies the caller's access to the org and returns a new
// token scoped to it. This is the only tenant request that carries OrgID.
SelectOrg(ctx context.Context, in *SelectOrgRequest, opts ...grpc.CallOption) (*UserTokenResponse, error)
// AuthenticateAPIKey returns the user token info.
// The caller must include the API key in the Authorization header
// with HMAC SHA256 signature of the request, using API key secret.
//
// Date: RFC3339 timestamp
// Authorization: APIKey {KeyID}:{signature}
// signature = Base64(HMAC-SHA256(secret, method + timestamp))
AuthenticateAPIKey(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*UserTokenResponse, error)
// GetAllowedMethods returns the allowed methods for the caller
GetAllowedMethods(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*ServiceAccessInfo, error)
// GetCallerScope returns the caller's resolved scope in the selected org:
// the org role, project roles, token scopes, and per method the roles
// and scopes it requires.
GetCallerScope(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*CallerScope, error)
}
type authClient struct {
cc grpc.ClientConnInterface
}
func NewAuthClient(cc grpc.ClientConnInterface) AuthClient {
return &authClient{cc}
}
func (c *authClient) GetProviders(ctx context.Context, in *AuthProvidersRequest, opts ...grpc.CallOption) (*AuthProvidersResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(AuthProvidersResponse)
err := c.cc.Invoke(ctx, Auth_GetProviders_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *authClient) GetUserToken(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*UserTokenResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(UserTokenResponse)
err := c.cc.Invoke(ctx, Auth_GetUserToken_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *authClient) RevokeToken(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*emptypb.Empty, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(emptypb.Empty)
err := c.cc.Invoke(ctx, Auth_RevokeToken_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *authClient) Caller(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*CallerStatusResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(CallerStatusResponse)
err := c.cc.Invoke(ctx, Auth_Caller_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *authClient) ExchangeCode(ctx context.Context, in *ExchangeCodeRequest, opts ...grpc.CallOption) (*Token, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(Token)
err := c.cc.Invoke(ctx, Auth_ExchangeCode_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *authClient) SelectOrg(ctx context.Context, in *SelectOrgRequest, opts ...grpc.CallOption) (*UserTokenResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(UserTokenResponse)
err := c.cc.Invoke(ctx, Auth_SelectOrg_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *authClient) AuthenticateAPIKey(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*UserTokenResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(UserTokenResponse)
err := c.cc.Invoke(ctx, Auth_AuthenticateAPIKey_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *authClient) GetAllowedMethods(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*ServiceAccessInfo, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ServiceAccessInfo)
err := c.cc.Invoke(ctx, Auth_GetAllowedMethods_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *authClient) GetCallerScope(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*CallerScope, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(CallerScope)
err := c.cc.Invoke(ctx, Auth_GetCallerScope_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// AuthServer is the server API for Auth service.
// All implementations should embed UnimplementedAuthServer
// for forward compatibility.
type AuthServer interface {
// GetProviders returns the list of supported providers
GetProviders(context.Context, *AuthProvidersRequest) (*AuthProvidersResponse, error)
// GetUserToken returns the user token info
GetUserToken(context.Context, *emptypb.Empty) (*UserTokenResponse, error)
// RevokeToken revokes the user token
RevokeToken(context.Context, *emptypb.Empty) (*emptypb.Empty, error)
// Caller returns the caller status.
Caller(context.Context, *emptypb.Empty) (*CallerStatusResponse, error)
// ExchangeCode exchanges the one-time code for a token.
// The returned token only contains the Access Token.
// The client should call GetUserToken for full info.
ExchangeCode(context.Context, *ExchangeCodeRequest) (*Token, error)
// SelectOrg verifies the caller's access to the org and returns a new
// token scoped to it. This is the only tenant request that carries OrgID.
SelectOrg(context.Context, *SelectOrgRequest) (*UserTokenResponse, error)
// AuthenticateAPIKey returns the user token info.
// The caller must include the API key in the Authorization header
// with HMAC SHA256 signature of the request, using API key secret.
//
// Date: RFC3339 timestamp
// Authorization: APIKey {KeyID}:{signature}
// signature = Base64(HMAC-SHA256(secret, method + timestamp))
AuthenticateAPIKey(context.Context, *emptypb.Empty) (*UserTokenResponse, error)
// GetAllowedMethods returns the allowed methods for the caller
GetAllowedMethods(context.Context, *emptypb.Empty) (*ServiceAccessInfo, error)
// GetCallerScope returns the caller's resolved scope in the selected org:
// the org role, project roles, token scopes, and per method the roles
// and scopes it requires.
GetCallerScope(context.Context, *emptypb.Empty) (*CallerScope, error)
}
// UnimplementedAuthServer should be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedAuthServer struct{}
func (UnimplementedAuthServer) GetProviders(context.Context, *AuthProvidersRequest) (*AuthProvidersResponse, error) {
return nil, status.Error(codes.Unimplemented, "method GetProviders not implemented")
}
func (UnimplementedAuthServer) GetUserToken(context.Context, *emptypb.Empty) (*UserTokenResponse, error) {
return nil, status.Error(codes.Unimplemented, "method GetUserToken not implemented")
}
func (UnimplementedAuthServer) RevokeToken(context.Context, *emptypb.Empty) (*emptypb.Empty, error) {
return nil, status.Error(codes.Unimplemented, "method RevokeToken not implemented")
}
func (UnimplementedAuthServer) Caller(context.Context, *emptypb.Empty) (*CallerStatusResponse, error) {
return nil, status.Error(codes.Unimplemented, "method Caller not implemented")
}
func (UnimplementedAuthServer) ExchangeCode(context.Context, *ExchangeCodeRequest) (*Token, error) {
return nil, status.Error(codes.Unimplemented, "method ExchangeCode not implemented")
}
func (UnimplementedAuthServer) SelectOrg(context.Context, *SelectOrgRequest) (*UserTokenResponse, error) {
return nil, status.Error(codes.Unimplemented, "method SelectOrg not implemented")
}
func (UnimplementedAuthServer) AuthenticateAPIKey(context.Context, *emptypb.Empty) (*UserTokenResponse, error) {
return nil, status.Error(codes.Unimplemented, "method AuthenticateAPIKey not implemented")
}
func (UnimplementedAuthServer) GetAllowedMethods(context.Context, *emptypb.Empty) (*ServiceAccessInfo, error) {
return nil, status.Error(codes.Unimplemented, "method GetAllowedMethods not implemented")
}
func (UnimplementedAuthServer) GetCallerScope(context.Context, *emptypb.Empty) (*CallerScope, error) {
return nil, status.Error(codes.Unimplemented, "method GetCallerScope not implemented")
}
func (UnimplementedAuthServer) testEmbeddedByValue() {}
// UnsafeAuthServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to AuthServer will
// result in compilation errors.
type UnsafeAuthServer interface {
mustEmbedUnimplementedAuthServer()
}
func RegisterAuthServer(s grpc.ServiceRegistrar, srv AuthServer) {
// If the following call panics, it indicates UnimplementedAuthServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&Auth_ServiceDesc, srv)
}
func _Auth_GetProviders_Handler(srv any, ctx context.Context, dec func(any) error, interceptor grpc.UnaryServerInterceptor) (any, error) {
in := new(AuthProvidersRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AuthServer).GetProviders(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Auth_GetProviders_FullMethodName,
}
handler := func(ctx context.Context, req any) (any, error) {
return srv.(AuthServer).GetProviders(ctx, req.(*AuthProvidersRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Auth_GetUserToken_Handler(srv any, ctx context.Context, dec func(any) error, interceptor grpc.UnaryServerInterceptor) (any, error) {
in := new(emptypb.Empty)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AuthServer).GetUserToken(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Auth_GetUserToken_FullMethodName,
}
handler := func(ctx context.Context, req any) (any, error) {
return srv.(AuthServer).GetUserToken(ctx, req.(*emptypb.Empty))
}
return interceptor(ctx, in, info, handler)
}
func _Auth_RevokeToken_Handler(srv any, ctx context.Context, dec func(any) error, interceptor grpc.UnaryServerInterceptor) (any, error) {
in := new(emptypb.Empty)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AuthServer).RevokeToken(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Auth_RevokeToken_FullMethodName,
}
handler := func(ctx context.Context, req any) (any, error) {
return srv.(AuthServer).RevokeToken(ctx, req.(*emptypb.Empty))
}
return interceptor(ctx, in, info, handler)
}
func _Auth_Caller_Handler(srv any, ctx context.Context, dec func(any) error, interceptor grpc.UnaryServerInterceptor) (any, error) {
in := new(emptypb.Empty)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AuthServer).Caller(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Auth_Caller_FullMethodName,
}
handler := func(ctx context.Context, req any) (any, error) {
return srv.(AuthServer).Caller(ctx, req.(*emptypb.Empty))
}
return interceptor(ctx, in, info, handler)
}
func _Auth_ExchangeCode_Handler(srv any, ctx context.Context, dec func(any) error, interceptor grpc.UnaryServerInterceptor) (any, error) {
in := new(ExchangeCodeRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AuthServer).ExchangeCode(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Auth_ExchangeCode_FullMethodName,
}
handler := func(ctx context.Context, req any) (any, error) {
return srv.(AuthServer).ExchangeCode(ctx, req.(*ExchangeCodeRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Auth_SelectOrg_Handler(srv any, ctx context.Context, dec func(any) error, interceptor grpc.UnaryServerInterceptor) (any, error) {
in := new(SelectOrgRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AuthServer).SelectOrg(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Auth_SelectOrg_FullMethodName,
}
handler := func(ctx context.Context, req any) (any, error) {
return srv.(AuthServer).SelectOrg(ctx, req.(*SelectOrgRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Auth_AuthenticateAPIKey_Handler(srv any, ctx context.Context, dec func(any) error, interceptor grpc.UnaryServerInterceptor) (any, error) {
in := new(emptypb.Empty)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AuthServer).AuthenticateAPIKey(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Auth_AuthenticateAPIKey_FullMethodName,
}
handler := func(ctx context.Context, req any) (any, error) {
return srv.(AuthServer).AuthenticateAPIKey(ctx, req.(*emptypb.Empty))
}
return interceptor(ctx, in, info, handler)
}
func _Auth_GetAllowedMethods_Handler(srv any, ctx context.Context, dec func(any) error, interceptor grpc.UnaryServerInterceptor) (any, error) {
in := new(emptypb.Empty)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AuthServer).GetAllowedMethods(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Auth_GetAllowedMethods_FullMethodName,
}
handler := func(ctx context.Context, req any) (any, error) {
return srv.(AuthServer).GetAllowedMethods(ctx, req.(*emptypb.Empty))
}
return interceptor(ctx, in, info, handler)
}
func _Auth_GetCallerScope_Handler(srv any, ctx context.Context, dec func(any) error, interceptor grpc.UnaryServerInterceptor) (any, error) {
in := new(emptypb.Empty)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AuthServer).GetCallerScope(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: Auth_GetCallerScope_FullMethodName,
}
handler := func(ctx context.Context, req any) (any, error) {
return srv.(AuthServer).GetCallerScope(ctx, req.(*emptypb.Empty))
}
return interceptor(ctx, in, info, handler)
}
// Auth_ServiceDesc is the grpc.ServiceDesc for Auth service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Auth_ServiceDesc = grpc.ServiceDesc{
ServiceName: "pb.Auth",
HandlerType: (*AuthServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "GetProviders",
Handler: _Auth_GetProviders_Handler,
},
{
MethodName: "GetUserToken",
Handler: _Auth_GetUserToken_Handler,
},
{
MethodName: "RevokeToken",
Handler: _Auth_RevokeToken_Handler,
},
{
MethodName: "Caller",
Handler: _Auth_Caller_Handler,
},
{
MethodName: "ExchangeCode",
Handler: _Auth_ExchangeCode_Handler,
},
{
MethodName: "SelectOrg",
Handler: _Auth_SelectOrg_Handler,
},
{
MethodName: "AuthenticateAPIKey",
Handler: _Auth_AuthenticateAPIKey_Handler,
},
{
MethodName: "GetAllowedMethods",
Handler: _Auth_GetAllowedMethods_Handler,
},
{
MethodName: "GetCallerScope",
Handler: _Auth_GetCallerScope_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "auth.proto",
}