luci: go.chromium.org/luci/tokenserver/api/minter/v1 Index | Files

package minter

import "go.chromium.org/luci/tokenserver/api/minter/v1"

Package minter contains the main API of the token server.

It is publicly accessible API used to mint various kinds of tokens.

Index

Package Files

gen.go pb.discovery.go token_minter.pb.go

Variables

var ErrorCode_name = map[int32]string{
    0:  "SUCCESS",
    1:  "UNSUPPORTED_SIGNATURE",
    2:  "UNSUPPORTED_TOKEN_TYPE",
    3:  "BAD_TIMESTAMP",
    4:  "BAD_CERTIFICATE_FORMAT",
    5:  "BAD_SIGNATURE",
    6:  "UNTRUSTED_CERTIFICATE",
    7:  "BAD_TOKEN_ARGUMENTS",
    8:  "MACHINE_TOKEN_MINTING_ERROR",
}
var ErrorCode_value = map[string]int32{
    "SUCCESS":                     0,
    "UNSUPPORTED_SIGNATURE":       1,
    "UNSUPPORTED_TOKEN_TYPE":      2,
    "BAD_TIMESTAMP":               3,
    "BAD_CERTIFICATE_FORMAT":      4,
    "BAD_SIGNATURE":               5,
    "UNTRUSTED_CERTIFICATE":       6,
    "BAD_TOKEN_ARGUMENTS":         7,
    "MACHINE_TOKEN_MINTING_ERROR": 8,
}
var SignatureAlgorithm_name = map[int32]string{
    0:  "UNKNOWN_ALGO",
    1:  "SHA256_RSA_ALGO",
}
var SignatureAlgorithm_value = map[string]int32{
    "UNKNOWN_ALGO":    0,
    "SHA256_RSA_ALGO": 1,
}

func FileDescriptorSet Uses

func FileDescriptorSet() *descriptor.FileDescriptorSet

FileDescriptorSet returns a descriptor set for this proto package, which includes all defined services, and all transitive dependencies.

Will not return nil.

Do NOT modify the returned descriptor.

func RegisterTokenMinterServer Uses

func RegisterTokenMinterServer(s prpc.Registrar, srv TokenMinterServer)

type ErrorCode Uses

type ErrorCode int32

Possible kinds of fatal errors.

Non fatal errors are returned as grpc.Internal errors instead.

const (
    ErrorCode_SUCCESS                     ErrorCode = 0
    ErrorCode_UNSUPPORTED_SIGNATURE       ErrorCode = 1
    ErrorCode_UNSUPPORTED_TOKEN_TYPE      ErrorCode = 2
    ErrorCode_BAD_TIMESTAMP               ErrorCode = 3
    ErrorCode_BAD_CERTIFICATE_FORMAT      ErrorCode = 4
    ErrorCode_BAD_SIGNATURE               ErrorCode = 5
    ErrorCode_UNTRUSTED_CERTIFICATE       ErrorCode = 6
    ErrorCode_BAD_TOKEN_ARGUMENTS         ErrorCode = 7
    ErrorCode_MACHINE_TOKEN_MINTING_ERROR ErrorCode = 8
)

func (ErrorCode) EnumDescriptor Uses

func (ErrorCode) EnumDescriptor() ([]byte, []int)

func (ErrorCode) String Uses

func (x ErrorCode) String() string

type LuciMachineToken Uses

type LuciMachineToken struct {
    MachineToken         string               `protobuf:"bytes,1,opt,name=machine_token,json=machineToken,proto3" json:"machine_token,omitempty"`
    Expiry               *timestamp.Timestamp `protobuf:"bytes,2,opt,name=expiry,proto3" json:"expiry,omitempty"`
    XXX_NoUnkeyedLiteral struct{}             `json:"-"`
    XXX_unrecognized     []byte               `json:"-"`
    XXX_sizecache        int32                `json:"-"`
}

LuciMachineToken is short lived machine token.

It is understood only by LUCI backends. It is a bearer token, that embeds machine hostname and details about the machine certificate it was issued for. It has short lifetime (usually 1h).

It is expected to be sent to backends in 'X-Luci-Machine-Token' HTTP header.

The token here is supposed to be treated as an opaque base64-encoded blob, but in reality it is serialized MachineTokenEnvelope, see machine_token.proto and read the comment there for more info about the token format.

func (*LuciMachineToken) Descriptor Uses

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

func (*LuciMachineToken) GetExpiry Uses

func (m *LuciMachineToken) GetExpiry() *timestamp.Timestamp

func (*LuciMachineToken) GetMachineToken Uses

func (m *LuciMachineToken) GetMachineToken() string

func (*LuciMachineToken) ProtoMessage Uses

func (*LuciMachineToken) ProtoMessage()

func (*LuciMachineToken) Reset Uses

func (m *LuciMachineToken) Reset()

func (*LuciMachineToken) String Uses

func (m *LuciMachineToken) String() string

func (*LuciMachineToken) XXX_DiscardUnknown Uses

func (m *LuciMachineToken) XXX_DiscardUnknown()

func (*LuciMachineToken) XXX_Marshal Uses

func (m *LuciMachineToken) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*LuciMachineToken) XXX_Merge Uses

func (m *LuciMachineToken) XXX_Merge(src proto.Message)

func (*LuciMachineToken) XXX_Size Uses

func (m *LuciMachineToken) XXX_Size() int

func (*LuciMachineToken) XXX_Unmarshal Uses

func (m *LuciMachineToken) XXX_Unmarshal(b []byte) error

type MachineTokenRequest Uses

