auth0

package
v1.5.19 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthJwks added in v1.1.3

type AuthJwks struct {
	Name      string    `json:"name"`
	Jwks      string    `json:"jwks"`
	CreatedAt time.Time `json:"created_at"`
}

AuthJwks Struct

type AuthToken

type AuthToken struct {
	Name      string    `json:"name"`
	Token     string    `json:"token"`
	CreatedAt time.Time `json:"created_at"`
}

AuthToken Struct

type ClientProvider

type ClientProvider struct {
	AuthGrantType    string
	AuthClientID     string
	AuthClientSecret string
	AuthAudience     string
	AuthURL          string
	Environment      string
	// contains filtered or unexported fields
}

ClientProvider ...

func NewAuth0Client

func NewAuth0Client(env,
	authGrantType,
	authClientID,
	authClientSecret,
	authAudience,
	authURL string,
	httpClient HTTPClientProvider,
	esClient ESClientProvider,
	slackClient SlackProvider,
	appName string) (*ClientProvider, error)

NewAuth0Client ...

func (*ClientProvider) GetToken

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

GetToken ...

func (*ClientProvider) RefreshToken

func (a *ClientProvider) RefreshToken() (RefreshResult, error)

RefreshToken check if token will expire soon, if yes refresh it and save new token to cache storage

type ESClientProvider

type ESClientProvider interface {
	CreateDocument(index, documentID string, body []byte) ([]byte, error)
	Search(index string, query map[string]interface{}) ([]byte, error)
	CreateIndex(index string, body []byte) ([]byte, error)
	Get(index string, query map[string]interface{}, result interface{}) error
	UpdateDocument(index string, id string, body interface{}) ([]byte, error)
	BulkInsert(data []elastic.BulkData) ([]byte, error)
}

ESClientProvider used in connecting to ES server

type ESJwksSchema added in v1.1.3

type ESJwksSchema struct {
	Took     int  `json:"took"`
	TimedOut bool `json:"timed_out"`
	Shards   struct {
		Total      int `json:"total"`
		Successful int `json:"successful"`
		Skipped    int `json:"skipped"`
		Failed     int `json:"failed"`
	} `json:"_shards"`
	Hits struct {
		Total struct {
			Value    int    `json:"value"`
			Relation string `json:"relation"`
		} `json:"total"`
		MaxScore float64 `json:"max_score"`
		Hits     []struct {
			Index  string  `json:"_index"`
			Type   string  `json:"_type"`
			ID     string  `json:"_id"`
			Score  float64 `json:"_score"`
			Source struct {
				Name      string    `json:"name"`
				Jwks      string    `json:"jwks"`
				CreatedAt time.Time `json:"created_at"`
			} `json:"_source"`
		} `json:"hits"`
	} `json:"hits"`
}

ESJwksSchema ...

type ESTokenSchema

type ESTokenSchema struct {
	Took     int  `json:"took"`
	TimedOut bool `json:"timed_out"`
	Shards   struct {
		Total      int `json:"total"`
		Successful int `json:"successful"`
		Skipped    int `json:"skipped"`
		Failed     int `json:"failed"`
	} `json:"_shards"`
	Hits struct {
		Total struct {
			Value    int    `json:"value"`
			Relation string `json:"relation"`
		} `json:"total"`
		MaxScore float64 `json:"max_score"`
		Hits     []struct {
			Index  string  `json:"_index"`
			Type   string  `json:"_type"`
			ID     string  `json:"_id"`
			Score  float64 `json:"_score"`
			Source struct {
				Name  string `json:"name"`
				Token string `json:"token"`
			} `json:"_source"`
		} `json:"hits"`
	} `json:"hits"`
}

ESTokenSchema for AuthToken

type HTTPClientProvider

type HTTPClientProvider interface {
	Request(url string, method string, header map[string]string, body []byte, params map[string]string) (statusCode int, resBody []byte, err error)
}

HTTPClientProvider used in connecting to remote http server

type JSONWebKeys

type JSONWebKeys struct {
	Kty string   `json:"kty"`
	Kid string   `json:"kid"`
	Use string   `json:"use"`
	N   string   `json:"n"`
	E   string   `json:"e"`
	X5c []string `json:"x5c"`
}

JSONWebKeys auth0 token key

type Jwks

type Jwks struct {
	Keys []JSONWebKeys `json:"keys"`
}

Jwks result from auth0 well know keys

type LastActionSchema

type LastActionSchema struct {
	Took     int  `json:"took"`
	TimedOut bool `json:"timed_out"`
	Shards   struct {
		Total      int `json:"total"`
		Successful int `json:"successful"`
		Skipped    int `json:"skipped"`
		Failed     int `json:"failed"`
	} `json:"_shards"`
	Hits struct {
		Total struct {
			Value    int    `json:"value"`
			Relation string `json:"relation"`
		} `json:"total"`
		MaxScore float64 `json:"max_score"`
		Hits     []struct {
			Index  string  `json:"_index"`
			Type   string  `json:"_type"`
			ID     string  `json:"_id"`
			Score  float64 `json:"_score"`
			Source struct {
				Date time.Time `json:"date"`
			} `json:"_source"`
		} `json:"hits"`
	} `json:"hits"`
}

LastActionSchema ...

type RefreshResult

type RefreshResult string

RefreshResult ...

const (
	// RefreshError ...
	RefreshError RefreshResult = "error refreshing auth0 token"
	// RefreshSuccessful ...
	RefreshSuccessful RefreshResult = "token refreshed successfully"
	// NotExpireSoon ...
	NotExpireSoon RefreshResult = "token will not expire soon"
)

type Resp

type Resp struct {
	AccessToken string `json:"access_token"`
	Scope       string `json:"scope"`
	ExpiresIn   int    `json:"expires_in"`
	TokenType   string `json:"token_type"`
}

Resp struct

type SlackProvider

type SlackProvider interface {
	SendText(text string) error
}

SlackProvider ...

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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