Documentation ¶
Overview ¶
Package auth provides authentication and authorization support. Authentication: You are who you say you are. Authorization: You have permission to do what you are requesting to do.
Index ¶
Constants ¶
const ( RuleAuthenticate = "auth" RuleAny = "ruleAny" RuleAdminOnly = "ruleAdminOnly" RuleUserOnly = "ruleUserOnly" RuleAdminOrSubject = "ruleAdminOrSubject" )
These the current set of rules we have for auth.
Variables ¶
var ErrForbidden = errors.New("attempted action is not allowed")
ErrForbidden is returned when a auth issue is identified.
Functions ¶
func IsAuthError ¶
IsAuthError checks if an error of type authError exists.
func NewAuthError ¶
NewAuthError creates an authError for the provided message.
Types ¶
type Auth ¶
type Auth struct {
// contains filtered or unexported fields
}
Auth is used to authenticate clients. It can generate a token for a set of user claims and recreate the claims by parsing the token.
func (*Auth) Authenticate ¶
Authenticate processes the token to validate the sender's token is valid.
type KeyLookup ¶
type KeyLookup interface { PrivateKey(ctx context.Context, kid string) (key string, err error) PublicKey(ctx context.Context, kid string) (key string, err error) }
KeyLookup declares a method set of behavior for looking up private and public keys for JWT use. The return could be a PEM encoded string or a JWS based key.