Documentation ¶
Overview ¶
Package auth contains types for working with non blank user names. User always has a non blank name. OptionalUser will either have a non blank name or no value.
Index ¶
- Constants
- func CreateContextWithAuthInfo(ctx context.Context, info AggregatorUserInfo) context.Context
- func ErrAuthInfoMissing(authInfo AggregatorUserInfo) error
- func ErrAuthInfoUsernameIsMissing(authInfo AggregatorUserInfo) error
- func IsErrAuthInfoMissing(e error) bool
- func IsErrAuthInfoUsernameIsMissing(e error) bool
- type AggregatorUserInfo
- type AuthenticationMode
- type InfoError
- type OptionalUser
- type User
Constants ¶
View Source
const (
AuthInfoContextKey contextKey = "AuthInfo"
)
Variables ¶
This section is empty.
Functions ¶
func CreateContextWithAuthInfo ¶
func CreateContextWithAuthInfo(ctx context.Context, info AggregatorUserInfo) context.Context
func ErrAuthInfoMissing ¶
func ErrAuthInfoMissing(authInfo AggregatorUserInfo) error
func ErrAuthInfoUsernameIsMissing ¶
func ErrAuthInfoUsernameIsMissing(authInfo AggregatorUserInfo) error
func IsErrAuthInfoMissing ¶
Types ¶
type AggregatorUserInfo ¶
func RetrieveAuthInfoFromContext ¶
func RetrieveAuthInfoFromContext(ctx context.Context) (AggregatorUserInfo, bool)
type AuthenticationMode ¶
type AuthenticationMode string
type InfoError ¶
type InfoError struct {
// contains filtered or unexported fields
}
func (*InfoError) AuthInfo ¶
func (e *InfoError) AuthInfo() AggregatorUserInfo
type OptionalUser ¶
type OptionalUser struct {
// contains filtered or unexported fields
}
the possibility of a user
func MaybeNamed ¶
func MaybeNamed(name string) OptionalUser
store an non blank user name inside the optional user
func MaybeRequestUser ¶
func MaybeRequestUser(r *http.Request) OptionalUser
func ToOptionalUser ¶
func ToOptionalUser(user User) OptionalUser
weaken the User type into an OptionalUser type.
func (OptionalUser) NameOrElse ¶
func (user OptionalUser) NameOrElse(defaultValue string) string
access the user name of an optional user. If no name is present return the default value
Click to show internal directories.
Click to hide internal directories.