3
0
corteza/auth/auth.go
Denis Arh d886a98740 Implements JWT authorization along with some refactoring
- introduces auth package, for common (sam, crm) auth handlers
 - routes are now generated inside server package, each handler got its own MountRoutes(r chi.Router, middlewares ...func(http.Handler) http.Handler)
 - there MountRoute methods are now called from non-generated code so we can inject services to (rest) controllers
2018-07-26 20:12:14 +02:00

27 lines
298 B
Go

package auth
type (
Identifiable interface {
GetID() uint64
Valid() bool
}
Identity struct {
id uint64
}
)
func NewIdentity(id uint64) *Identity {
return &Identity{
id: id,
}
}
func (i Identity) GetID() uint64 {
return i.id
}
func (i Identity) Valid() bool {
return i.id > 0
}