vitess.io/vitess@v0.16.2/go/acl/deny_all_policy.go (about) 1 /* 2 Copyright 2019 The Vitess Authors. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package acl 18 19 import ( 20 "errors" 21 "net/http" 22 ) 23 24 var errDenyAll = errors.New("not allowed: deny-all security_policy enforced") 25 26 // denyAllPolicy rejects all access. 27 type denyAllPolicy struct{} 28 29 // CheckAccessActor disallows all actor access. 30 func (denyAllPolicy) CheckAccessActor(actor, role string) error { 31 return errDenyAll 32 } 33 34 // CheckAccessHTTP disallows all HTTP access. 35 func (denyAllPolicy) CheckAccessHTTP(req *http.Request, role string) error { 36 return errDenyAll 37 } 38 39 func init() { 40 RegisterPolicy("deny-all", denyAllPolicy{}) 41 }