Skip to content

Commit aa0eb89

Browse files
committed
Add some type assertions.
1 parent 41eef5a commit aa0eb89

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

logger/module.go

+2
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ func (d *DefaultLogger) Errorf(format string, args ...interface{}) {
4444
log.Printf("[ERROR] "+format, args...)
4545
}
4646

47+
var _ service.Module = &Module{}
48+
4749
type Module struct {
4850
Logger
4951
}

users/databaseauth/module.go

+4
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ const (
1919

2020
type errorHandler func(http.ResponseWriter, *http.Request, error)
2121

22+
var (
23+
_ service.Module = &Module{}
24+
)
25+
2226
// Module databaseauth provides login via a database
2327
// or database-like backend. It uses the session module.
2428
// user authenticates via this module, then is a given a cookie

users/session/module.go

+8-4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"github.com/square/go-jose"
99

1010
"github.com/octavore/nagax/keystore"
11+
"github.com/octavore/nagax/users"
1112
)
1213

1314
// todo: make these configurable
@@ -34,7 +35,10 @@ type KeyStore interface {
3435
LoadPublicKey(string) ([]byte, error)
3536
}
3637

37-
var _ service.Module = &Module{}
38+
var (
39+
_ service.Module = &Module{}
40+
_ users.Authenticator = &Module{} // this module is an authenticator
41+
)
3842

3943
// Module session is for keeping track of sessions
4044
// See:
@@ -46,9 +50,9 @@ type Module struct {
4650
KeyStore KeyStore
4751
RevocationStore RevocationStore
4852

49-
SecureCookie bool
50-
CookieDomain string
51-
KeyFile string
53+
SecureCookie bool
54+
CookieDomain string
55+
KeyFile string
5256
SessionValidityDuration time.Duration
5357

5458
decryptionKey interface{}

0 commit comments

Comments
 (0)