type MachineTokenRequest struct {
    // The certificate that identifies a caller (as ASN1-serialized blob).
    //
    // It will be used to extract machine FQDN (it's CN of the cert) and CA name
    // to use to check the cert.
    Certificate []byte `protobuf:"bytes,1,opt,name=certificate,proto3" json:"certificate,omitempty"`
    // The signature algorithm used to sign this request.
    //
    // Defines what's in MintMachineTokenRequest.signature field.
    SignatureAlgorithm SignatureAlgorithm `protobuf:"varint,2,opt,name=signature_algorithm,json=signatureAlgorithm,proto3,enum=tokenserver.minter.SignatureAlgorithm" json:"signature_algorithm,omitempty"`
    // Timestamp when this request was created, by the issuer clock.
    IssuedAt *timestamp.Timestamp `protobuf:"bytes,3,opt,name=issued_at,json=issuedAt,proto3" json:"issued_at,omitempty"`
    // The token type being requested.
    //
    // Defines what fields of the response are set.
    TokenType            api.MachineTokenType `protobuf:"varint,4,opt,name=token_type,json=tokenType,proto3,enum=tokenserver.MachineTokenType" json:"token_type,omitempty"`
    XXX_NoUnkeyedLiteral struct{}             `json:"-"`
    XXX_unrecognized     []byte               `json:"-"`
    XXX_sizecache        int32                `json:"-"`
}

MachineTokenRequest contains the actual request parameters.

func (*MachineTokenRequest) Descriptor Uses

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

func (*MachineTokenRequest) GetCertificate Uses

func (m *MachineTokenRequest) GetCertificate() []byte

func (*MachineTokenRequest) GetIssuedAt Uses

func (m *MachineTokenRequest) GetIssuedAt() *timestamp.Timestamp

func (*MachineTokenRequest) GetSignatureAlgorithm Uses

func (m *MachineTokenRequest) GetSignatureAlgorithm() SignatureAlgorithm

func (*MachineTokenRequest) GetTokenType Uses

func (m *MachineTokenRequest) GetTokenType() api.MachineTokenType

func (*MachineTokenRequest) ProtoMessage Uses

func (*MachineTokenRequest) ProtoMessage()

func (*MachineTokenRequest) Reset Uses

func (m *MachineTokenRequest) Reset()

func (*MachineTokenRequest) String Uses

func (m *MachineTokenRequest) String() string

func (*MachineTokenRequest) XXX_DiscardUnknown Uses

func (m *MachineTokenRequest) XXX_DiscardUnknown()

func (*MachineTokenRequest) XXX_Marshal Uses

func (m *MachineTokenRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MachineTokenRequest) XXX_Merge Uses

func (m *MachineTokenRequest) XXX_Merge(src proto.Message)

func (*MachineTokenRequest) XXX_Size Uses

func (m *MachineTokenRequest) XXX_Size() int

func (*MachineTokenRequest) XXX_Unmarshal Uses

func (m *MachineTokenRequest) XXX_Unmarshal(b []byte) error

type MachineTokenResponse Uses

type MachineTokenResponse struct {
    // Identifier of the service and its version that produced the token.
    //
    // Has the form "<app-id>/<module-version>". Reported to the monitoring by
    // the client. This is _not_ a part of the token.
    ServiceVersion string `protobuf:"bytes,2,opt,name=service_version,json=serviceVersion,proto3" json:"service_version,omitempty"`
    // The generated token.
    //
    // The exact field set here depends on a requested type of the token, see
    // MachineTokenRequest.token_type.
    //
    // Types that are valid to be assigned to TokenType:
    //	*MachineTokenResponse_LuciMachineToken
    TokenType            isMachineTokenResponse_TokenType `protobuf_oneof:"token_type"`
    XXX_NoUnkeyedLiteral struct{}                         `json:"-"`
    XXX_unrecognized     []byte                           `json:"-"`
    XXX_sizecache        int32                            `json:"-"`
}

MachineTokenResponse contains a token requested by MachineTokenRequest.

func (*MachineTokenResponse) Descriptor Uses

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

func (*MachineTokenResponse) GetLuciMachineToken Uses

func (m *MachineTokenResponse) GetLuciMachineToken() *LuciMachineToken

func (*MachineTokenResponse) GetServiceVersion Uses

func (m *MachineTokenResponse) GetServiceVersion() string

func (*MachineTokenResponse) GetTokenType Uses

func (m *MachineTokenResponse) GetTokenType() isMachineTokenResponse_TokenType

func (*MachineTokenResponse) ProtoMessage Uses

func (*MachineTokenResponse) ProtoMessage()

func (*MachineTokenResponse) Reset Uses

func (m *MachineTokenResponse) Reset()

func (*MachineTokenResponse) String Uses

func (m *MachineTokenResponse) String() string

func (*MachineTokenResponse) XXX_DiscardUnknown Uses

func (m *MachineTokenResponse) XXX_DiscardUnknown()

func (*MachineTokenResponse) XXX_Marshal Uses

func (m *MachineTokenResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MachineTokenResponse) XXX_Merge Uses

func (m *MachineTokenResponse) XXX_Merge(src proto.Message)

func (*MachineTokenResponse) XXX_OneofWrappers Uses

func (*MachineTokenResponse) XXX_OneofWrappers() []interface{}

XXX_OneofWrappers is for the internal use of the proto package.

func (*MachineTokenResponse) XXX_Size Uses

func (m *MachineTokenResponse) XXX_Size() int

func (*MachineTokenResponse) XXX_Unmarshal Uses

func (m *MachineTokenResponse) XXX_Unmarshal(b []byte) error

type MachineTokenResponse_LuciMachineToken Uses

