auth

package
v0.0.0-...-7c47925 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

based on egret/auth/client.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func APIOwnerFromContext

func APIOwnerFromContext(ctx context.Context) *ent.Owner

APIOwnerFromContext returns the api owner on context or panics if the client is missing

func AddAPIClientToContext

func AddAPIClientToContext(ctx context.Context, client APIClient) context.Context

AddAPIClientToContext returns a context with the client attached

func ClientIDHeaderAuthFunc

func ClientIDHeaderAuthFunc(defaultClientID string, ownerClient internal.OwnerClient) grpc_auth.AuthFunc

ClientIDHeaderAuthFunc returns the authorization function that reads the client id from the metadata. Authorized Flow (Overrides) 1. Default Client ID provided at Server runtime 2. Client provides Client-ID

func NewBackgroundContextWithAPIClient

func NewBackgroundContextWithAPIClient(inCtx context.Context) (context.Context, context.CancelFunc, error)

Returns a new background context with the api client set from the passed context. The returned context won't end when the passed context ends.

Types

type APIClient

type APIClient interface {
	GetOwner() *ent.Owner
}

APIClient provides access to info about the client

func APIClientFromContext

func APIClientFromContext(ctx context.Context) (APIClient, error)

APIClientFromContext returns the api client on context or an error if the client is missing

func NewAPIClient

func NewAPIClient(owner *ent.Owner) APIClient

NewAPIClient constructs a API Client

Jump to

Keyboard shortcuts

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