definition

package
v0.0.0-...-3c4c4c4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 30, 2025 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Overview

Package definition is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	Name = "authentication.v1"
)

Variables

View Source
var AuthenticationV1_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "authentication.AuthenticationV1",
	HandlerType: (*AuthenticationV1Server)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Validate",
			Handler:    _AuthenticationV1_Validate_Handler,
		},
		{
			MethodName: "CreateToken",
			Handler:    _AuthenticationV1_CreateToken_Handler,
		},
		{
			MethodName: "Identity",
			Handler:    _AuthenticationV1_Identity_Handler,
		},
		{
			MethodName: "Login",
			Handler:    _AuthenticationV1_Login_Handler,
		},
		{
			MethodName: "Logout",
			Handler:    _AuthenticationV1_Logout_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "integrations/authentication/v1/definition/definition.proto",
}

AuthenticationV1_ServiceDesc is the grpc.ServiceDesc for AuthenticationV1 service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

View Source
var File_integrations_authentication_v1_definition_definition_proto protoreflect.FileDescriptor

Functions

func NewFetcher

func NewFetcher(client AuthenticationV1Client, user string, roles ...string) cache.ObjectFetcher[string]

func NewRootRequestModifier

func NewRootRequestModifier(client AuthenticationV1Client) connection.Authentication

func RegisterAuthenticationV1Handler

func RegisterAuthenticationV1Handler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterAuthenticationV1Handler registers the http handlers for service AuthenticationV1 to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterAuthenticationV1HandlerClient

func RegisterAuthenticationV1HandlerClient(ctx context.Context, mux *runtime.ServeMux, client AuthenticationV1Client) error

RegisterAuthenticationV1HandlerClient registers the http handlers for service AuthenticationV1 to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "AuthenticationV1Client". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "AuthenticationV1Client" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "AuthenticationV1Client" to call the correct interceptors. This client ignores the HTTP middlewares.

func RegisterAuthenticationV1HandlerFromEndpoint

func RegisterAuthenticationV1HandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterAuthenticationV1HandlerFromEndpoint is same as RegisterAuthenticationV1Handler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterAuthenticationV1HandlerServer

func RegisterAuthenticationV1HandlerServer(ctx context.Context, mux *runtime.ServeMux, server AuthenticationV1Server) error

RegisterAuthenticationV1HandlerServer registers the http handlers for service AuthenticationV1 to "mux". UnaryRPC :call AuthenticationV1Server directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterAuthenticationV1HandlerFromEndpoint instead. GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call.

func RegisterAuthenticationV1Server

func RegisterAuthenticationV1Server(s grpc.ServiceRegistrar, srv AuthenticationV1Server)

Types

type AuthenticationV1Client

type AuthenticationV1Client interface {
	// Validate and ensure that Authentication details are valid returns information about the user
	Validate(ctx context.Context, in *ValidateRequest, opts ...grpc.CallOption) (*ValidateResponse, error)
	// CreateToken creates a token for the specified user
	CreateToken(ctx context.Context, in *CreateTokenRequest, opts ...grpc.CallOption) (*CreateTokenResponse, error)
	// Identity extracts the identity from the request
	Identity(ctx context.Context, in *definition.Empty, opts ...grpc.CallOption) (*IdentityResponse, error)
	// Login calls /_open/auth endpoint to create JWT Token. Optionally, sets the header.
	Login(ctx context.Context, in *LoginRequest, opts ...grpc.CallOption) (*LoginResponse, error)
	// Logout ensures that credentials and cookies are removed
	Logout(ctx context.Context, in *LogoutRequest, opts ...grpc.CallOption) (*definition.Empty, error)
}

AuthenticationV1Client is the client API for AuthenticationV1 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 AuthenticationV1Server

type AuthenticationV1Server interface {
	// Validate and ensure that Authentication details are valid returns information about the user
	Validate(context.Context, *ValidateRequest) (*ValidateResponse, error)
	// CreateToken creates a token for the specified user
	CreateToken(context.Context, *CreateTokenRequest) (*CreateTokenResponse, error)
	// Identity extracts the identity from the request
	Identity(context.Context, *definition.Empty) (*IdentityResponse, error)
	// Login calls /_open/auth endpoint to create JWT Token. Optionally, sets the header.
	Login(context.Context, *LoginRequest) (*LoginResponse, error)
	// Logout ensures that credentials and cookies are removed
	Logout(context.Context, *LogoutRequest) (*definition.Empty, error)
	// contains filtered or unexported methods
}

AuthenticationV1Server is the server API for AuthenticationV1 service. All implementations must embed UnimplementedAuthenticationV1Server for forward compatibility

type CreateTokenRequest