type MachineTokenResponse_LuciMachineToken struct {
    LuciMachineToken *LuciMachineToken `protobuf:"bytes,21,opt,name=luci_machine_token,json=luciMachineToken,proto3,oneof"`
}

type MintDelegationTokenRequest Uses

type MintDelegationTokenRequest struct {
    // Identity whose authority is delegated.
    //
    // A string of the form "user:<email>" or a special token "REQUESTOR" that
    // means to delegate caller's own identity. The token server will check its
    // ACLs to make sure the caller is authorized to impersonate this identity.
    //
    // Required.
    DelegatedIdentity string `protobuf:"bytes,1,opt,name=delegated_identity,json=delegatedIdentity,proto3" json:"delegated_identity,omitempty"`
    // How long the token should be considered valid (in seconds).
    //
    // Default is 3600 sec.
    ValidityDuration int64 `protobuf:"varint,2,opt,name=validity_duration,json=validityDuration,proto3" json:"validity_duration,omitempty"`
    // Who will be able to use the new token.
    //
    // Each item can be an identity string (e.g. "user:<email>"), a "group:<name>"
    // string, special "*" string which means "Any bearer can use the token", or
    // "REQUESTOR" string which means "Whoever is making this call can use the
    // token".
    //
    // This is semantically is a set, the order of elements doesn't matter.
    //
    // Required.
    Audience []string `protobuf:"bytes,3,rep,name=audience,proto3" json:"audience,omitempty"`
    // What services should accept the new token.
    //
    // List of LUCI services (specified as service identities, e.g.
    // "service:app-id" or as https:// root URLs e.g. "https://<host>") that
    // should accept this token. May also contain special "*" string, which
    // means "All LUCI services".
    //
    // This is semantically is a set, the order of elements doesn't matter.
    //
    // Required.
    Services []string `protobuf:"bytes,4,rep,name=services,proto3" json:"services,omitempty"`
    // Optional reason why the token is created.
    //
    // Used only for logging and auditing purposes. Doesn't become part of the
    // token.
    Intent string `protobuf:"bytes,5,opt,name=intent,proto3" json:"intent,omitempty"`
    // Arbitrary key:value pairs embedded into the token by whoever requested it.
    // Convey circumstance of why the token is created.
    //
    // Services that accept the token may use them for additional authorization
    // decisions. Please use extremely carefully, only when you control both sides
    // of the delegation link and can guarantee that services involved understand
    // the tags.
    Tags                 []string `protobuf:"bytes,6,rep,name=tags,proto3" json:"tags,omitempty"`
    XXX_NoUnkeyedLiteral struct{} `json:"-"`
    XXX_unrecognized     []byte   `json:"-"`
    XXX_sizecache        int32    `json:"-"`
}

MintDelegationTokenRequest is passed to MintDelegationToken.

func (*MintDelegationTokenRequest) Descriptor Uses

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

func (*MintDelegationTokenRequest) GetAudience Uses

func (m *MintDelegationTokenRequest) GetAudience() []string

func (*MintDelegationTokenRequest) GetDelegatedIdentity Uses

func (m *MintDelegationTokenRequest) GetDelegatedIdentity() string

func (*MintDelegationTokenRequest) GetIntent Uses

func (m *MintDelegationTokenRequest) GetIntent() string

func (*MintDelegationTokenRequest) GetServices Uses

func (m *MintDelegationTokenRequest) GetServices() []string

func (*MintDelegationTokenRequest) GetTags Uses

func (m *MintDelegationTokenRequest) GetTags() []string

func (*MintDelegationTokenRequest) GetValidityDuration Uses

func (m *MintDelegationTokenRequest) GetValidityDuration() int64

func (*MintDelegationTokenRequest) ProtoMessage Uses

func (*MintDelegationTokenRequest) ProtoMessage()

func (*MintDelegationTokenRequest) Reset Uses

func (m *MintDelegationTokenRequest) Reset()

func (*MintDelegationTokenRequest) String Uses

func (m *MintDelegationTokenRequest) String() string

func (*MintDelegationTokenRequest) XXX_DiscardUnknown Uses

func (m *MintDelegationTokenRequest) XXX_DiscardUnknown()

func (*MintDelegationTokenRequest) XXX_Marshal Uses

func (m *MintDelegationTokenRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MintDelegationTokenRequest) XXX_Merge Uses

func (m *MintDelegationTokenRequest) XXX_Merge(src proto.Message)

func (*MintDelegationTokenRequest) XXX_Size Uses

func (m *MintDelegationTokenRequest) XXX_Size() int

func (*MintDelegationTokenRequest) XXX_Unmarshal Uses

func (m *MintDelegationTokenRequest) XXX_Unmarshal(b []byte) error

type MintDelegationTokenResponse Uses

type MintDelegationTokenResponse struct {
    // The actual base64-encoded signed token.
    Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"`
    // Same data as in 'token' in deserialized form, just for convenience.
    //
    // Mostly for JSON encoding users, since they may not understand proto-encoded
    // tokens.
    DelegationSubtoken *messages.Subtoken `protobuf:"bytes,2,opt,name=delegation_subtoken,json=delegationSubtoken,proto3" json:"delegation_subtoken,omitempty"`
    // Identifier of the service and its version that produced the token.
    //
    // Has the form "<app-id>/<module-version>". This is _not_ part of the token.
    // Used only for logging and monitoring.
    ServiceVersion       string   `protobuf:"bytes,3,opt,name=service_version,json=serviceVersion,proto3" json:"service_version,omitempty"`
    XXX_NoUnkeyedLiteral struct{} `json:"-"`
    XXX_unrecognized     []byte   `json:"-"`
    XXX_sizecache        int32    `json:"-"`
}

