pass auth by reference

This commit is contained in:
Umputun
2018-12-28 00:49:46 -06:00
parent 60700d96c7
commit d33997c742
4 changed files with 7 additions and 7 deletions
+1 -1
View File
@@ -261,7 +261,7 @@ func (s *ServerCommand) newServerApp() (*serverApp, error) {
Migrator: migr,
ReadOnlyAge: s.ReadOnlyAge,
SharedSecret: s.SharedSecret,
Authenticator: *authenticator,
Authenticator: authenticator,
Cache: loadingCache,
NotifyService: notifyService,
SSLConfig: sslConfig,
+1 -1
View File
@@ -23,7 +23,7 @@ import (
type admin struct {
dataService *service.DataStore
cache cache.LoadingCache
authenticator auth.Service
authenticator *auth.Service
readOnlyAge int
migrator *Migrator
}
+1 -1
View File
@@ -39,7 +39,7 @@ type Rest struct {
Version string
DataService *service.DataStore
Authenticator auth.Service
Authenticator *auth.Service
Cache cache.LoadingCache
ImageProxy *proxy.Image
CommentFormatter *store.CommentFormatter
+4 -4
View File
@@ -62,7 +62,7 @@ func TestRest_GetStarted(t *testing.T) {
}
func TestRest_Shutdown(t *testing.T) {
srv := Rest{Authenticator: auth.Service{}, ImageProxy: &proxy.Image{}}
srv := Rest{Authenticator: &auth.Service{}, ImageProxy: &proxy.Image{}}
go func() {
time.Sleep(100 * time.Millisecond)
@@ -91,7 +91,7 @@ func TestRest_filterComments(t *testing.T) {
func TestRest_RunStaticSSLMode(t *testing.T) {
srv := Rest{
Authenticator: *auth.NewService(auth.Opts{
Authenticator: auth.NewService(auth.Opts{
AvatarStore: avatar.NewLocalFS("/tmp"),
AvatarResizeLimit: 300,
}),
@@ -143,7 +143,7 @@ func TestRest_RunStaticSSLMode(t *testing.T) {
func TestRest_RunAutocertModeHTTPOnly(t *testing.T) {
srv := Rest{
Authenticator: auth.Service{},
Authenticator: &auth.Service{},
ImageProxy: &proxy.Image{},
SSLConfig: SSLConfig{
SSLMode: Auto,
@@ -191,7 +191,7 @@ func prep(t *testing.T) (srv *Rest, ts *httptest.Server) {
srv = &Rest{
DataService: dataStore,
Authenticator: *auth.NewService(auth.Opts{
Authenticator: auth.NewService(auth.Opts{
DevPasswd: "password",
SecretReader: token.SecretFunc(func(id string) (string, error) { return "secret", nil }),
AvatarStore: avatar.NewLocalFS("/tmp"),