authclient

package
v0.0.0-...-78d125d Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package authclient provides support to access the auth service.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithClient

func WithClient(http *http.Client) func(cln *Client)

WithClient adds a custom client for processing requests. It's recommend to not use the default client and provide your own.

Types

type AuthenticateResp

type AuthenticateResp struct {
	UserID uuid.UUID
	Claims auth.Claims
}

AuthenticateResp defines the information that will be received on authenticate.

func (AuthenticateResp) Encode

func (ar AuthenticateResp) Encode() ([]byte, string, error)

Encode implements the encoder interface.

type Authorize

type Authorize struct {
	UserID uuid.UUID
	Claims auth.Claims
	Rule   string
}

Authorize defines the information required to perform an authorization.

func (*Authorize) Decode

func (a *Authorize) Decode(data []byte) error

Decode implements the decoder interface.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client represents a client that can talk to the auth service.

func New

func New(log *logger.Logger, url string, options ...func(cln *Client)) *Client

New constructs an Auth that can be used to talk with the auth service.

func (*Client) Authenticate

func (cln *Client) Authenticate(ctx context.Context, authorization string) (AuthenticateResp, error)

Authenticate calls the auth service to authenticate the user.

func (*Client) Authorize

func (cln *Client) Authorize(ctx context.Context, auth Authorize) error

Authorize calls the auth service to authorize the user.

Jump to

Keyboard shortcuts

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