MintDelegationTokenResponse is returned by MintDelegationToken on success.

Errors are returned via standard gRPC codes.

func (*MintDelegationTokenResponse) Descriptor Uses

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

func (*MintDelegationTokenResponse) GetDelegationSubtoken Uses

func (m *MintDelegationTokenResponse) GetDelegationSubtoken() *messages.Subtoken

func (*MintDelegationTokenResponse) GetServiceVersion Uses

func (m *MintDelegationTokenResponse) GetServiceVersion() string

func (*MintDelegationTokenResponse) GetToken Uses

func (m *MintDelegationTokenResponse) GetToken() string

func (*MintDelegationTokenResponse) ProtoMessage Uses

func (*MintDelegationTokenResponse) ProtoMessage()

func (*MintDelegationTokenResponse) Reset Uses

func (m *MintDelegationTokenResponse) Reset()

func (*MintDelegationTokenResponse) String Uses

func (m *MintDelegationTokenResponse) String() string

func (*MintDelegationTokenResponse) XXX_DiscardUnknown Uses

func (m *MintDelegationTokenResponse) XXX_DiscardUnknown()

func (*MintDelegationTokenResponse) XXX_Marshal Uses

func (m *MintDelegationTokenResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MintDelegationTokenResponse) XXX_Merge Uses

func (m *MintDelegationTokenResponse) XXX_Merge(src proto.Message)

func (*MintDelegationTokenResponse) XXX_Size Uses

func (m *MintDelegationTokenResponse) XXX_Size() int

func (*MintDelegationTokenResponse) XXX_Unmarshal Uses

func (m *MintDelegationTokenResponse) XXX_Unmarshal(b []byte) error

type MintMachineTokenRequest Uses

type MintMachineTokenRequest struct {
    // The protobuf-serialized MachineTokenRequest message, signed by the private
    // key that matches MachineTokenRequest.certificate.
    //
    // We have to send it as a byte blob to avoid dealing with possible protobuf
    // serialization inconsistencies when checking the signature.
    SerializedTokenRequest []byte `protobuf:"bytes,1,opt,name=serialized_token_request,json=serializedTokenRequest,proto3" json:"serialized_token_request,omitempty"`
    // The signature of 'serialized_token_parameters' blob.
    //
    // See MachineTokenRequest.signature_algorithm for exact meaning.
    Signature            []byte   `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"`
    XXX_NoUnkeyedLiteral struct{} `json:"-"`
    XXX_unrecognized     []byte   `json:"-"`
    XXX_sizecache        int32    `json:"-"`
}

MintMachineTokenRequest wraps a serialized and signed MachineTokenRequest message.

func (*MintMachineTokenRequest) Descriptor Uses

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

func (*MintMachineTokenRequest) GetSerializedTokenRequest Uses

func (m *MintMachineTokenRequest) GetSerializedTokenRequest() []byte

func (*MintMachineTokenRequest) GetSignature Uses

func (m *MintMachineTokenRequest) GetSignature() []byte

func (*MintMachineTokenRequest) ProtoMessage Uses

func (*MintMachineTokenRequest) ProtoMessage()

func (*MintMachineTokenRequest) Reset Uses

func (m *MintMachineTokenRequest) Reset()

func (*MintMachineTokenRequest) String Uses

func (m *MintMachineTokenRequest) String() string

func (*MintMachineTokenRequest) XXX_DiscardUnknown Uses

func (m *MintMachineTokenRequest) XXX_DiscardUnknown()

func (*MintMachineTokenRequest) XXX_Marshal Uses

func (m *MintMachineTokenRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MintMachineTokenRequest) XXX_Merge Uses

func (m *MintMachineTokenRequest) XXX_Merge(src proto.Message)

func (*MintMachineTokenRequest) XXX_Size Uses

func (m *MintMachineTokenRequest) XXX_Size() int

func (*MintMachineTokenRequest) XXX_Unmarshal Uses

func (m *MintMachineTokenRequest) XXX_Unmarshal(b []byte) error

type MintMachineTokenResponse Uses

type MintMachineTokenResponse struct {
    // Possible kinds of fatal errors.
    //
    // Non fatal errors are returned as grpc.Internal errors instead.
    ErrorCode ErrorCode `protobuf:"varint,1,opt,name=error_code,json=errorCode,proto3,enum=tokenserver.minter.ErrorCode" json:"error_code,omitempty"`
    // Optional detailed error message.
    ErrorMessage string `protobuf:"bytes,2,opt,name=error_message,json=errorMessage,proto3" json:"error_message,omitempty"`
    // On success (SUCCESS error code) contains the produced token.
    TokenResponse *MachineTokenResponse `protobuf:"bytes,3,opt,name=token_response,json=tokenResponse,proto3" json:"token_response,omitempty"`
    // Identifier of the service and its version that produced the response.
    //
    // Set for both successful responses and errors. On success, it is identical
    // to token_response.service_version.
    ServiceVersion       string   `protobuf:"bytes,4,opt,name=service_version,json=serviceVersion,proto3" json:"service_version,omitempty"`
    XXX_NoUnkeyedLiteral struct{} `json:"-"`
    XXX_unrecognized     []byte   `json:"-"`
    XXX_sizecache        int32    `json:"-"`
}

MintMachineTokenResponse is returned by MintMachineToken if the server processed the request.

It's returned even if server refuses to mint a token. It contains the error details in that case.

func (*MintMachineTokenResponse) Descriptor Uses

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

func (*MintMachineTokenResponse) GetErrorCode Uses

