auth: pass namespace options in auth service requests (#1800)

* auth: pass namespace options in auth service requests

* auth/service/proto: update field index

Co-authored-by: Asim Aslam <asim@aslam.me>
This commit is contained in:
ben-toogood 2020-07-07 08:30:25 +01:00 committed by GitHub
parent f5ed7e5833
commit 0a937745cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 232 additions and 69 deletions

View File

@ -228,6 +228,7 @@ func NewTokenOptions(opts ...TokenOption) TokenOptions {
type VerifyOptions struct { type VerifyOptions struct {
Context context.Context Context context.Context
Namespace string
} }
type VerifyOption func(o *VerifyOptions) type VerifyOption func(o *VerifyOptions)
@ -237,9 +238,15 @@ func VerifyContext(ctx context.Context) VerifyOption {
o.Context = ctx o.Context = ctx
} }
} }
func VerifyNamespace(ns string) VerifyOption {
return func(o *VerifyOptions) {
o.Namespace = ns
}
}
type RulesOptions struct { type RulesOptions struct {
Context context.Context Context context.Context
Namespace string
} }
type RulesOption func(o *RulesOptions) type RulesOption func(o *RulesOptions)
@ -249,3 +256,9 @@ func RulesContext(ctx context.Context) RulesOption {
o.Context = ctx o.Context = ctx
} }
} }
func RulesNamespace(ns string) RulesOption {
return func(o *RulesOptions) {
o.Namespace = ns
}
}

View File