type CreateTokenRequest struct {

	// lifetime specifies the lifetime of the token as duration. Defaults to 1 hour
	Lifetime *durationpb.Duration `protobuf:"bytes,1,opt,name=lifetime,proto3,oneof" json:"lifetime,omitempty"`
	// user specify the User for which token should be created. By default, the default user is used (root in most cases)
	User *string `protobuf:"bytes,2,opt,name=user,proto3,oneof" json:"user,omitempty"`
	// roles specify list of the roles assigned to the token
	Roles []string `protobuf:"bytes,3,rep,name=roles,proto3" json:"roles,omitempty"`
	// contains filtered or unexported fields
}

CreateTokenRequest defines request for AuthenticationV1 CreateToken Request

func (*CreateTokenRequest) Descriptor deprecated

func (*CreateTokenRequest) Descriptor() ([]byte, []int)

Deprecated: Use CreateTokenRequest.ProtoReflect.Descriptor instead.

func (*CreateTokenRequest) GetLifetime

func (x *CreateTokenRequest) GetLifetime() *durationpb.Duration

func (*CreateTokenRequest) GetRoles

func (x *CreateTokenRequest) GetRoles() []string

func (*CreateTokenRequest) GetUser

func (x *CreateTokenRequest) GetUser() string

func (*CreateTokenRequest) ProtoMessage

func (*CreateTokenRequest) ProtoMessage()

func (*CreateTokenRequest) ProtoReflect

func (x *CreateTokenRequest) ProtoReflect() protoreflect.Message

func (*CreateTokenRequest) Reset

func (x *CreateTokenRequest) Reset()

func (*CreateTokenRequest) String

func (x *CreateTokenRequest) String() string

type CreateTokenResponse

type CreateTokenResponse struct {

	// lifetime specify the lifetime of the token as the duration
	Lifetime *durationpb.Duration `protobuf:"bytes,1,opt,name=lifetime,proto3" json:"lifetime,omitempty"`
	// user returns the User used in the Token
	User string `protobuf:"bytes,2,opt,name=user,proto3" json:"user,omitempty"`
	// token returns the Token as a string
	Token string `protobuf:"bytes,3,opt,name=token,proto3" json:"token,omitempty"`
	// roles specify list of the roles assigned to the token
	Roles []string `protobuf:"bytes,4,rep,name=roles,proto3" json:"roles,omitempty"`
	// contains filtered or unexported fields
}

CreateTokenResponse defines response for AuthenticationV1 CreateToken Request

func (*CreateTokenResponse) Descriptor deprecated

func (*CreateTokenResponse) Descriptor() ([]byte, []int)

Deprecated: Use CreateTokenResponse.ProtoReflect.Descriptor instead.

func (*CreateTokenResponse) GetLifetime

func (x *CreateTokenResponse) GetLifetime() *durationpb.Duration

func (*CreateTokenResponse) GetRoles

func (x *CreateTokenResponse) GetRoles() []string

func (*CreateTokenResponse) GetToken

func (x *CreateTokenResponse) GetToken() string

func (*CreateTokenResponse) GetUser

func (x *CreateTokenResponse) GetUser() string

func (*CreateTokenResponse) ProtoMessage

func (*CreateTokenResponse) ProtoMessage()

func (*CreateTokenResponse) ProtoReflect

func (x *CreateTokenResponse) ProtoReflect() protoreflect.Message

func (*CreateTokenResponse) Reset

func (x *CreateTokenResponse) Reset()

func (*CreateTokenResponse) String

func (x *CreateTokenResponse) String() string

type IdentityResponse

type IdentityResponse struct {

	// user returns the User used in the Token. If a user is not specified, `root` is returned
	User string `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"`
	// contains filtered or unexported fields
}

IdentityResponse defines response for AuthenticationV1 Identity Request

func (*IdentityResponse) Descriptor deprecated

func (*IdentityResponse) Descriptor() ([]byte, []int)

Deprecated: Use IdentityResponse.ProtoReflect.Descriptor instead.

func (*IdentityResponse) GetUser

func (x *IdentityResponse) GetUser() string

func (*IdentityResponse) ProtoMessage

func (*IdentityResponse) ProtoMessage()

func (*IdentityResponse) ProtoReflect

func (x *IdentityResponse) ProtoReflect() protoreflect.Message

func (*IdentityResponse) Reset

func (x *IdentityResponse) Reset()

func (*IdentityResponse) String

func (x *IdentityResponse) String() string

type LoginRequest

type LoginRequest struct {

	// credentials defines the login credentials
	Credentials *LoginRequestCredentials `protobuf:"bytes,1,opt,name=credentials,proto3" json:"credentials,omitempty"`
	// options define the login request options
	Options *LoginRequestOptions `protobuf:"bytes,2,opt,name=options,proto3" json:"options,omitempty"`
	// contains filtered or unexported fields
}

LoginRequest defines response for AuthenticationV1 Login Request

