auth_client

package module
v0.0.0-...-90cfb48 Latest Latest
Warning

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

Go to latest
Published: May 1, 2023 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthClient

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

func NewClient

func NewClient(host string) (*AuthClient, error)

func (*AuthClient) GetUserId

func (a *AuthClient) GetUserId(body GetUserIdRequest) (*string, error)

func (*AuthClient) Refresh

func (a *AuthClient) Refresh(body RefreshRequest) (*RefreshResponse, error)

func (*AuthClient) Revoke

func (a *AuthClient) Revoke(body RevokeRequest) (*bool, error)

func (*AuthClient) Tokens

func (a *AuthClient) Tokens(body TokensRequest) (*TokenResponse, error)

func (*AuthClient) Validate

func (a *AuthClient) Validate(body ValidateRequest) (*ValidateResponse, error)

type AuthResponse

type AuthResponse[T any] struct {
	Error *string `json:"error"`
	Body  T       `json:"body"`
}

type Endpoint

type Endpoint struct {
	Path   string
	Method string
}

type EndpointName

type EndpointName string
const (
	E_TOKEN    EndpointName = "token"
	E_VALIDATE EndpointName = "validate"
	E_REFRESH  EndpointName = "refresh"
	E_USER_ID  EndpointName = "user-id"
	E_REVOKE   EndpointName = "revoke"
)

type GetUserIdRequest

type GetUserIdRequest struct {
	AccessToken string `json:"access_token"`
}

type GetUserIdResponse

type GetUserIdResponse string

type RefreshRequest

type RefreshRequest struct {
	RefreshToken string `json:"refresh_token"`
}

type RefreshResponse

type RefreshResponse struct {
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token"`
}

type RevokeRequest

type RevokeRequest struct {
	RefreshToken string `json:"refresh_token"`
}

type RevokeResponse

type RevokeResponse bool

type TokenResponse

type TokenResponse struct {
	AccessToken  *string `json:"access_token"`
	RefreshToken *string `json:"refresh_token"`
}

type TokensRequest

type TokensRequest struct {
	UserId     string `json:"user_id"`
	UserClaims any    `json:"user_claims"`
}

type ValidateRequest

type ValidateRequest struct {
	AccessToken  *string `json:"access_token"`
	RefreshToken *string `json:"refresh_token"`
}

type ValidateResponse

type ValidateResponse struct {
	AccessToken  *bool `json:"access_token,omitempty"`
	RefreshToken *bool `json:"refresh_token,omitempty"`
}

Jump to

Keyboard shortcuts

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