auth

package
v0.11.4 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateJwt added in v0.7.0

func ValidateJwt(encodedJwt string) (jwt.Token, error)

Types

type Auth

type Auth struct {
	// contains filtered or unexported fields
}

func NewAuth

func NewAuth(clientId, clientSecret, source, tokenIssuerUrl, audience string) *Auth

func (*Auth) GetEnvironment added in v0.3.0

func (a *Auth) GetEnvironment() (string, error)

func (*Auth) GetToken

func (a *Auth) GetToken() (string, error)

type Credentials

type Credentials struct {
	Audience     string `json:"audience"`
	Source       string `json:"source"`
	ClientId     string `json:"clientId"`
	ExpiresAt    string `json:"expiresAt"`
	Token        string `json:"token"`
	RefreshToken string `json:"refreshToken"`
}

func LoadCredentials

func LoadCredentials(fileLocation string) (Credentials, error)

func NewCredentials

func NewCredentials(audience, source, clientId, expiresAt, token string, refreshToken string) *Credentials

func (*Credentials) GetEnvironment added in v0.3.0

func (c *Credentials) GetEnvironment() (string, error)

func (*Credentials) WriteCredentials

func (c *Credentials) WriteCredentials(fileLocation string) error

type DeviceTokenData added in v0.7.0

type DeviceTokenData struct {
	DeviceCode              string `json:"device_code"`
	UserCode                string `json:"user_code"`
	VerificationUri         string `json:"verification_uri"`
	ExpiresIn               int    `json:"expires_in"`
	Interval                int    `json:"interval"`
	VerificationUriComplete string `json:"verification_uri_complete"`
}

func GetDeviceCodeFromAuthorizationServer added in v0.7.0

func GetDeviceCodeFromAuthorizationServer(clientId, scope, audience, authUrl string) (*DeviceTokenData, error)

type ErrorResponse added in v0.7.0

type ErrorResponse struct {
	Error       string `json:"error"`
	Description string `json:"error_description"`
}

type SuccessfulResponse added in v0.7.0

type SuccessfulResponse struct {
	// AccessToken Encoded JWT / Bearer Token
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token"`
	// SecondsUtilTokenExpires the number of seconds until the JWT expires, from when it was created by the Auth Server.
	// The JWT has the exact expiration date time
	SecondsUtilTokenExpires int `json:"expires_in"`
}

func PollAuthorizationServerForResponse added in v0.7.0

func PollAuthorizationServerForResponse(cliClientId string, authUrl string, deviceTokenResponse *DeviceTokenData, authStartedAt time.Time) (*SuccessfulResponse, error)

func RefreshAuthToken added in v0.7.0

func RefreshAuthToken(cliClientId string, authUrl string, refreshToken string, environmentId string) (*SuccessfulResponse, error)

Jump to

Keyboard shortcuts

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