func (*LoginRequest) Descriptor deprecated

func (*LoginRequest) Descriptor() ([]byte, []int)

Deprecated: Use LoginRequest.ProtoReflect.Descriptor instead.

func (*LoginRequest) GetCredentials

func (x *LoginRequest) GetCredentials() *LoginRequestCredentials

func (*LoginRequest) GetOptions

func (x *LoginRequest) GetOptions() *LoginRequestOptions

func (*LoginRequest) ProtoMessage

func (*LoginRequest) ProtoMessage()

func (*LoginRequest) ProtoReflect

func (x *LoginRequest) ProtoReflect() protoreflect.Message

func (*LoginRequest) Reset

func (x *LoginRequest) Reset()

func (*LoginRequest) String

func (x *LoginRequest) String() string

type LoginRequestCredentials

type LoginRequestCredentials struct {

	// username defines user for the authentication
	Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username,omitempty"`
	// password defines password for the authentication
	Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"`
	// contains filtered or unexported fields
}

LoginRequestCredentials defines response for AuthenticationV1 Login Credentials Request

func (*LoginRequestCredentials) Descriptor deprecated

func (*LoginRequestCredentials) Descriptor() ([]byte, []int)

Deprecated: Use LoginRequestCredentials.ProtoReflect.Descriptor instead.

func (*LoginRequestCredentials) GetPassword

func (x *LoginRequestCredentials) GetPassword() string

func (*LoginRequestCredentials) GetUsername

func (x *LoginRequestCredentials) GetUsername() string

func (*LoginRequestCredentials) ProtoMessage

func (*LoginRequestCredentials) ProtoMessage()

func (*LoginRequestCredentials) ProtoReflect

func (x *LoginRequestCredentials) ProtoReflect() protoreflect.Message

func (*LoginRequestCredentials) Reset

func (x *LoginRequestCredentials) Reset()

func (*LoginRequestCredentials) String

func (x *LoginRequestCredentials) String() string

type LoginRequestOptions

type LoginRequestOptions struct {

	// cookies enables the cookie management
	Cookies *bool `protobuf:"varint,1,opt,name=cookies,proto3,oneof" json:"cookies,omitempty"`
	// contains filtered or unexported fields
}

LoginRequestCredentials defines response for AuthenticationV1 Login Options Request

func (*LoginRequestOptions) Descriptor deprecated

func (*LoginRequestOptions) Descriptor() ([]byte, []int)

Deprecated: Use LoginRequestOptions.ProtoReflect.Descriptor instead.

func (*LoginRequestOptions) GetCookies

func (x *LoginRequestOptions) GetCookies() bool

func (*LoginRequestOptions) ProtoMessage

func (*LoginRequestOptions) ProtoMessage()

func (*LoginRequestOptions) ProtoReflect

func (x *LoginRequestOptions) ProtoReflect() protoreflect.Message

func (*LoginRequestOptions) Reset

func (x *LoginRequestOptions) Reset()

func (*LoginRequestOptions) String

func (x *LoginRequestOptions) String() string

type LoginResponse

type LoginResponse struct {

	// token returns the JWT Token
	Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"`
	// contains filtered or unexported fields
}

LoginResponse defines response for AuthenticationV1 Login Response

func (*LoginResponse) Descriptor deprecated

func (*LoginResponse) Descriptor() ([]byte, []int)

Deprecated: Use LoginResponse.ProtoReflect.Descriptor instead.

func (*LoginResponse) GetToken

func (x *LoginResponse) GetToken() string

func (*LoginResponse) ProtoMessage

func (*LoginResponse) ProtoMessage()

func (*LoginResponse) ProtoReflect

func (x *LoginResponse) ProtoReflect() protoreflect.Message

func (*LoginResponse) Reset

func (x *LoginResponse) Reset()

func (*LoginResponse) String

func (x *LoginResponse) String() string

type LogoutRequest

type LogoutRequest struct {

	// location defines logout location - defaults to /
	Location *string `protobuf:"bytes,1,opt,name=location,proto3,oneof" json:"location,omitempty"`
	// contains filtered or unexported fields
}

LogoutRequest defines request for AuthenticationV1 Logout Request

func (*LogoutRequest) Descriptor deprecated

func (*LogoutRequest) Descriptor() ([]byte, []int)

Deprecated: Use LogoutRequest.ProtoReflect.Descriptor instead.

func (*LogoutRequest) GetLocation

func (x *LogoutRequest) GetLocation() string

func (*LogoutRequest) ProtoMessage

func (*LogoutRequest) ProtoMessage()

func (*LogoutRequest) ProtoReflect

func (x *LogoutRequest) ProtoReflect() protoreflect.Message

func (*LogoutRequest) Reset

func (x *LogoutRequest) Reset()

func (*LogoutRequest) String

