extauthapi

package
v0.0.0-...-932180f Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package extauthapi implementaton for debugging and testing.

Index

Constants

View Source
const (
	// SessionCookieName is a name of HTTP cookie with session token.
	SessionCookieName = "__AuthKey"
	// CSRFTokenCookieName is a name of HTTP cookie with CSRF token.
	CSRFTokenCookieName = "__CSRFToken" //nolint:gosec
	// CSRFTokenHeaderName is a name of HTTP header with CSRF token bound to session token.
	CSRFTokenHeaderName = "X-CSRFTokenBound" //nolint:gosec
)

Variables

View Source
var NoID = ID(uuid.Nil) //nolint:gochecknoglobals

NoID means absent user ID.

Functions

This section is empty.

Types

type Client

type Client struct {
}

Client for extauthapi.

func NewClient

func NewClient(endpoint string, tlsConfig *tls.Config, autoRetryCSRF bool) (*Client, error)

NewClient creates and return new client for extauthapi.

func (*Client) GetUserProfile

func (c *Client) GetUserProfile(ctx context.Context, rawCookies string) (*Profile, error)

GetUserProfile gets a cookie with the userID and isolatedEntityID separated by a dot(.) and returns a profile with the values from the cookie. Authn is always true.

type ID

type ID uuid.UUID

ID contains user ID (UUIDv4) or NoID. On Scan/Unmarshal values nil and empty string are considered NoID. On String/Value/Marshal NoID is 00000000-0000-0000-0000-000000000000.

func MustParseID

func MustParseID(input string) ID

MustParseID returns ID parsed from string input. Same behavior as ParseID, but panics on error.

func NewID

func NewID() ID

NewID returns new user ID.

func ParseID

func ParseID(input string) (id ID, err error)

ParseID returns ID parsed from string input. Input is expected in a form accepted by UnmarshalText.

func (*ID) Scan

func (id *ID) Scan(src interface{}) error

Scan implements the sql.Scanner interface.

func (ID) String

func (id ID) String() string

Returns canonical string representation of UUID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.

func (*ID) UnmarshalText

func (id *ID) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

func (ID) Value

func (id ID) Value() (driver.Value, error)

Value implements the driver.Valuer interface.

type Profile

type Profile struct {
	ID               ID
	Authn            bool
	IsolatedEntityID ID
}

Profile describes user profile returned by /get-user-profile.

Jump to

Keyboard shortcuts

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