auth

package
v0.6.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 12, 2023 License: AGPL-3.0 Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddAppIDToCtx

func AddAppIDToCtx(ctx context.Context, value string) context.Context

AddAppIDToCtx store authenticated user id to context

func AddServiceNameToCtx

func AddServiceNameToCtx(ctx context.Context, value string) context.Context

AddServiceNameToCtx store authenticated user id to context

func AddUserIDToCtx

func AddUserIDToCtx(ctx context.Context, userID string) context.Context

AddUserIDToCtx store authenticated user id to context

func AddUserRoleToCtx added in v0.6.5

func AddUserRoleToCtx(ctx context.Context, value string) context.Context

AddUserRoleToCtx adds user role to context

func GetAppID

func GetAppID(ctx context.Context) string

GetAppID gets authenticated app id from context

func GetIdentity added in v0.6.6

func GetIdentity(ctx context.Context) (string, string, error)

GetIdentity returns the app and user IDs and an error in case both are empty

func GetServiceName

func GetServiceName(ctx context.Context) string

GetServiceName gets authenticated service name from context

func GetUserID

func GetUserID(ctx context.Context) (string, error)

GetUserID gets authenticated user id from context

func GetUserRole added in v0.6.5

func GetUserRole(ctx context.Context) (string, error)

GetUserRole gets user role from context

func IsAdmin

func IsAdmin(ctx context.Context) bool

IsAdmin returns true if the context has admin privileges

func IsBanned added in v0.6.3

func IsBanned(ctx context.Context) bool

IsBanned returns true if the context has banned flag

func ToAdminCtx

func ToAdminCtx(ctx context.Context) context.Context

ToAdminCtx upgrades the context with admin privileges

func ToBannedCtx added in v0.6.3

func ToBannedCtx(ctx context.Context) context.Context

ToBannedCtx upgrades the context with banned flag

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL