1
Fork 0
mirror of https://github.com/jech/galene.git synced 2024-11-22 16:45:58 +01:00
galene/token/token.go
Juliusz Chroboczek a6314a7384 Implement stateful tokens.
Stateful tokens look just like cryptographic tokens to the client.
Unlike cryptographic tokens, they are stored in a file and are
revokable and editable.
2023-04-04 00:59:54 +02:00

19 lines
376 B
Go

package token
import (
"errors"
)
var ErrUsernameRequired = errors.New("username required")
type Token interface {
Check(host, group string, username *string) (string, []string, error)
}
func Parse(token string, keys []map[string]interface{}) (Token, error) {
t, err := getStateful(token)
if err == nil && t != nil {
return t, nil
}
return parseJWT(token, keys)
}