Documentation ¶
Overview ¶
Package iam is a generated protocol buffer package.
It is generated from these files:
rpc/iam/service.proto
It has these top-level messages:
AuthReq AuthResp RefreshReq RefreshResp
Package iam is a generated twirp stub package. This code was generated with github.com/twitchtv/twirp/protoc-gen-twirp v5.4.1.
It is generated from these files:
rpc/iam/service.proto
Package iam is a generated protocol buffer package.
It is generated from these files:
rpc/iam/service.proto
It has these top-level messages:
AuthReq AuthResp RefreshReq RefreshResp
Index ¶
Constants ¶
const IAMPathPrefix = "/twirp/twisk.iam.IAM/"
IAMPathPrefix is used for all URL paths on a twirp IAM server. Requests are always: POST IAMPathPrefix/method It can be used in an HTTP mux to route twirp requests along with non-twirp requests on other routes.
Variables ¶
This section is empty.
Functions ¶
func WriteError ¶
func WriteError(resp http.ResponseWriter, err error)
WriteError writes an HTTP response with a valid Twirp error format. If err is not a twirp.Error, it will get wrapped with twirp.InternalErrorWith(err)
Types ¶
type AuthReq ¶
type AuthReq struct { // Required Auth string `protobuf:"bytes,1,opt,name=auth" json:"auth,omitempty"` // Required Password string `protobuf:"bytes,2,opt,name=password" json:"password,omitempty"` }
Password authentication request
func (*AuthReq) Descriptor ¶
func (*AuthReq) GetPassword ¶
func (*AuthReq) ProtoMessage ¶
func (*AuthReq) ProtoMessage()
type AuthResp ¶
type AuthResp struct { // Access token Token string `protobuf:"bytes,1,opt,name=token" json:"token,omitempty"` // Refresh token RefreshToken string `protobuf:"bytes,2,opt,name=refresh_token,json=refreshToken" json:"refresh_token,omitempty"` }
Password authentication response
func (*AuthResp) Descriptor ¶
func (*AuthResp) GetRefreshToken ¶
func (*AuthResp) ProtoMessage ¶
func (*AuthResp) ProtoMessage()
type HTTPClient ¶
HTTPClient is the interface used by generated clients to send HTTP requests. It is fulfilled by *(net/http).Client, which is sufficient for most users. Users can provide their own implementation for special retry policies.
HTTPClient implementations should not follow redirects. Redirects are automatically disabled if *(net/http).Client is passed to client constructors. See the withoutRedirects function in this file for more details.
type IAM ¶
type IAM interface { // Authenticate user by username or email and password Auth(context.Context, *AuthReq) (*AuthResp, error) // Refresh refreshes JWT token Refresh(context.Context, *RefreshReq) (*RefreshResp, error) }
IAM service handles user identity and access management
func NewIAMJSONClient ¶
func NewIAMJSONClient(addr string, client HTTPClient) IAM
NewIAMJSONClient creates a JSON client that implements the IAM interface. It communicates using JSON and can be configured with a custom HTTPClient.
func NewIAMProtobufClient ¶
func NewIAMProtobufClient(addr string, client HTTPClient) IAM
NewIAMProtobufClient creates a Protobuf client that implements the IAM interface. It communicates using Protobuf and can be configured with a custom HTTPClient.
type RefreshReq ¶
type RefreshReq struct { // Required Token string `protobuf:"bytes,1,opt,name=token" json:"token,omitempty"` }
Refresh token request
func (*RefreshReq) Descriptor ¶
func (*RefreshReq) Descriptor() ([]byte, []int)
func (*RefreshReq) GetToken ¶
func (m *RefreshReq) GetToken() string
func (*RefreshReq) ProtoMessage ¶
func (*RefreshReq) ProtoMessage()
func (*RefreshReq) Reset ¶
func (m *RefreshReq) Reset()
func (*RefreshReq) String ¶
func (m *RefreshReq) String() string
func (*RefreshReq) Validate ¶
func (this *RefreshReq) Validate() error
type RefreshResp ¶
type RefreshResp struct { // Access token Token string `protobuf:"bytes,1,opt,name=token" json:"token,omitempty"` }
Refresh token response
func (*RefreshResp) Descriptor ¶
func (*RefreshResp) Descriptor() ([]byte, []int)
func (*RefreshResp) GetToken ¶
func (m *RefreshResp) GetToken() string
func (*RefreshResp) ProtoMessage ¶
func (*RefreshResp) ProtoMessage()
func (*RefreshResp) Reset ¶
func (m *RefreshResp) Reset()
func (*RefreshResp) String ¶
func (m *RefreshResp) String() string
func (*RefreshResp) Validate ¶
func (this *RefreshResp) Validate() error
type TwirpServer ¶
type TwirpServer interface { http.Handler // ServiceDescriptor returns gzipped bytes describing the .proto file that // this service was generated from. Once unzipped, the bytes can be // unmarshalled as a // github.com/golang/protobuf/protoc-gen-go/descriptor.FileDescriptorProto. // // The returned integer is the index of this particular service within that // FileDescriptorProto's 'Service' slice of ServiceDescriptorProtos. This is a // low-level field, expected to be used for reflection. ServiceDescriptor() ([]byte, int) // ProtocGenTwirpVersion is the semantic version string of the version of // twirp used to generate this file. ProtocGenTwirpVersion() string }
TwirpServer is the interface generated server structs will support: they're HTTP handlers with additional methods for accessing metadata about the service. Those accessors are a low-level API for building reflection tools. Most people can think of TwirpServers as just http.Handlers.
func NewIAMServer ¶
func NewIAMServer(svc IAM, hooks *twirp.ServerHooks) TwirpServer