auth

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2024 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 GetAppPlatform added in v0.6.12

func GetAppPlatform(ctx context.Context) string

GetAppPlatform returns application platform of the context.

func GetAppVersion added in v0.6.12

func GetAppVersion(ctx context.Context) string

GetAppVersion returns application version of the 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 GetTraceID added in v0.6.17

func GetTraceID(ctx context.Context) string

GetTraceID returns the trace iD of the 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 IsGuest added in v0.6.13

func IsGuest(ctx context.Context) bool

IsGuest returns true if the context has guest

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

func ToGuestCtx added in v0.6.13

func ToGuestCtx(ctx context.Context) context.Context

ToGuestCtx adds guest to context

func WithAppPlatform added in v0.6.12

func WithAppPlatform(ctx context.Context, platform string) context.Context

WithAppPlatform returns context containing application platform.

func WithAppVersion added in v0.6.12

func WithAppVersion(ctx context.Context, platform string) context.Context

WithAppVersion returns context containing application version.

func WithTraceID added in v0.6.17

func WithTraceID(ctx context.Context, traceID string) context.Context

WithTraceID returns context containing application platform.

Types

This section is empty.

Jump to

Keyboard shortcuts

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