func (m *MintMachineTokenResponse) GetErrorCode() ErrorCode

func (*MintMachineTokenResponse) GetErrorMessage Uses

func (m *MintMachineTokenResponse) GetErrorMessage() string

func (*MintMachineTokenResponse) GetServiceVersion Uses

func (m *MintMachineTokenResponse) GetServiceVersion() string

func (*MintMachineTokenResponse) GetTokenResponse Uses

func (m *MintMachineTokenResponse) GetTokenResponse() *MachineTokenResponse

func (*MintMachineTokenResponse) ProtoMessage Uses

func (*MintMachineTokenResponse) ProtoMessage()

func (*MintMachineTokenResponse) Reset Uses

func (m *MintMachineTokenResponse) Reset()

func (*MintMachineTokenResponse) String Uses

func (m *MintMachineTokenResponse) String() string

func (*MintMachineTokenResponse) XXX_DiscardUnknown Uses

func (m *MintMachineTokenResponse) XXX_DiscardUnknown()

func (*MintMachineTokenResponse) XXX_Marshal Uses

func (m *MintMachineTokenResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MintMachineTokenResponse) XXX_Merge Uses

func (m *MintMachineTokenResponse) XXX_Merge(src proto.Message)

func (*MintMachineTokenResponse) XXX_Size Uses

func (m *MintMachineTokenResponse) XXX_Size() int

func (*MintMachineTokenResponse) XXX_Unmarshal Uses

func (m *MintMachineTokenResponse) XXX_Unmarshal(b []byte) error

type MintOAuthTokenGrantRequest Uses

type MintOAuthTokenGrantRequest struct {
    // Service account identity the end user wants to act as.
    //
    // A string of the form "user:<email>".
    //
    // Required.
    ServiceAccount string `protobuf:"bytes,1,opt,name=service_account,json=serviceAccount,proto3" json:"service_account,omitempty"`
    // How long the generated grant should be considered valid (in seconds).
    //
    // Default is 3600 sec.
    ValidityDuration int64 `protobuf:"varint,2,opt,name=validity_duration,json=validityDuration,proto3" json:"validity_duration,omitempty"`
    // An end user that wants to act as the service account (perhaps indirectly).
    //
    // A string of the form "user:<email>". On Swarming, this is an identity of
    // a user that posted the task.
    //
    // TODO(vadimsh): Verify that this user is present during MintOAuthTokenGrant
    // RPC by requiring the end user's credentials, e.g make Swarming forward
    // user's OAuth token to the token server, where it can be validated.
    //
    // Required.
    EndUser string `protobuf:"bytes,3,opt,name=end_user,json=endUser,proto3" json:"end_user,omitempty"`
    // Arbitrary key:value pairs describing circumstances of this call.
    //
    // Used only for logging and auditing purposes. Not involved in authorization
    // and don't become part of the grant.
    AuditTags            []string `protobuf:"bytes,4,rep,name=audit_tags,json=auditTags,proto3" json:"audit_tags,omitempty"`
    XXX_NoUnkeyedLiteral struct{} `json:"-"`
    XXX_unrecognized     []byte   `json:"-"`
    XXX_sizecache        int32    `json:"-"`
}

MintOAuthTokenGrantRequest is passed to MintOAuthTokenGrant.

Additional implicit field is the identity of whoever makes this call. It becomes 'wielder_identity' of the generated token.

func (*MintOAuthTokenGrantRequest) Descriptor Uses

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

func (*MintOAuthTokenGrantRequest) GetAuditTags Uses

func (m *MintOAuthTokenGrantRequest) GetAuditTags() []string

func (*MintOAuthTokenGrantRequest) GetEndUser Uses

func (m *MintOAuthTokenGrantRequest) GetEndUser() string

func (*MintOAuthTokenGrantRequest) GetServiceAccount Uses

func (m *MintOAuthTokenGrantRequest) GetServiceAccount() string

func (*MintOAuthTokenGrantRequest) GetValidityDuration Uses

func (m *MintOAuthTokenGrantRequest) GetValidityDuration() int64

func (*MintOAuthTokenGrantRequest) ProtoMessage Uses

func (*MintOAuthTokenGrantRequest) ProtoMessage()

func (*MintOAuthTokenGrantRequest) Reset Uses

func (m *MintOAuthTokenGrantRequest) Reset()

func (*MintOAuthTokenGrantRequest) String Uses

func (m *MintOAuthTokenGrantRequest) String() string

func (*MintOAuthTokenGrantRequest) XXX_DiscardUnknown Uses

func (m *MintOAuthTokenGrantRequest) XXX_DiscardUnknown()

func (*MintOAuthTokenGrantRequest) XXX_Marshal Uses

func (m *MintOAuthTokenGrantRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MintOAuthTokenGrantRequest) XXX_Merge Uses

func (m *MintOAuthTokenGrantRequest) XXX_Merge(src proto.Message)

func (*MintOAuthTokenGrantRequest) XXX_Size Uses

func (m *MintOAuthTokenGrantRequest) XXX_Size() int

func (*MintOAuthTokenGrantRequest) XXX_Unmarshal Uses

func (m *MintOAuthTokenGrantRequest) XXX_Unmarshal(b []byte) error

type MintOAuthTokenGrantResponse Uses

