Start refactoring
This commit is contained in:
25
server/authentication/authentication.go
Normal file
25
server/authentication/authentication.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package authentication
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"opensavecloudserver/data/repository/user"
|
||||
)
|
||||
|
||||
type (
|
||||
Authenticator interface {
|
||||
Authenticate(username, password string) ([]byte, error)
|
||||
Validate(token string) (Session, error)
|
||||
}
|
||||
|
||||
Session interface {
|
||||
UserID() user.ID
|
||||
Scopes() []Scope
|
||||
Roles() []user.Role
|
||||
}
|
||||
|
||||
Scope string
|
||||
)
|
||||
|
||||
var (
|
||||
ErrBadPassword = errors.New("failed to verify password")
|
||||
)
|
||||
Reference in New Issue
Block a user