biz-member-gateway/internal/domain/payload.go

48 lines
807 B
Go

package domain
import (
"context"
"code.30cm.net/digimon/app-cloudep-permission-server/pkg/domain/token"
)
func UID(ctx context.Context) string {
if uid, ok := ctx.Value(token.UID.String()).(string); ok {
return uid
}
return ""
}
func Scope(ctx context.Context) string {
if scope, ok := ctx.Value(token.Scope.String()).(string); ok {
return scope
}
return ""
}
func Role(ctx context.Context) string {
if role, ok := ctx.Value(token.Role.String()).(string); ok {
return role
}
return ""
}
func DeviceID(ctx context.Context) string {
if deviceID, ok := ctx.Value(token.Device.String()).(string); ok {
return deviceID
}
return ""
}
func Account(ctx context.Context) string {
if account, ok := ctx.Value(token.Account.String()).(string); ok {
return account
}
return ""
}