login

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ArgHelp = `
    [login-target]
        The login target is the base URL of the service.`

ArgHelp is the suffix text that will be displayed after the argument list in the module help

View Source
var Args = flag.NewFlagSet("login", flag.ExitOnError)

Args is a flagset that needs to be exported so that it can be written to the main program help

View Source
var Usage = `

USAGE: %s login <login-target>

login:
    logs in to the SDA using the provided login target.
`

Usage text that will be displayed as command line help text when using the `help login` command

Functions

func NewLogin

func NewLogin(args []string) error

Types

type AuthInfo

type AuthInfo struct {
	ClientID  string `json:"client_id"`
	OidcURI   string `json:"oidc_uri"`
	PublicKey string `json:"public_key"`
	InboxURI  string `json:"inbox_uri"`
}

func GetAuthInfo

func GetAuthInfo(baseURL string) (*AuthInfo, error)

requests the /info endpoint to fetch the parameters needed for login

type DeviceLogin

type DeviceLogin struct {
	BaseURL         string
	ClientID        string
	S3Target        string
	PublicKey       string
	PollingInterval int
	LoginResult     *Result
	UserInfo        *UserInfo

	CodeVerifier string
	// contains filtered or unexported fields
}

func NewDeviceLogin

func NewDeviceLogin(args []string) (DeviceLogin, error)

NewDeviceLogin() returns a new `DeviceLogin` with the given `url` and `clientID` set.

func (*DeviceLogin) GetS3Config

func (login *DeviceLogin) GetS3Config() (*S3Config, error)

S3Config() returns a new `S3Config` with the values from the `DeviceLogin`

func (*DeviceLogin) Login

func (login *DeviceLogin) Login() error

Login() does a full login by fetching the remote configuration, starting the login procedure, and then waiting for the user to complete login.

func (*DeviceLogin) UpdateConfigFile

func (login *DeviceLogin) UpdateConfigFile() error

creates a .sda-cli-session file and updates its values

type DeviceLoginResponse

type DeviceLoginResponse struct {
	VerificationURL string `json:"verification_uri_complete"`
	DeviceCode      string `json:"device_code"`
	ExpiresIn       int    `json:"expires_in"`
}

type OIDCWellKnown

type OIDCWellKnown struct {
	TokenEndpoint               string `json:"token_endpoint"`
	DeviceAuthorizationEndpoint string `json:"device_authorization_endpoint"`
}

type Result

type Result struct {
	AccessToken      string `json:"access_token"`
	IDToken          string `json:"id_token"`
	Scope            string `json:"scope"`
	TokenType        string `json:"token_type"`
	ExpiresIn        int    `json:"expires_in"`
	Error            string `json:"error"`
	ErrorDescription string `json:"error_description"`
}

type S3Config

type S3Config struct {
	AccessKey            string `ini:"access_key"`
	SecretKey            string `ini:"secret_key"`
	AccessToken          string `ini:"access_token"`
	HostBucket           string `ini:"host_bucket"`
	HostBase             string `ini:"host_base"`
	MultipartChunkSizeMb int64  `ini:"multipart_chunk_size_mb"`
	GuessMimeType        bool   `ini:"guess_mime_type"`
	Encoding             string `ini:"encoding"`
	CheckSslCertificate  bool   `ini:"check_ssl_certificate"`
	CheckSslHostname     bool   `ini:"check_ssl_hostname"`
	UseHTTPS             bool   `ini:"use_https"`
	SocketTimeout        int    `ini:"socket_timeout"`
	HumanReadableSizes   bool   `ini:"human_readable_sizes"`
	PublicKey            string `ini:"public_key"`
}

type UserInfo

type UserInfo struct {
	Sub               string   `json:"sub"`
	Name              string   `json:"name"`
	PreferredUsername string   `json:"preferred_username"`
	GivenName         string   `json:"given_name"`
	FamilyName        string   `json:"family_name"`
	Email             string   `json:"email"`
	EmailVerified     bool     `json:"email_verified"`
	Ga4ghPassportV1   []string `json:"ga4gh_passport_v1"`
}

Jump to

Keyboard shortcuts

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