api

package
v0.0.0-...-de7bd9d Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBadRequest   = errors.New("bad request")
	ErrUnauthorized = errors.New("unauthorized")
)
View Source
var SettingsProviders = map[string]SettingsProvider{}

Functions

func RequestAttrs

func RequestAttrs(r events.ALBTargetGroupRequest) []any

RequestAttrs returns attributes to be used with slog for the given request.

[]any is returned instead of []slog.Attr to make it easier to supply the attributes to slog functions using spread, for example:

slog.Error(msg, RequestAttrs(r)...)

func ServeJSON

func ServeJSON[T any](w *events.ALBTargetGroupResponse, data T)

func ServeJSONError

func ServeJSONError(w *events.ALBTargetGroupResponse, statusCode int, msg string)

func ServeUserApplications

func ServeUserApplications(okta OktaService, idp *oidc.Provider) lambda.Handler

Types

type Application

type Application struct {
	ID   string `json:"@id"`
	Name string `json:"name"`
}

type Claims

type Claims struct {
	Sub               string `json:"sub"`
	GivenName         string `json:"given_name"`
	FamilyName        string `json:"family_name"`
	PreferredUsername string `json:"preferred_username"`
	Email             string `json:"email"`
	ZoneInfo          string `json:"zoneinfo"`
	Locale            string `json:"locale"`
}

type JSONError

type JSONError struct {
	Message string `json:"error"`
}

type Okta

type Okta struct {
	Domain *url.URL
	Token  string
	// contains filtered or unexported fields
}

func NewOktaService

func NewOktaService(domain *url.URL, token string) Okta

func (Okta) ListApplicationsForUser

func (o Okta) ListApplicationsForUser(ctx context.Context, user string) ([]*okta.AppLink, error)

type OktaService

type OktaService interface {
	ListApplicationsForUser(ctx context.Context, user string) ([]*okta.AppLink, error)
}

type ServeUserApplicationsHandler

type ServeUserApplicationsHandler struct {
	Okta OktaService
	Idp  *oidc.Provider
}

func (ServeUserApplicationsHandler) Handle

func (ServeUserApplicationsHandler) Handler

type Settings

type Settings struct {
	OktaHost  string `json:"oktaHost"`
	OktaToken string `json:"oktaToken"`
}

Settings is used to hold keyconjurer settings

func NewSettings

func NewSettings(ctx context.Context) (*Settings, error)

func RetrieveSettingsFromEnv

func RetrieveSettingsFromEnv(_ context.Context) (*Settings, error)

type SettingsProvider

type SettingsProvider interface {
	FetchSettings(ctx context.Context) (*Settings, error)
}

type SettingsProviderFunc

type SettingsProviderFunc func(ctx context.Context) (*Settings, error)

func (SettingsProviderFunc) FetchSettings

func (fn SettingsProviderFunc) FetchSettings(ctx context.Context) (*Settings, error)

type VaultRetriever

type VaultRetriever struct {
	SecretMountPath string
	SecretPath      string
}

func (VaultRetriever) FetchSettings

func (v VaultRetriever) FetchSettings(ctx context.Context) (*Settings, error)

Jump to

Keyboard shortcuts

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