service

package
v0.19.821 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2026 License: AGPL-3.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NuonAuthCookieName  string = "X-Nuon-Auth"
	NuonAuthSessionName string = "nuon-auth-session"
)

Cookie and session names

View Source
const (
	HeaderNuonAuthUser    = "X-Nuon-Auth-User"
	HeaderNuonAuthEmail   = "X-Nuon-Auth-Email"
	HeaderNuonAuthSuccess = "X-Nuon-Auth-Success"
	HeaderNuonAuthClaims  = "X-Nuon-Auth-Claims"
)

Response headers for validated requests

View Source
const (
	// DefaultProviderID is the ID used for the env-configured default provider.
	DefaultProviderID = "default"
)

Variables

View Source
var (
	// ErrAccountNotAuthorized is returned when a user tries to authenticate
	// but has no existing account and no pending org invite.
	ErrAccountNotAuthorized = errors.New("account not authorized: no existing account or pending invitation found")

	// ErrEmailDomainNotAllowed is returned when a user tries to authenticate
	// but their email domain is not in the allowed domains list.
	ErrEmailDomainNotAllowed = errors.New("email domain not allowed")
)

Functions

func New

func New(params Params) (*service, error)

Types

type DescribeTagsItem

type DescribeTagsItem struct {
	Key          string `xml:"key"`
	Value        string `xml:"value"`
	ResourceId   string `xml:"resourceId"`
	ResourceType string `xml:"resourceType"`
}

DescribeTagsItem represents a single tag item in the EC2 DescribeTags response

type DescribeTagsResponse

type DescribeTagsResponse struct {
	XMLName xml.Name `xml:"DescribeTagsResponse"`
	TagSet  struct {
		Items []DescribeTagsItem `xml:"item"`
	} `xml:"tagSet"`
}

DescribeTagsResponse represents the AWS EC2 DescribeTags response

type GetCallerIdentityResponse

type GetCallerIdentityResponse struct {
	XMLName xml.Name `xml:"GetCallerIdentityResponse"`
	Result  struct {
		Arn     string `xml:"Arn"`
		UserId  string `xml:"UserId"`
		Account string `xml:"Account"`
	} `xml:"GetCallerIdentityResult"`
}

GetCallerIdentityResponse represents the AWS STS GetCallerIdentity response

type Params

type Params struct {
	fx.In

	V          *validator.Validate
	Cfg        *internal.Config
	DB         *gorm.DB `name:"psql"`
	MW         metrics.Writer
	L          *zap.Logger
	AcctClient *account.Client
}

type ProviderOption

type ProviderOption struct {
	ID           string
	Name         string
	ProviderType string
}

ProviderOption represents a login option to display in the UI.

type RunnerAuthAWSRequest

type RunnerAuthAWSRequest struct {
	// STSRequest is a presigned GetCallerIdentity request
	STSRequest *awstypes.PresignedRequest `json:"sts" validate:"required"`
	// TagsRequest is a presigned EC2 DescribeTags request for the instance
	TagsRequest *awstypes.PresignedRequest `json:"tags" validate:"required"`
}

RunnerAuthAWSRequest contains the presigned AWS requests from a runner

type RunnerAuthAWSResponse

type RunnerAuthAWSResponse struct {
	// Authenticated indicates whether the runner was successfully authenticated
	Authenticated bool `json:"authenticated"`
	// AccountID is the AWS account ID from the STS response
	AccountID string `json:"account_id,omitempty"`
	// ARN is the IAM role/user ARN from the STS response
	ARN string `json:"arn,omitempty"`
	// InstanceID is the EC2 instance ID from tags
	InstanceID string `json:"instance_id,omitempty"`
	// RunnerID is the Nuon runner ID from the instance tags
	RunnerID string `json:"runner_id,omitempty"`
	// Token is the authentication token issued to the runner
	Token string `json:"token,omitempty"`
}

RunnerAuthAWSResponse contains the authentication result

type SessionData

type SessionData struct {
	State        string `json:"state"`
	ProviderID   string `json:"pid,omitempty"`
	RequestedURL string `json:"url,omitempty"`
	FailCount    int    `json:"fc,omitempty"`
	CreatedAt    int64  `json:"iat"`
}

SessionData holds the OAuth flow state in a signed cookie.

type TokenInfo

type TokenInfo struct {
	AccountID string
	Email     string
	Username  string
}

TokenInfo represents the validated token information.

Jump to

Keyboard shortcuts

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