Documentation ¶
Overview ¶
Package auth provides authentication and authorization support. Authentication: You show your identity. Authorization: You prove you have permission to do what you are requesting to do.
Index ¶
- Constants
- Variables
- func IsAuthError(err error) bool
- func NewAuthError(format string, args ...any) error
- func SetClaims(ctx context.Context, claims Claims) context.Context
- func SetUserID(ctx context.Context, userID uuid.UUID) context.Context
- type Auth
- type AuthError
- type Claims
- type Config
- type Vault
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("insufficient permissions")
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 AuthError ¶
type AuthError struct {
// contains filtered or unexported fields
}
AuthError is used to pass an error during the request through the application with auth specific context.