Auth Generate, make secret optional

This commit is contained in:
Ben Toogood 2020-04-01 17:20:02 +01:00
parent d577c32563
commit df8c0bb5e1
6 changed files with 79 additions and 59 deletions

View File

@ -32,7 +32,7 @@ type Auth interface {
// Options set for auth // Options set for auth
Options() Options Options() Options
// Generate a new account // Generate a new account
Generate(id, secret string, opts ...GenerateOption) (*Account, error) Generate(id string, opts ...GenerateOption) (*Account, error)
// Grant access to a resource // Grant access to a resource
Grant(role string, res *Resource) error Grant(role string, res *Resource) error
// Revoke access to a resource // Revoke access to a resource

View File

@ -34,12 +34,13 @@ func (n *noop) Options() Options {
} }
// Generate a new account // Generate a new account
func (n *noop) Generate(id, secret string, opts ...GenerateOption) (*Account, error) { func (n *noop) Generate(id string, opts ...GenerateOption) (*Account, error) {
options := NewGenerateOptions(opts...) options := NewGenerateOptions(opts...)
return &Account{ return &Account{
ID: id, ID: id,
Roles: options.Roles, Roles: options.Roles,
Secret: options.Secret,s
Metadata: options.Metadata, Metadata: options.Metadata,
}, nil }, nil
} }

View File

@ -82,10 +82,19 @@ type GenerateOptions struct {
Provider string Provider string
// Type of the account, e.g. user // Type of the account, e.g. user
Type string Type string
// Secret used to authenticate the account
Secret string
} }
type GenerateOption func(o *GenerateOptions) type GenerateOption func(o *GenerateOptions)
// WithSecret for the generated account
func WithSecret(s string) GenerateOption {
return func(o *GenerateOptions) {
o.Secret = s
}
}
// WithType for the generated account // WithType for the generated account
func WithType(t string) GenerateOption { func WithType(t string) GenerateOption {
return func(o *GenerateOptions) { return func(o *GenerateOptions) {

View File

@ -188,6 +188,7 @@ type Account struct {
Metadata map[string]string `protobuf:"bytes,4,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` Metadata map[string]string `protobuf:"bytes,4,rep,name=metadata,proto3" json:"metadata,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
Namespace string `protobuf:"bytes,5,opt,name=namespace,proto3" json:"namespace,omitempty"` Namespace string `protobuf:"bytes,5,opt,name=namespace,proto3" json:"namespace,omitempty"`
Provider string `protobuf:"bytes,6,opt,name=provider,proto3" json:"provider,omitempty"` Provider string `protobuf:"bytes,6,opt,name=provider,proto3" json:"provider,omitempty"`
Secret string `protobuf:"bytes,7,opt,name=secret,proto3" json:"secret,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"` XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"` XXX_sizecache int32 `json:"-"`
@ -260,6 +261,13 @@ func (m *Account) GetProvider() string {
return "" return ""
} }
func (m *Account) GetSecret() string {
if m != nil {
return m.Secret
}
return ""
}
type Resource struct { type Resource struct {
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"`
@ -1115,61 +1123,61 @@ func init() {
} }
var fileDescriptor_11312eec02fd5712 = []byte{ var fileDescriptor_11312eec02fd5712 = []byte{
// 888 bytes of a gzipped FileDescriptorProto // 896 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x56, 0x4b, 0x6f, 0xdb, 0x46, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x56, 0x4b, 0x6f, 0xdb, 0x46,
0x10, 0x36, 0x49, 0x89, 0x92, 0x47, 0x0f, 0x0b, 0x1b, 0xc7, 0x25, 0x98, 0x47, 0x1d, 0xa6, 0x28, 0x10, 0x36, 0x49, 0x89, 0x92, 0x47, 0x0f, 0x0b, 0x1b, 0x27, 0x25, 0x98, 0x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0x5b, 0xce, 0xc9, 0x46, 0xa0, 0xca, 0x1c, 0x6f, 0x04, 0xaa, 0x0d, 0xd7, 0x0e,
0x9d, 0x46, 0x9f, 0x86, 0x78, 0x6b, 0x8b, 0x37, 0xe2, 0x93, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x39, 0x56, 0x70, 0xdd, 0x06, 0x28, 0x3a, 0xc8, 0xed, 0x46, 0x9b, 0x0e, 0xf1, 0xc6, 0x16, 0x6f,
0xf3, 0xe0, 0x21, 0x51, 0x5e, 0x0a, 0x00, 0x00, 0xc7, 0xc7, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0x4b, 0x8f, 0xf4, 0x22, 0x76, 0x0a, 0x00, 0x00,
} }

View File

@ -39,6 +39,7 @@ message Account {
map<string, string> metadata = 4; map<string, string> metadata = 4;
string namespace = 5; string namespace = 5;
string provider = 6; string provider = 6;
string secret = 7;
} }
message Resource{ message Resource{

View File

@ -107,13 +107,13 @@ func (s *svc) Options() auth.Options {
} }
// Generate a new account // Generate a new account
func (s *svc) Generate(id, secret string, opts ...auth.GenerateOption) (*auth.Account, error) { func (s *svc) Generate(id string, opts ...auth.GenerateOption) (*auth.Account, error) {
options := auth.NewGenerateOptions(opts...) options := auth.NewGenerateOptions(opts...)
rsp, err := s.auth.Generate(context.TODO(), &pb.GenerateRequest{ rsp, err := s.auth.Generate(context.TODO(), &pb.GenerateRequest{
Id: id, Id: id,
Secret: secret,
Type: options.Type, Type: options.Type,
Secret: options.Secret,
Roles: options.Roles, Roles: options.Roles,
Metadata: options.Metadata, Metadata: options.Metadata,
Provider: options.Provider, Provider: options.Provider,
@ -321,6 +321,7 @@ func serializeAccount(a *pb.Account) *auth.Account {
return &auth.Account{ return &auth.Account{
ID: a.Id, ID: a.Id,
Roles: a.Roles, Roles: a.Roles,
Secret: a.Secret,
Metadata: a.Metadata, Metadata: a.Metadata,
Provider: a.Provider, Provider: a.Provider,
Namespace: a.Namespace, Namespace: a.Namespace,