@@ -170,10 +170,10 @@ func NewAuthorizer(registry prometheus.Registerer) *RegoAuthorizer {
170
170
}
171
171
172
172
type authSubject struct {
173
- ID string `json:"id"`
174
- Roles []Role `json:"roles"`
175
- Groups []string `json:"groups"`
176
- Scope Role `json:"scope"`
173
+ ID string `json:"id"`
174
+ Roles []Role `json:"roles"`
175
+ Groups []string `json:"groups"`
176
+ Scope ScopeRole `json:"scope"`
177
177
}
178
178
179
179
// ByRoleName will expand all roleNames into roles before calling Authorize().
@@ -216,7 +216,7 @@ func (a RegoAuthorizer) ByRoleName(ctx context.Context, subjectID string, roleNa
216
216
217
217
// Authorize allows passing in custom Roles.
218
218
// This is really helpful for unit testing, as we can create custom roles to exercise edge cases.
219
- func (a RegoAuthorizer ) Authorize (ctx context.Context , subjectID string , roles []Role , scope Role , groups []string , action Action , object Object ) error {
219
+ func (a RegoAuthorizer ) Authorize (ctx context.Context , subjectID string , roles []Role , scope ScopeRole , groups []string , action Action , object Object ) error {
220
220
input := map [string ]interface {}{
221
221
"subject" : authSubject {
222
222
ID : subjectID ,
@@ -275,7 +275,7 @@ func (a RegoAuthorizer) PrepareByRoleName(ctx context.Context, subjectID string,
275
275
276
276
// Prepare will partially execute the rego policy leaving the object fields unknown (except for the type).
277
277
// This will vastly speed up performance if batch authorization on the same type of objects is needed.
278
- func (RegoAuthorizer ) Prepare (ctx context.Context , subjectID string , roles []Role , scope Role , groups []string , action Action , objectType string ) (* PartialAuthorizer , error ) {
278
+ func (RegoAuthorizer ) Prepare (ctx context.Context , subjectID string , roles []Role , scope ScopeRole , groups []string , action Action , objectType string ) (* PartialAuthorizer , error ) {
279
279
auth , err := newPartialAuthorizer (ctx , subjectID , roles , scope , groups , action , objectType )
280
280
if err != nil {
281
281
return nil , xerrors .Errorf ("new partial authorizer: %w" , err )
0 commit comments