3
0
corteza/pkg/auth/interfaces.go
2019-10-01 17:47:43 +02:00

35 lines
576 B
Go

package auth
import (
"net/http"
)
type (
Identifiable interface {
Identity() uint64
Roles() []uint64
Valid() bool
}
TokenEncoder interface {
Encode(identity Identifiable) string
}
TokenDecoder interface {
Decode(token string) (Identifiable, error)
}
TokenHandler interface {
TokenEncoder
TokenDecoder
HttpVerifier() func(http.Handler) http.Handler
HttpAuthenticator() func(http.Handler) http.Handler
}
Signer interface {
Sign(userID uint64, pp ...interface{}) string
Verify(signature string, userID uint64, pp ...interface{}) bool
}
)