type MintOAuthTokenGrantResponse struct {
    GrantToken string               `protobuf:"bytes,1,opt,name=grant_token,json=grantToken,proto3" json:"grant_token,omitempty"`
    Expiry     *timestamp.Timestamp `protobuf:"bytes,2,opt,name=expiry,proto3" json:"expiry,omitempty"`
    // Identifier of the service and its version that produced the token.
    //
    // Has the form "<app-id>/<module-version>". This is _not_ part of the token.
    // Used only for logging and monitoring.
    ServiceVersion       string   `protobuf:"bytes,3,opt,name=service_version,json=serviceVersion,proto3" json:"service_version,omitempty"`
    XXX_NoUnkeyedLiteral struct{} `json:"-"`
    XXX_unrecognized     []byte   `json:"-"`
    XXX_sizecache        int32    `json:"-"`
}

MintOAuthTokenGrantResponse is returned by MintOAuthTokenGrant.

func (*MintOAuthTokenGrantResponse) Descriptor Uses

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

func (*MintOAuthTokenGrantResponse) GetExpiry Uses

func (m *MintOAuthTokenGrantResponse) GetExpiry() *timestamp.Timestamp

func (*MintOAuthTokenGrantResponse) GetGrantToken Uses

func (m *MintOAuthTokenGrantResponse) GetGrantToken() string

func (*MintOAuthTokenGrantResponse) GetServiceVersion Uses

func (m *MintOAuthTokenGrantResponse) GetServiceVersion() string

func (*MintOAuthTokenGrantResponse) ProtoMessage Uses

func (*MintOAuthTokenGrantResponse) ProtoMessage()

func (*MintOAuthTokenGrantResponse) Reset Uses

func (m *MintOAuthTokenGrantResponse) Reset()

func (*MintOAuthTokenGrantResponse) String Uses

func (m *MintOAuthTokenGrantResponse) String() string

func (*MintOAuthTokenGrantResponse) XXX_DiscardUnknown Uses

func (m *MintOAuthTokenGrantResponse) XXX_DiscardUnknown()

func (*MintOAuthTokenGrantResponse) XXX_Marshal Uses

func (m *MintOAuthTokenGrantResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MintOAuthTokenGrantResponse) XXX_Merge Uses

func (m *MintOAuthTokenGrantResponse) XXX_Merge(src proto.Message)

func (*MintOAuthTokenGrantResponse) XXX_Size Uses

func (m *MintOAuthTokenGrantResponse) XXX_Size() int

func (*MintOAuthTokenGrantResponse) XXX_Unmarshal Uses

func (m *MintOAuthTokenGrantResponse) XXX_Unmarshal(b []byte) error

type MintOAuthTokenViaGrantRequest Uses

type MintOAuthTokenViaGrantRequest struct {
    // A previously generated grant, as returned by MintOAuthTokenGrant.
    GrantToken string `protobuf:"bytes,1,opt,name=grant_token,json=grantToken,proto3" json:"grant_token,omitempty"`
    // The list of OAuth scopes the access token should have.
    //
    // The server may reject the request if some scopes are not allowed.
    OauthScope []string `protobuf:"bytes,2,rep,name=oauth_scope,json=oauthScope,proto3" json:"oauth_scope,omitempty"`
    // Minimally accepted validity duration of the returned OAuth token (seconds).
    //
    // The server may return a token that lives longer than this. The maximum is
    // 1h. An attempt to get a token that lives longer than 1h will result in
    // an error.
    //
    // The returned token validity duration doesn't depend on the lifetime of
    // the grant: it's possible to use a grant that expires in 1 sec to get an
    // access token that lives for 1h.
    //
    // Default is 300 sec.
    MinValidityDuration int64 `protobuf:"varint,3,opt,name=min_validity_duration,json=minValidityDuration,proto3" json:"min_validity_duration,omitempty"`
    // Arbitrary key:value pairs describing circumstances of this call.
    //
    // Used only for logging and auditing purposes. Not involved in authorization.
    AuditTags            []string `protobuf:"bytes,4,rep,name=audit_tags,json=auditTags,proto3" json:"audit_tags,omitempty"`
    XXX_NoUnkeyedLiteral struct{} `json:"-"`
    XXX_unrecognized     []byte   `json:"-"`
    XXX_sizecache        int32    `json:"-"`
}

MintOAuthTokenViaGrantRequest is passed to MintOAuthTokenViaGrant.

Additional implicit field is the identity of whoever makes this call. It is compared against 'wielder_identity' inside the token.

func (*MintOAuthTokenViaGrantRequest) Descriptor Uses

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

func (*MintOAuthTokenViaGrantRequest) GetAuditTags Uses

func (m *MintOAuthTokenViaGrantRequest) GetAuditTags() []string

func (*MintOAuthTokenViaGrantRequest) GetGrantToken Uses

func (m *MintOAuthTokenViaGrantRequest) GetGrantToken() string

func (*MintOAuthTokenViaGrantRequest) GetMinValidityDuration Uses

func (m *MintOAuthTokenViaGrantRequest) GetMinValidityDuration() int64

func (*MintOAuthTokenViaGrantRequest) GetOauthScope Uses

func (m *MintOAuthTokenViaGrantRequest) GetOauthScope() []string

func (*MintOAuthTokenViaGrantRequest) ProtoMessage Uses

func (*MintOAuthTokenViaGrantRequest) ProtoMessage()

func (*MintOAuthTokenViaGrantRequest) Reset Uses

func (m *MintOAuthTokenViaGrantRequest) Reset()

func (*MintOAuthTokenViaGrantRequest) String Uses

func (m *MintOAuthTokenViaGrantRequest) String() string

func (*MintOAuthTokenViaGrantRequest) XXX_DiscardUnknown Uses

func (m *MintOAuthTokenViaGrantRequest) XXX_DiscardUnknown()

func (*MintOAuthTokenViaGrantRequest) XXX_Marshal Uses

func (m *MintOAuthTokenViaGrantRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MintOAuthTokenViaGrantRequest) XXX_Merge Uses

func (m *MintOAuthTokenViaGrantRequest) XXX_Merge(src proto.Message)

func (*MintOAuthTokenViaGrantRequest) XXX_Size Uses

func (m *MintOAuthTokenViaGrantRequest) XXX_Size() int

func (*MintOAuthTokenViaGrantRequest) XXX_Unmarshal Uses

func (m *MintOAuthTokenViaGrantRequest) XXX_Unmarshal(b []byte) error

type MintOAuthTokenViaGrantResponse Uses

type MintOAuthTokenViaGrantResponse struct {
    AccessToken string               `protobuf:"bytes,1,opt,name=access_token,json=accessToken,proto3" json:"access_token,omitempty"`
    Expiry      *timestamp.Timestamp `protobuf:"bytes,2,opt,name=expiry,proto3" json:"expiry,omitempty"`
    // Identifier of the service and its version that produced the token.
    //
    // Has the form "<app-id>/<module-version>". Used only for logging and
    // monitoring.
    ServiceVersion       string   `protobuf:"bytes,3,opt,name=service_version,json=serviceVersion,proto3" json:"service_version,omitempty"`
    XXX_NoUnkeyedLiteral struct{} `json:"-"`
    XXX_unrecognized     []byte   `json:"-"`
    XXX_sizecache        int32    `json:"-"`
}

MintOAuthTokenViaGrantResponse is returned by MintOAuthTokenViaGrant.

func (*MintOAuthTokenViaGrantResponse) Descriptor Uses

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

func (*MintOAuthTokenViaGrantResponse) GetAccessToken Uses

func (m *MintOAuthTokenViaGrantResponse) GetAccessToken() string

func (*MintOAuthTokenViaGrantResponse) GetExpiry Uses

func (m *MintOAuthTokenViaGrantResponse) GetExpiry() *timestamp.Timestamp

func (*MintOAuthTokenViaGrantResponse) GetServiceVersion Uses

func (m *MintOAuthTokenViaGrantResponse) GetServiceVersion() string

func (*MintOAuthTokenViaGrantResponse) ProtoMessage Uses

func (*MintOAuthTokenViaGrantResponse) ProtoMessage()

func (*MintOAuthTokenViaGrantResponse) Reset Uses

func (m *MintOAuthTokenViaGrantResponse) Reset()

func (*MintOAuthTokenViaGrantResponse) String Uses

func (m *MintOAuthTokenViaGrantResponse) String() string

func (*MintOAuthTokenViaGrantResponse) XXX_DiscardUnknown Uses

func (m *MintOAuthTokenViaGrantResponse) XXX_DiscardUnknown()

func (*MintOAuthTokenViaGrantResponse) XXX_Marshal Uses

func (m *MintOAuthTokenViaGrantResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*MintOAuthTokenViaGrantResponse) XXX_Merge Uses

func (m *MintOAuthTokenViaGrantResponse) XXX_Merge(src proto.Message)

func (*MintOAuthTokenViaGrantResponse) XXX_Size Uses

func (m *MintOAuthTokenViaGrantResponse) XXX_Size() int

func (*MintOAuthTokenViaGrantResponse) XXX_Unmarshal Uses

func (m *MintOAuthTokenViaGrantResponse) XXX_Unmarshal(b []byte) error

type SignatureAlgorithm Uses

type SignatureAlgorithm int32

Supported ways of singing the request.

const (
    SignatureAlgorithm_UNKNOWN_ALGO    SignatureAlgorithm = 0
    SignatureAlgorithm_SHA256_RSA_ALGO SignatureAlgorithm = 1
)

func (SignatureAlgorithm) EnumDescriptor Uses

func (SignatureAlgorithm) EnumDescriptor() ([]byte, []int)

func (SignatureAlgorithm) String Uses

func (x SignatureAlgorithm) String() string

type TokenMinterClient Uses

