app: register app authmode during setup

Fixes: http://camlistore.org/issue/439

Change-Id: I5d78f1fb764b83a0a9afc35b4ffb62a1a7934ed0
This commit is contained in:
mpl 2014-05-21 19:55:42 +02:00
parent 3c6daa2197
commit c627b6325a
2 changed files with 8 additions and 0 deletions

View File

@ -162,3 +162,10 @@ func (a *AppHandler) Start() error {
func (a *AppHandler) Name() string {
return a.name
}
// AuthMode returns the app handler's auth mode, which is also the auth that the
// app's client will be configured with. This mode should be registered with
// the server's auth modes, for the app to have access to the server's resources.
func (a *AppHandler) AuthMode() auth.AuthMode {
return a.auth
}

View File

@ -341,6 +341,7 @@ func (hl *handlerLoader) setupHandler(prefix string) {
exitFailure("error setting up app for prefix %q: %v", h.prefix, err)
}
hh = ap
auth.AddMode(ap.AuthMode())
} else {
var err error
hh, err = blobserver.CreateHandler(h.htype, hl, h.conf)