mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
authz: remove and hide unused and local-only methods respectively
Signed-off-by: David Sheets <dsheets@docker.com>
This commit is contained in:
parent
7da3986297
commit
24264697c5
1 changed files with 3 additions and 11 deletions
|
@ -25,20 +25,12 @@ func NewMiddleware(names []string, pg plugingetter.PluginGetter) *Middleware {
|
|||
}
|
||||
}
|
||||
|
||||
// GetAuthzPlugins gets authorization plugins
|
||||
func (m *Middleware) GetAuthzPlugins() []Plugin {
|
||||
func (m *Middleware) getAuthzPlugins() []Plugin {
|
||||
m.mu.Lock()
|
||||
defer m.mu.Unlock()
|
||||
return m.plugins
|
||||
}
|
||||
|
||||
// SetAuthzPlugins sets authorization plugins
|
||||
func (m *Middleware) SetAuthzPlugins(plugins []Plugin) {
|
||||
m.mu.Lock()
|
||||
m.plugins = plugins
|
||||
m.mu.Unlock()
|
||||
}
|
||||
|
||||
// SetPlugins sets the plugin used for authorization
|
||||
func (m *Middleware) SetPlugins(names []string) {
|
||||
m.mu.Lock()
|
||||
|
@ -62,7 +54,7 @@ func (m *Middleware) RemovePlugin(name string) {
|
|||
// WrapHandler returns a new handler function wrapping the previous one in the request chain.
|
||||
func (m *Middleware) WrapHandler(handler func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error) func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
|
||||
return func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
|
||||
plugins := m.GetAuthzPlugins()
|
||||
plugins := m.getAuthzPlugins()
|
||||
if len(plugins) == 0 {
|
||||
return handler(ctx, w, r, vars)
|
||||
}
|
||||
|
@ -96,7 +88,7 @@ func (m *Middleware) WrapHandler(handler func(ctx context.Context, w http.Respon
|
|||
|
||||
// There's a chance that the authCtx.plugins was updated. One of the reasons
|
||||
// this can happen is when an authzplugin is disabled.
|
||||
plugins = m.GetAuthzPlugins()
|
||||
plugins = m.getAuthzPlugins()
|
||||
if len(plugins) == 0 {
|
||||
logrus.Debug("There are no authz plugins in the chain")
|
||||
return nil
|
||||
|
|
Loading…
Add table
Reference in a new issue