@ -53,6 +53,7 @@ func (Access) EnumDescriptor() ([]byte, []int) {
} }
type ListAccountsRequest struct { type ListAccountsRequest struct {
Options *Options `protobuf:"bytes,1,opt,name=options,proto3" json:"options,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:"-"`
@ -83,6 +84,13 @@ func (m *ListAccountsRequest) XXX_DiscardUnknown() {
var xxx_messageInfo_ListAccountsRequest proto.InternalMessageInfo var xxx_messageInfo_ListAccountsRequest proto.InternalMessageInfo
func (m *ListAccountsRequest) GetOptions() *Options {
if m != nil {
return m.Options
}
return nil
}
type ListAccountsResponse struct { type ListAccountsResponse struct {
Accounts []*Account `protobuf:"bytes,1,rep,name=accounts,proto3" json:"accounts,omitempty"` Accounts []*Account `protobuf:"bytes,1,rep,name=accounts,proto3" json:"accounts,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
@ -326,6 +334,7 @@ type GenerateRequest struct {
Secret string `protobuf:"bytes,5,opt,name=secret,proto3" json:"secret,omitempty"` Secret string `protobuf:"bytes,5,opt,name=secret,proto3" json:"secret,omitempty"`
Type string `protobuf:"bytes,6,opt,name=type,proto3" json:"type,omitempty"` Type string `protobuf:"bytes,6,opt,name=type,proto3" json:"type,omitempty"`
Provider string `protobuf:"bytes,7,opt,name=provider,proto3" json:"provider,omitempty"` Provider string `protobuf:"bytes,7,opt,name=provider,proto3" json:"provider,omitempty"`
Options *Options `protobuf:"bytes,8,opt,name=options,proto3" json:"options,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:"-"`
@ -398,6 +407,13 @@ func (m *GenerateRequest) GetProvider() string {
return "" return ""
} }
func (m *GenerateRequest) GetOptions() *Options {
if m != nil {
return m.Options
}
return nil
}
type GenerateResponse struct { type GenerateResponse struct {
Account *Account `protobuf:"bytes,1,opt,name=account,proto3" json:"account,omitempty"` Account *Account `protobuf:"bytes,1,opt,name=account,proto3" json:"account,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
@ -440,6 +456,7 @@ func (m *GenerateResponse) GetAccount() *Account {
type GrantRequest struct { type GrantRequest struct {
Scope string `protobuf:"bytes,1,opt,name=scope,proto3" json:"scope,omitempty"` Scope string `protobuf:"bytes,1,opt,name=scope,proto3" json:"scope,omitempty"`
Resource *Resource `protobuf:"bytes,2,opt,name=resource,proto3" json:"resource,omitempty"` Resource *Resource `protobuf:"bytes,2,opt,name=resource,proto3" json:"resource,omitempty"`
Options *Options `protobuf:"bytes,3,opt,name=options,proto3" json:"options,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:"-"`
@ -484,6 +501,13 @@ func (m *GrantRequest) GetResource() *Resource {
return nil return nil
} }
func (m *GrantRequest) GetOptions() *Options {
if m != nil {
return m.Options
}
return nil
}
type GrantResponse struct { type GrantResponse struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"` XXX_unrecognized []byte `json:"-"`
@ -518,6 +542,7 @@ var xxx_messageInfo_GrantResponse proto.InternalMessageInfo
type RevokeRequest struct { type RevokeRequest struct {
Scope string `protobuf:"bytes,1,opt,name=scope,proto3" json:"scope,omitempty"` Scope string `protobuf:"bytes,1,opt,name=scope,proto3" json:"scope,omitempty"`
Resource *Resource `protobuf:"bytes,2,opt,name=resource,proto3" json:"resource,omitempty"` Resource *Resource `protobuf:"bytes,2,opt,name=resource,proto3" json:"resource,omitempty"`
Options *Options `protobuf:"bytes,3,opt,name=options,proto3" json:"options,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:"-"`
@ -562,6 +587,13 @@ func (m *RevokeRequest) GetResource() *Resource {
return nil return nil
} }
func (m *RevokeRequest) GetOptions() *Options {
if m != nil {
return m.Options
}
return nil
}
type RevokeResponse struct { type RevokeResponse struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"` XXX_unrecognized []byte `json:"-"`
@ -595,6 +627,7 @@ var xxx_messageInfo_RevokeResponse proto.InternalMessageInfo
type InspectRequest struct { type InspectRequest struct {
Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"`
Options *Options `protobuf:"bytes,2,opt,name=options,proto3" json:"options,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:"-"`
@ -632,6 +665,13 @@ func (m *InspectRequest) GetToken() string {
return "" return ""
} }
func (m *InspectRequest) GetOptions() *Options {
if m != nil {
return m.Options
}
return nil
}
type InspectResponse struct { type InspectResponse struct {
Account *Account `protobuf:"bytes,1,opt,name=account,proto3" json:"account,omitempty"` Account *Account `protobuf:"bytes,1,opt,name=account,proto3" json:"account,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
@ -676,6 +716,7 @@ type TokenRequest struct {
Secret string `protobuf:"bytes,2,opt,name=secret,proto3" json:"secret,omitempty"` Secret string `protobuf:"bytes,2,opt,name=secret,proto3" json:"secret,omitempty"`
RefreshToken string `protobuf:"bytes,3,opt,name=refresh_token,json=refreshToken,proto3" json:"refresh_token,omitempty"` RefreshToken string `protobuf:"bytes,3,opt,name=refresh_token,json=refreshToken,proto3" json:"refresh_token,omitempty"`
TokenExpiry int64 `protobuf:"varint,4,opt,name=token_expiry,json=tokenExpiry,proto3" json:"token_expiry,omitempty"` TokenExpiry int64 `protobuf:"varint,4,opt,name=token_expiry,json=tokenExpiry,proto3" json:"token_expiry,omitempty"`
Options *Options `protobuf:"bytes,5,opt,name=options,proto3" json:"options,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:"-"`
@ -734,6 +775,13 @@ func (m *TokenRequest) GetTokenExpiry() int64 {
return 0 return 0
} }
func (m *TokenRequest) GetOptions() *Options {
if m != nil {
return m.Options
}
return nil
}
type TokenResponse struct { type TokenResponse struct {
Token *Token `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` Token *Token `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
@ -844,8 +892,48 @@ func (m *Rule) GetPriority() int32 {
return 0 return 0
} }
type Options struct {
Namespace string `protobuf:"bytes,1,opt,name=namespace,proto3" json:"namespace,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *Options) Reset() { *m = Options{} }
func (m *Options) String() string { return proto.CompactTextString(m) }
func (*Options) ProtoMessage() {}
func (*Options) Descriptor() ([]byte, []int) {
return fileDescriptor_21300bfacc51fc2a, []int{16}
}
func (m *Options) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Options.Unmarshal(m, b)
}
func (m *Options) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_Options.Marshal(b, m, deterministic)
}
func (m *Options) XXX_Merge(src proto.Message) {
xxx_messageInfo_Options.Merge(m, src)
}
func (m *Options) XXX_Size() int {
return xxx_messageInfo_Options.Size(m)
}
func (m *Options) XXX_DiscardUnknown() {
xxx_messageInfo_Options.DiscardUnknown(m)
}
var xxx_messageInfo_Options proto.InternalMessageInfo
func (m *Options) GetNamespace() string {
if m != nil {
return m.Namespace
}
return ""
}
type CreateRequest struct { type CreateRequest struct {
Rule *Rule `protobuf:"bytes,1,opt,name=rule,proto3" json:"rule,omitempty"` Rule *Rule `protobuf:"bytes,1,opt,name=rule,proto3" json:"rule,omitempty"`
Options *Options `protobuf:"bytes,2,opt,name=options,proto3" json:"options,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:"-"`
@ -855,7 +943,7 @@ func (m *CreateRequest) Reset() { *m = CreateRequest{} }
func (m *CreateRequest) String() string { return proto.CompactTextString(m) } func (m *CreateRequest) String() string { return proto.CompactTextString(m) }
func (*CreateRequest) ProtoMessage() {} func (*CreateRequest) ProtoMessage() {}
func (*CreateRequest) Descriptor() ([]byte, []int) { func (*CreateRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_21300bfacc51fc2a, []int{16} return fileDescriptor_21300bfacc51fc2a, []int{17}
} }
func (m *CreateRequest) XXX_Unmarshal(b []byte) error { func (m *CreateRequest) XXX_Unmarshal(b []byte) error {
@ -883,6 +971,13 @@ func (m *CreateRequest) GetRule() *Rule {
return nil return nil
} }
func (m *CreateRequest) GetOptions() *Options {
if m != nil {
return m.Options
}
return nil
}
type CreateResponse struct { type CreateResponse struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"` XXX_unrecognized []byte `json:"-"`
@ -893,7 +988,7 @@ func (m *CreateResponse) Reset() { *m = CreateResponse{} }
func (m *CreateResponse) String() string { return proto.CompactTextString(m) } func (m *CreateResponse) String() string { return proto.CompactTextString(m) }
func (*CreateResponse) ProtoMessage() {} func (*CreateResponse) ProtoMessage() {}
func (*CreateResponse) Descriptor() ([]byte, []int) { func (*CreateResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_21300bfacc51fc2a, []int{17} return fileDescriptor_21300bfacc51fc2a, []int{18}
} }
func (m *CreateResponse) XXX_Unmarshal(b []byte) error { func (m *CreateResponse) XXX_Unmarshal(b []byte) error {
@ -916,6 +1011,7 @@ var xxx_messageInfo_CreateResponse proto.InternalMessageInfo
type DeleteRequest struct { type DeleteRequest struct {
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
Options *Options `protobuf:"bytes,2,opt,name=options,proto3" json:"options,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:"-"`
@ -925,7 +1021,7 @@ func (m *DeleteRequest) Reset() { *m = DeleteRequest{} }
func (m *DeleteRequest) String() string { return proto.CompactTextString(m) } func (m *DeleteRequest) String() string { return proto.CompactTextString(m) }
func (*DeleteRequest) ProtoMessage() {} func (*DeleteRequest) ProtoMessage() {}
func (*DeleteRequest) Descriptor() ([]byte, []int) { func (*DeleteRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_21300bfacc51fc2a, []int{18} return fileDescriptor_21300bfacc51fc2a, []int{19}
} }
func (m *DeleteRequest) XXX_Unmarshal(b []byte) error { func (m *DeleteRequest) XXX_Unmarshal(b []byte) error {
@ -953,6 +1049,13 @@ func (m *DeleteRequest) GetId() string {
return "" return ""
} }
func (m *DeleteRequest) GetOptions() *Options {
if m != nil {
return m.Options
}
return nil
}
type DeleteResponse struct { type DeleteResponse struct {
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"` XXX_unrecognized []byte `json:"-"`
@ -963,7 +1066,7 @@ func (m *DeleteResponse) Reset() { *m = DeleteResponse{} }
func (m *DeleteResponse) String() string { return proto.CompactTextString(m) } func (m *DeleteResponse) String() string { return proto.CompactTextString(m) }
func (*DeleteResponse) ProtoMessage() {} func (*DeleteResponse) ProtoMessage() {}
func (*DeleteResponse) Descriptor() ([]byte, []int) { func (*DeleteResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_21300bfacc51fc2a, []int{19} return fileDescriptor_21300bfacc51fc2a, []int{20}
} }
func (m *DeleteResponse) XXX_Unmarshal(b []byte) error { func (m *DeleteResponse) XXX_Unmarshal(b []byte) error {
@ -985,6 +1088,7 @@ func (m *DeleteResponse) XXX_DiscardUnknown() {
var xxx_messageInfo_DeleteResponse proto.InternalMessageInfo var xxx_messageInfo_DeleteResponse proto.InternalMessageInfo
type ListRequest struct { type ListRequest struct {
Options *Options `protobuf:"bytes,2,opt,name=options,proto3" json:"options,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:"-"`
@ -994,7 +1098,7 @@ func (m *ListRequest) Reset() { *m = ListRequest{} }
func (m *ListRequest) String() string { return proto.CompactTextString(m) } func (m *ListRequest) String() string { return proto.CompactTextString(m) }
func (*ListRequest) ProtoMessage() {} func (*ListRequest) ProtoMessage() {}
func (*ListRequest) Descriptor() ([]byte, []int) { func (*ListRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_21300bfacc51fc2a, []int{20} return fileDescriptor_21300bfacc51fc2a, []int{21}
} }
func (m *ListRequest) XXX_Unmarshal(b []byte) error { func (m *ListRequest) XXX_Unmarshal(b []byte) error {
@ -1015,6 +1119,13 @@ func (m *ListRequest) XXX_DiscardUnknown() {
var xxx_messageInfo_ListRequest proto.InternalMessageInfo var xxx_messageInfo_ListRequest proto.InternalMessageInfo
func (m *ListRequest) GetOptions() *Options {
if m != nil {
return m.Options
}
return nil
}
type ListResponse struct { type ListResponse struct {
Rules []*Rule `protobuf:"bytes,1,rep,name=rules,proto3" json:"rules,omitempty"` Rules []*Rule `protobuf:"bytes,1,rep,name=rules,proto3" json:"rules,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
@ -1026,7 +1137,7 @@ func (m *ListResponse) Reset() { *m = ListResponse{} }
func (m *ListResponse) String() string { return proto.CompactTextString(m) } func (m *ListResponse) String() string { return proto.CompactTextString(m) }
func (*ListResponse) ProtoMessage() {} func (*ListResponse) ProtoMessage() {}
func (*ListResponse) Descriptor() ([]byte, []int) { func (*ListResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_21300bfacc51fc2a, []int{21} return fileDescriptor_21300bfacc51fc2a, []int{22}
} }
func (m *ListResponse) XXX_Unmarshal(b []byte) error { func (m *ListResponse) XXX_Unmarshal(b []byte) error {
@ -1074,6 +1185,7 @@ func init() {
proto.RegisterType((*TokenRequest)(nil), "go.micro.auth.TokenRequest") proto.RegisterType((*TokenRequest)(nil), "go.micro.auth.TokenRequest")
proto.RegisterType((*TokenResponse)(nil), "go.micro.auth.TokenResponse") proto.RegisterType((*TokenResponse)(nil), "go.micro.auth.TokenResponse")
proto.RegisterType((*Rule)(nil), "go.micro.auth.Rule") proto.RegisterType((*Rule)(nil), "go.micro.auth.Rule")
proto.RegisterType((*Options)(nil), "go.micro.auth.Options")
proto.RegisterType((*CreateRequest)(nil), "go.micro.auth.CreateRequest") proto.RegisterType((*CreateRequest)(nil), "go.micro.auth.CreateRequest")
proto.RegisterType((*CreateResponse)(nil), "go.micro.auth.CreateResponse") proto.RegisterType((*CreateResponse)(nil), "go.micro.auth.CreateResponse")
proto.RegisterType((*DeleteRequest)(nil), "go.micro.auth.DeleteRequest") proto.RegisterType((*DeleteRequest)(nil), "go.micro.auth.DeleteRequest")
@ -1085,62 +1197,66 @@ func init() {
func init() { proto.RegisterFile("auth/service/proto/auth.proto", fileDescriptor_21300bfacc51fc2a) } func init() { proto.RegisterFile("auth/service/proto/auth.proto", fileDescriptor_21300bfacc51fc2a) }
var fileDescriptor_21300bfacc51fc2a = []byte{ var fileDescriptor_21300bfacc51fc2a = []byte{
// 872 bytes of a gzipped FileDescriptorProto // 944 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x56, 0x51, 0x8f, 0xdb, 0x44, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x56, 0x4f, 0x8f, 0xdb, 0x44,
0x10, 0x3e, 0x27, 0xb1, 0x93, 0x9b, 0xc4, 0x77, 0xd1, 0xf6, 0x5a, 0xac, 0x94, 0x6b, 0xaf, 0x2e, 0x14, 0x5f, 0xdb, 0xb1, 0x93, 0x7d, 0x49, 0x76, 0xa3, 0xe9, 0x52, 0xac, 0xb4, 0x5b, 0xb6, 0x2e,
0x82, 0xa3, 0x82, 0x1c, 0x4a, 0x5f, 0x0a, 0x7d, 0xe1, 0xd4, 0x44, 0xa1, 0x85, 0x06, 0x61, 0x15, 0x52, 0x97, 0x0a, 0xb2, 0x55, 0x7a, 0x01, 0x7a, 0x80, 0x55, 0x13, 0x85, 0x16, 0x9a, 0xaa, 0x56,
0x21, 0x90, 0x50, 0x65, 0x9c, 0x81, 0xb3, 0x2e, 0x67, 0x9b, 0xdd, 0xf5, 0x89, 0xbc, 0x20, 0xf1, 0x11, 0x5c, 0x50, 0x65, 0x9c, 0x07, 0x6b, 0x36, 0x6b, 0x9b, 0x99, 0xf1, 0x8a, 0x1c, 0x39, 0xc3,
0xc6, 0x8f, 0xe1, 0x27, 0xf1, 0xce, 0x1f, 0xe0, 0x07, 0x20, 0xef, 0xce, 0xba, 0xb1, 0xe3, 0x54, 0x47, 0xe1, 0xc0, 0x99, 0xcf, 0xc2, 0x9d, 0x2f, 0xc0, 0x07, 0x40, 0x9e, 0x3f, 0x5e, 0xdb, 0x71,
0x15, 0x88, 0x37, 0xcf, 0xec, 0xb7, 0xb3, 0xf3, 0x7d, 0x3b, 0x33, 0x6b, 0x38, 0x0e, 0x73, 0x79, 0xaa, 0x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0x76, 0xc8, 0x33, 0x68, 0xab, 0x9e, 0x27, 0x87, 0xb5, 0xe8, 0xea, 0x94,
0xf5, 0xb5, 0x15, 0xa8, 0x56, 0x5c, 0x7b, 0xec, 0x9c, 0xe8, 0x8e, 0x1a, 0xa8, 0x98, 0x20, 0xb7, 0x19, 0xde, 0xd9, 0xb4, 0x5c, 0x60, 0x4d, 0xf4, 0x33, 0xe9, 0x56, 0x63, 0xc3, 0x28, 0x9c, 0xdb,
0x1b, 0xd7, 0x4c, 0x88, 0x1f, 0x1c, 0xf5, 0xa3, 0xf5, 0xf0, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xcd, 0x8b, 0x1a, 0x65, 0xfc, 0x1d, 0x74, 0xf4, 0xab, 0x8d, 0xbc, 0x84, 0x56, 0x2e, 0x30, 0xf1,
0x52, 0x12, 0xc2, 0xdb, 0x89, 0x09, 0x00, 0x00, 0x6a, 0x7b, 0x1a, 0xde, 0x88, 0xc3, 0x7b, 0x6f, 0x8c, 0x29, 0xe0, 0xff, 0x36, 0xc0, 0xce, 0x2f,
0x82, 0x91, 0x19, 0x38, 0xb2, 0xea, 0x48, 0x3d, 0xa5, 0x4a, 0xe1, 0x0f, 0x0f, 0x37, 0xac, 0x16,
0xbc, 0x67, 0xe0, 0xc8, 0xca, 0x5a, 0x03, 0xaa, 0xd4, 0xf0, 0x1a, 0x50, 0xad, 0x1c, 0x77, 0xc8,
0xa9, 0xa2, 0x3b, 0x6c, 0xa0, 0xa2, 0x41, 0x6e, 0x35, 0xae, 0x69, 0x88, 0xef, 0x1d, 0xf1, 0xac,
0x7e, 0xf4, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xc8, 0x52, 0x98, 0x4d, 0x77, 0x0b, 0x00, 0x00,
} }
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.

View File

@ -19,6 +19,7 @@ service Rules {
} }
message ListAccountsRequest { message ListAccountsRequest {
Options options = 1;
} }
message ListAccountsResponse { message ListAccountsResponse {
@ -54,6 +55,7 @@ message GenerateRequest {
string secret = 5; string secret = 5;
string type = 6; string type = 6;
string provider = 7; string provider = 7;
Options options = 8;
} }
message GenerateResponse { message GenerateResponse {
@ -63,6 +65,7 @@ message GenerateResponse {
message GrantRequest { message GrantRequest {
string scope = 1; string scope = 1;
Resource resource = 2; Resource resource = 2;
Options options = 3;
} }
message GrantResponse {} message GrantResponse {}
@ -70,12 +73,14 @@ message GrantResponse {}
message RevokeRequest { message RevokeRequest {
string scope = 1; string scope = 1;
Resource resource = 2; Resource resource = 2;
Options options = 3;
} }
message RevokeResponse {} message RevokeResponse {}
message InspectRequest { message InspectRequest {
string token = 1; string token = 1;
Options options = 2;
} }
message InspectResponse { message InspectResponse {
@ -87,6 +92,7 @@ message TokenRequest {
string secret = 2; string secret = 2;
string refresh_token = 3; string refresh_token = 3;
int64 token_expiry = 4; int64 token_expiry = 4;
Options options = 5;
} }
message TokenResponse { message TokenResponse {
@ -107,19 +113,26 @@ message Rule {
int32 priority = 5; int32 priority = 5;
} }
message Options {
string namespace = 1;
}
message CreateRequest { message CreateRequest {
Rule rule = 1; Rule rule = 1;
Options options = 2;
} }
message CreateResponse {} message CreateResponse {}
message DeleteRequest { message DeleteRequest {
string id = 1; string id = 1;
Options options = 2;
} }
message DeleteResponse {} message DeleteResponse {}
message ListRequest { message ListRequest {
Options options = 2;
} }
message ListResponse { message ListResponse {

View File

@ -56,6 +56,9 @@ func (s *svc) Generate(id string, opts ...auth.GenerateOption) (*auth.Account, e
Scopes: options.Scopes, Scopes: options.Scopes,
Metadata: options.Metadata, Metadata: options.Metadata,
Provider: options.Provider, Provider: options.Provider,
Options: &pb.Options{
Namespace: s.Options().Issuer,
},
}, s.callOpts()...) }, s.callOpts()...)
if err != nil { if err != nil {
return nil, err return nil, err
@ -85,6 +88,9 @@ func (s *svc) Grant(rule *auth.Rule) error {
Endpoint: rule.Resource.Endpoint, Endpoint: rule.Resource.Endpoint,
}, },
}, },
Options: &pb.Options{
Namespace: s.Options().Issuer,
},
}, s.callOpts()...) }, s.callOpts()...)
return err return err
@ -93,7 +99,9 @@ func (s *svc) Grant(rule *auth.Rule) error {
// Revoke access to a resource // Revoke access to a resource
func (s *svc) Revoke(rule *auth.Rule) error { func (s *svc) Revoke(rule *auth.Rule) error {
_, err := s.rules.Delete(context.TODO(), &pb.DeleteRequest{ _, err := s.rules.Delete(context.TODO(), &pb.DeleteRequest{
Id: rule.ID, Id: rule.ID, Options: &pb.Options{
Namespace: s.Options().Issuer,
},
}, s.callOpts()...) }, s.callOpts()...)
return err return err
@ -107,9 +115,14 @@ func (s *svc) Rules(opts ...auth.RulesOption) ([]*auth.Rule, error) {
if options.Context == nil { if options.Context == nil {
options.Context = context.TODO() options.Context = context.TODO()
} }
if len(options.Namespace) == 0 {
options.Namespace = s.options.Issuer
}
callOpts := append(s.callOpts(), client.WithCache(time.Second*30)) callOpts := append(s.callOpts(), client.WithCache(time.Second*30))
rsp, err := s.rules.List(options.Context, &pb.ListRequest{}, callOpts...) rsp, err := s.rules.List(options.Context, &pb.ListRequest{
Options: &pb.Options{Namespace: options.Namespace},
}, callOpts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -129,7 +142,10 @@ func (s *svc) Verify(acc *auth.Account, res *auth.Resource, opts ...auth.VerifyO
o(&options) o(&options)
} }
rs, err := s.Rules(auth.RulesContext(options.Context)) rs, err := s.Rules(
auth.RulesContext(options.Context),
auth.RulesNamespace(options.Namespace),
)
if err != nil { if err != nil {
return err return err
} }
@ -146,7 +162,9 @@ func (s *svc) Inspect(token string) (*auth.Account, error) {
// the token is not a JWT or we do not have the keys to decode it, // the token is not a JWT or we do not have the keys to decode it,
// fall back to the auth service // fall back to the auth service
rsp, err := s.auth.Inspect(context.TODO(), &pb.InspectRequest{Token: token}, s.callOpts()...) rsp, err := s.auth.Inspect(context.TODO(), &pb.InspectRequest{
Token: token, Options: &pb.Options{Namespace: s.Options().Issuer},
}, s.callOpts()...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -162,6 +180,9 @@ func (s *svc) Token(opts ...auth.TokenOption) (*auth.Token, error) {
Secret: options.Secret, Secret: options.Secret,
RefreshToken: options.RefreshToken, RefreshToken: options.RefreshToken,
TokenExpiry: int64(options.Expiry.Seconds()), TokenExpiry: int64(options.Expiry.Seconds()),
Options: &pb.Options{
Namespace: s.Options().Issuer,
},
}, s.callOpts()...) }, s.callOpts()...)
if err != nil { if err != nil {
return nil, err return nil, err

View File

@ -10,7 +10,7 @@ import (
// Generate generates a service account for and continually // Generate generates a service account for and continually
// refreshes the access token. // refreshes the access token.
func Generate(id string, name string, a auth.Auth) error { func Generate(id, name string, a auth.Auth) error {
// extract the account creds from options, these can be set by flags // extract the account creds from options, these can be set by flags
accID := a.Options().ID accID := a.Options().ID
accSecret := a.Options().Secret accSecret := a.Options().Secret