func (x *LogoutRequest) String() string

type UnimplementedAuthenticationV1Server

type UnimplementedAuthenticationV1Server struct {
}

UnimplementedAuthenticationV1Server must be embedded to have forward compatible implementations.

func (UnimplementedAuthenticationV1Server) CreateToken

func (UnimplementedAuthenticationV1Server) Identity

func (UnimplementedAuthenticationV1Server) Login

func (UnimplementedAuthenticationV1Server) Logout

func (UnimplementedAuthenticationV1Server) Validate

type UnsafeAuthenticationV1Server

type UnsafeAuthenticationV1Server interface {
	// contains filtered or unexported methods
}

UnsafeAuthenticationV1Server may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to AuthenticationV1Server will result in compilation errors.

type ValidateRequest

type ValidateRequest struct {

	// token specifies a token extracted from the request or used currently
	Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"`
	// contains filtered or unexported fields
}

ValidateRequest defines request for AuthenticationV1 Validate Request

func (*ValidateRequest) Descriptor deprecated

func (*ValidateRequest) Descriptor() ([]byte, []int)

Deprecated: Use ValidateRequest.ProtoReflect.Descriptor instead.

func (*ValidateRequest) GetToken

func (x *ValidateRequest) GetToken() string

func (*ValidateRequest) ProtoMessage

func (*ValidateRequest) ProtoMessage()

func (*ValidateRequest) ProtoReflect

func (x *ValidateRequest) ProtoReflect() protoreflect.Message

func (*ValidateRequest) Reset

func (x *ValidateRequest) Reset()

func (*ValidateRequest) String

func (x *ValidateRequest) String() string

type ValidateResponse

type ValidateResponse struct {

	// is_valid returns information about the validity of the token
	IsValid bool `protobuf:"varint,1,opt,name=is_valid,json=isValid,proto3" json:"is_valid,omitempty"`
	// message message for the validation phase
	Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
	// details returns token details if the token is valid
	Details *ValidateResponseDetails `protobuf:"bytes,3,opt,name=details,proto3,oneof" json:"details,omitempty"`
	// contains filtered or unexported fields
}

ValidateResponse defines response for AuthenticationV1 Validate Request

func (*ValidateResponse) Descriptor deprecated

func (*ValidateResponse) Descriptor() ([]byte, []int)

Deprecated: Use ValidateResponse.ProtoReflect.Descriptor instead.

func (*ValidateResponse) GetDetails

func (x *ValidateResponse) GetDetails() *ValidateResponseDetails

func (*ValidateResponse) GetIsValid

func (x *ValidateResponse) GetIsValid() bool

func (*ValidateResponse) GetMessage

func (x *ValidateResponse) GetMessage() string

func (*ValidateResponse) ProtoMessage

func (*ValidateResponse) ProtoMessage()

func (*ValidateResponse) ProtoReflect

func (x *ValidateResponse) ProtoReflect() protoreflect.Message

func (*ValidateResponse) Reset

func (x *ValidateResponse) Reset()

func (*ValidateResponse) String

func (x *ValidateResponse) String() string

type ValidateResponseDetails

type ValidateResponseDetails struct {

	// lifetime specify the lifetime of the token
	Lifetime *durationpb.Duration `protobuf:"bytes,1,opt,name=lifetime,proto3" json:"lifetime,omitempty"`
	// user returns the User used in the Token. If a user is not specified, `root` is returned
	User string `protobuf:"bytes,2,opt,name=user,proto3" json:"user,omitempty"`
	// roles specify list of the roles assigned to the token
	Roles []string `protobuf:"bytes,3,rep,name=roles,proto3" json:"roles,omitempty"`
	// contains filtered or unexported fields
}

ValidateResponseDetails defines optional response for AuthenticationV1 Validate Request. Returned only if the Token provided in the request is valid.

func (*ValidateResponseDetails) Descriptor deprecated

func (*ValidateResponseDetails) Descriptor() ([]byte, []int)

Deprecated: Use ValidateResponseDetails.ProtoReflect.Descriptor instead.

func (*ValidateResponseDetails) GetLifetime

func (x *ValidateResponseDetails) GetLifetime() *durationpb.Duration

func (*ValidateResponseDetails) GetRoles

func (x *ValidateResponseDetails) GetRoles() []string

func (*ValidateResponseDetails) GetUser

func (x *ValidateResponseDetails) GetUser() string

func (*ValidateResponseDetails) ProtoMessage

func (*ValidateResponseDetails) ProtoMessage()

func (*ValidateResponseDetails) ProtoReflect

func (x *ValidateResponseDetails) ProtoReflect() protoreflect.Message

func (*ValidateResponseDetails) Reset

func (x *ValidateResponseDetails) Reset()

func (*ValidateResponseDetails) String

func (x *ValidateResponseDetails) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL