Browse code

authz: remove and hide unused and local-only methods respectively

Signed-off-by: David Sheets <dsheets@docker.com>

David Sheets authored on 2017/06/13 20:12:42
Showing 1 changed files
... ...
@@ -25,20 +25,12 @@ func NewMiddleware(names []string, pg plugingetter.PluginGetter) *Middleware {
25 25
 	}
26 26
 }
27 27
 
28
-// GetAuthzPlugins gets authorization plugins
29
-func (m *Middleware) GetAuthzPlugins() []Plugin {
28
+func (m *Middleware) getAuthzPlugins() []Plugin {
30 29
 	m.mu.Lock()
31 30
 	defer m.mu.Unlock()
32 31
 	return m.plugins
33 32
 }
34 33
 
35
-// SetAuthzPlugins sets authorization plugins
36
-func (m *Middleware) SetAuthzPlugins(plugins []Plugin) {
37
-	m.mu.Lock()
38
-	m.plugins = plugins
39
-	m.mu.Unlock()
40
-}
41
-
42 34
 // SetPlugins sets the plugin used for authorization
43 35
 func (m *Middleware) SetPlugins(names []string) {
44 36
 	m.mu.Lock()
... ...
@@ -62,7 +54,7 @@ func (m *Middleware) RemovePlugin(name string) {
62 62
 // WrapHandler returns a new handler function wrapping the previous one in the request chain.
63 63
 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 {
64 64
 	return func(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
65
-		plugins := m.GetAuthzPlugins()
65
+		plugins := m.getAuthzPlugins()
66 66
 		if len(plugins) == 0 {
67 67
 			return handler(ctx, w, r, vars)
68 68
 		}
... ...
@@ -96,7 +88,7 @@ func (m *Middleware) WrapHandler(handler func(ctx context.Context, w http.Respon
96 96
 
97 97
 		// There's a chance that the authCtx.plugins was updated. One of the reasons
98 98
 		// this can happen is when an authzplugin is disabled.
99
-		plugins = m.GetAuthzPlugins()
99
+		plugins = m.getAuthzPlugins()
100 100
 		if len(plugins) == 0 {
101 101
 			logrus.Debug("There are no authz plugins in the chain")
102 102
 			return nil