auth

package
v0.0.0-...-1b2071a Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2026 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type AuthClient

type AuthClient struct {
	ID     string
	Secret string
}

func (*AuthClient) Base64

func (ac *AuthClient) Base64() string

func (*AuthClient) String

func (ac *AuthClient) String() string

type DeviceAuthResponse

type DeviceAuthResponse struct {
	AccountID string `json:"accountId"`
	Created   struct {
		DateTime  time.Time `json:"dateTime"`
		IpAddress string    `json:"ipAddress"`
		Location  string    `json:"location"`
	} `json:"created"`
	DeviceID  string `json:"deviceId"`
	Secret    string `json:"secret"`
	UserAgent string `json:"userAgent"`
}

func CreateDeviceAuth

func CreateDeviceAuth(httpClient *http.Client, credentials *TokenResponse) (DeviceAuthResponse, error)

type ExchangeResponse

type ExchangeResponse struct {
	Code             string `json:"code"`
	CreatingClientID string `json:"creatingClientId"`
	ExpiresInSeconds int    `json:"expiresInSeconds"`
}

func GetExchangeCode

func GetExchangeCode(httpClient *http.Client, credentials *TokenResponse) (ExchangeResponse, error)

type GetDeviceCodeResponse

type GetDeviceCodeResponse struct {
	UserCode                string `json:"user_code"`
	DeviceCode              string `json:"device_code"`
	VerificationURI         string `json:"verification_uri"`
	VerificationURIComplete string `json:"verification_uri_complete"`
	Prompt                  string `json:"prompt"`
	ExpiresIn               int    `json:"expires_in"`
	Interval                int    `json:"interval"`
	ClientID                string `json:"client_id"`
}

func CreateDeviceCode

func CreateDeviceCode(httpClient *http.Client, credentials *TokenResponse) (GetDeviceCodeResponse, error)

type PayloadAuthorizationCode

type PayloadAuthorizationCode struct {
	Code string `json:"code"`
}

type PayloadClientCredentials

type PayloadClientCredentials struct{}

type PayloadContinuationToken

type PayloadContinuationToken struct {
	ContinuationToken string `json:"continuation_token"`
}

type PayloadDeviceAuth

type PayloadDeviceAuth struct {
	AccountID string `json:"account_id"`
	DeviceID  string `json:"device_id"`
	Secret    string `json:"secret"`
}

type PayloadDeviceCode

type PayloadDeviceCode struct {
	DeviceCode string `json:"device_code"`
}

type PayloadExchangeCode

type PayloadExchangeCode struct {
	ExchangeCode string `json:"exchange_code"`
}

type PayloadExternalAuth

type PayloadExternalAuth struct {
	ExternalAuthToken string `json:"external_auth_token"`
}

type PayloadOTP

type PayloadOTP struct {
	OTP string `json:"otp"`
}

type PayloadPassword

type PayloadPassword struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

type PayloadRefreshToken

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

type PayloadTokenToToken

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

type TokenResponse

type TokenResponse struct {
	AccessToken      string    `json:"access_token"`
	ExpiresIn        int       `json:"expires_in"`
	ExpiresAt        time.Time `json:"expires_at"`
	TokenType        string    `json:"token_type"`
	RefreshToken     string    `json:"refresh_token"`
	RefreshExpires   int       `json:"refresh_expires"`
	RefreshExpiresAt time.Time `json:"refresh_expires_at"`
	AccountID        string    `json:"account_id"`
	ClientID         string    `json:"client_id"`
	InternalClient   bool      `json:"internal_client"`
	ClientService    string    `json:"client_service"`
	DisplayName      string    `json:"displayName"`
	App              string    `json:"app"`
	InAppID          string    `json:"in_app_id"`
	DeviceID         string    `json:"device_id"`
	ProductID        string    `json:"product_id"`
	ApplicationID    string    `json:"application_id"`
	ACR              string    `json:"acr"`
	AuthTime         time.Time `json:"auth_time"`
}

func Authenticate

func Authenticate[T Payload](httpClient *http.Client, client *AuthClient, payload T, eg1 bool) (TokenResponse, error)

type VerifyTokenResponse

type VerifyTokenResponse struct {
	Token          string                          `json:"token"`
	SessionID      string                          `json:"session_id"`
	TokenType      string                          `json:"token_type"`
	ClientID       string                          `json:"client_id"`
	InternalClient bool                            `json:"internal_client"`
	ClientService  string                          `json:"client_service"`
	AccountID      string                          `json:"account_id"`
	ExpiresIn      int                             `json:"expires_in"`
	ExpiresAt      time.Time                       `json:"expires_at"`
	AuthMethod     string                          `json:"auth_method"`
	DisplayName    string                          `json:"display_name"`
	App            string                          `json:"app"`
	InAppID        string                          `json:"in_app_id"`
	DeviceID       string                          `json:"device_id"`
	Scope          []string                        `json:"scope"`
	ProductID      string                          `json:"product_id"`
	SandboxID      string                          `json:"sandbox_id"`
	DeploymentID   string                          `json:"deployment_id"`
	ApplicationID  string                          `json:"application_id"`
	ACR            string                          `json:"acr"`
	AuthTime       time.Time                       `json:"auth_time"`
	Perms          []VerifyTokenResponsePermission `json:"perms"`
}

func VerifyToken

func VerifyToken(httpClient *http.Client, accessToken string, includePerms bool) (VerifyTokenResponse, error)

type VerifyTokenResponsePermission

type VerifyTokenResponsePermission struct {
	Resource string `json:"resource"`
	Action   string `json:"action"`
}

Jump to

Keyboard shortcuts

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