type TokenMinterClient interface {
    // MintMachineToken generates a new token for an authenticated machine.
    //
    // It checks that provided certificate was signed by some trusted CA, and it
    // is still valid (non-expired and hasn't been revoked). It then checks that
    // the request was signed by the corresponding private key. Finally it checks
    // that the caller is authorized to generate requested kind of token.
    //
    // If everything checks out, it generates and returns a new machine token.
    //
    // On fatal error it returns detailed error response via same
    // MintMachineTokenResponse. On transient errors it returns generic
    // grpc.Internal error.
    MintMachineToken(ctx context.Context, in *MintMachineTokenRequest, opts ...grpc.CallOption) (*MintMachineTokenResponse, error)
    // MintDelegationToken generates a new bearer delegation token.
    //
    // Such token can be sent in 'X-Delegation-Token-V1' header (alongside regular
    // credentials like OAuth2 access token) to convey that the caller should be
    // authentication as 'delegated_identity' specified in the token.
    //
    // The delegation tokens are subject to multiple restrictions (embedded in
    // the token):
    //   * They have expiration time.
    //   * They are usable only if presented with a credential of someone from
    //     the 'audience' list.
    //   * They are usable only on services specified in the 'services' list.
    //
    // The token server must be configured in advance with all expected
    // combinations of (caller identity, delegated identity, audience, service)
    // tuples. See DelegationRule in config.proto.
    MintDelegationToken(ctx context.Context, in *MintDelegationTokenRequest, opts ...grpc.CallOption) (*MintDelegationTokenResponse, error)
    // MintOAuthTokenGrant generates a new grant for getting an OAuth2 token.
    //
    // This is a special (opaque for clients) token that asserts that the caller
    // at the time of the call was allowed to act as a particular service account
    // to perform a task authorized by an end-user.
    //
    // The returned grant can be used later (when the end-user is no longer
    // present) to get a real OAuth2 access token via MintOAuthTokenViaGrant call.
    //
    // This pair of RPCs is used to "delay" generation of service account OAuth
    // token until some later time, when it is actually needed. This is used by
    // Swarming:
    //   1. When the task is posted, Swarming calls MintOAuthTokenGrant to verify
    //      that the end-user is allowed to act as the requested service account
    //      on Swarming. On success, Swarming stores the grant in the task
    //      metadata.
    //   2. At a later time, when the task is executing and it needs an access
    //      token, Swarming calls MintOAuthTokenViaGrant to convert the grant into
    //      a real OAuth2 token.
    //
    // The returned grant can be used multiple times (as long as its validity
    // duration and the token server policy allows).
    //
    // The token server must be configured in advance with all expected
    // combinations of (caller identity, service account name, end users) tuples.
    // See ServiceAccountRule in config.proto.
    //
    // MintOAuthTokenGrant will check that the requested usage is allowed by the
    // rules. Later, MintOAuthTokenViaGrant will recheck this too.
    MintOAuthTokenGrant(ctx context.Context, in *MintOAuthTokenGrantRequest, opts ...grpc.CallOption) (*MintOAuthTokenGrantResponse, error)
    // MintOAuthTokenViaGrant converts an OAuth2 token grant into an access token.
    //
    // The grant must be previously generated by MintOAuthTokenGrant function, see
    // its docs for more details.
    MintOAuthTokenViaGrant(ctx context.Context, in *MintOAuthTokenViaGrantRequest, opts ...grpc.CallOption) (*MintOAuthTokenViaGrantResponse, error)
}

TokenMinterClient is the client API for TokenMinter service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewTokenMinterClient Uses

func NewTokenMinterClient(cc *grpc.ClientConn) TokenMinterClient

func NewTokenMinterPRPCClient Uses

func NewTokenMinterPRPCClient(client *prpc.Client) TokenMinterClient

type TokenMinterServer Uses

type TokenMinterServer interface {
    // MintMachineToken generates a new token for an authenticated machine.
    //
    // It checks that provided certificate was signed by some trusted CA, and it
    // is still valid (non-expired and hasn't been revoked). It then checks that
    // the request was signed by the corresponding private key. Finally it checks
    // that the caller is authorized to generate requested kind of token.
    //
    // If everything checks out, it generates and returns a new machine token.
    //
    // On fatal error it returns detailed error response via same
    // MintMachineTokenResponse. On transient errors it returns generic
    // grpc.Internal error.
    MintMachineToken(context.Context, *MintMachineTokenRequest) (*MintMachineTokenResponse, error)
    // MintDelegationToken generates a new bearer delegation token.
    //
    // Such token can be sent in 'X-Delegation-Token-V1' header (alongside regular
    // credentials like OAuth2 access token) to convey that the caller should be
    // authentication as 'delegated_identity' specified in the token.
    //
    // The delegation tokens are subject to multiple restrictions (embedded in
    // the token):
    //   * They have expiration time.
    //   * They are usable only if presented with a credential of someone from
    //     the 'audience' list.
    //   * They are usable only on services specified in the 'services' list.
    //
    // The token server must be configured in advance with all expected
    // combinations of (caller identity, delegated identity, audience, service)
    // tuples. See DelegationRule in config.proto.
    MintDelegationToken(context.Context, *MintDelegationTokenRequest) (*MintDelegationTokenResponse, error)
    // MintOAuthTokenGrant generates a new grant for getting an OAuth2 token.
    //
    // This is a special (opaque for clients) token that asserts that the caller
    // at the time of the call was allowed to act as a particular service account
    // to perform a task authorized by an end-user.
    //
    // The returned grant can be used later (when the end-user is no longer
    // present) to get a real OAuth2 access token via MintOAuthTokenViaGrant call.
    //
    // This pair of RPCs is used to "delay" generation of service account OAuth
    // token until some later time, when it is actually needed. This is used by
    // Swarming:
    //   1. When the task is posted, Swarming calls MintOAuthTokenGrant to verify
    //      that the end-user is allowed to act as the requested service account
    //      on Swarming. On success, Swarming stores the grant in the task
    //      metadata.
    //   2. At a later time, when the task is executing and it needs an access
    //      token, Swarming calls MintOAuthTokenViaGrant to convert the grant into
    //      a real OAuth2 token.
    //
    // The returned grant can be used multiple times (as long as its validity
    // duration and the token server policy allows).
    //
    // The token server must be configured in advance with all expected
    // combinations of (caller identity, service account name, end users) tuples.
    // See ServiceAccountRule in config.proto.
    //
    // MintOAuthTokenGrant will check that the requested usage is allowed by the
    // rules. Later, MintOAuthTokenViaGrant will recheck this too.
    MintOAuthTokenGrant(context.Context, *MintOAuthTokenGrantRequest) (*MintOAuthTokenGrantResponse, error)
    // MintOAuthTokenViaGrant converts an OAuth2 token grant into an access token.
    //
    // The grant must be previously generated by MintOAuthTokenGrant function, see
    // its docs for more details.
    MintOAuthTokenViaGrant(context.Context, *MintOAuthTokenViaGrantRequest) (*MintOAuthTokenViaGrantResponse, error)
}

TokenMinterServer is the server API for TokenMinter service.

Package minter imports 11 packages (graph) and is imported by 15 packages. Updated 2018-12-17. Refresh now. Tools for package owners.