auth

package
v0.0.141 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrRelogin = fnerrors.New("not logged in, please run `ns login`")

Functions

func GenerateToken added in v0.0.136

func GenerateToken(ctx context.Context, opts ...AuthOpt) (string, error)

GenerateToken generates token based on provided options. If no options provided an error would be returned.

func StoreMarshalledUser added in v0.0.136

func StoreMarshalledUser(ctx context.Context, userAuthData []byte) error

func StoreUser added in v0.0.136

func StoreUser(ctx context.Context, userAuth *UserAuth) (string, error)

Types

type AuthOpt added in v0.0.136

type AuthOpt func(*authConfig)

func WithGithubOIDC added in v0.0.136

func WithGithubOIDC(useGithubOIDC bool) AuthOpt

WithGithubOIDC an option to use Github OIDC provider to generate JWT.

func WithUserAuth added in v0.0.136

func WithUserAuth(userAuth *UserAuth) AuthOpt

WithUserAuth an option to use existing `UserAuth` credentials to get JWT.

type UserAuth added in v0.0.136

type UserAuth struct {
	Username       string `json:"username,omitempty"`
	Org            string `json:"org,omitempty"` // The organization this user is acting as. Only really relevant for robot accounts which authenticate against a repository.
	InternalOpaque []byte `json:"opaque,omitempty"`

	Clerk          *clerk.State `json:"clerk,omitempty"`
	IsGithubAction bool         `json:"is_github_action,omitempty"`
}

func LoadUser added in v0.0.136

func LoadUser() (*UserAuth, error)

Jump to

Keyboard shortcuts

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