idp

package
v0.0.0-...-5f71cfe Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2022 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppMetadata

type AppMetadata struct {
	// Oldsecway account id to update in the IDP
	// maps to wt_account_id when json.marshal
	WTAccountId string `json:"wt_account_id"`
}

AppMetadata user app metadata to associate with a profile

type Auth0ClientConfig

type Auth0ClientConfig struct {
	Audience     string
	AuthIssuer   string
	ClientID     string
	ClientSecret string
	GrantType    string
}

Auth0ClientConfig auth0 manager client configurations

type Auth0Credentials

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

Auth0Credentials auth0 authentication information

func (*Auth0Credentials) Authenticate

func (c *Auth0Credentials) Authenticate() (JWTToken, error)

Authenticate retrieves access token to use the Auth0 Management API

type Auth0Manager

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

Auth0Manager auth0 manager client instance

func NewAuth0Manager

func NewAuth0Manager(config Auth0ClientConfig) (*Auth0Manager, error)

NewAuth0Manager creates a new instance of the Auth0Manager

func (*Auth0Manager) GetAccount

func (am *Auth0Manager) GetAccount(accountID string) ([]*UserData, error)

GetAccount returns all the users for a given profile. Calls Auth0 API.

func (*Auth0Manager) GetAllAccounts

func (am *Auth0Manager) GetAllAccounts() (map[string][]*UserData, error)

GetAllAccounts gets all registered accounts with corresponding user data. It returns a list of users indexed by accountID.

func (*Auth0Manager) GetUserDataByID

func (am *Auth0Manager) GetUserDataByID(userID string, appMetadata AppMetadata) (*UserData, error)

GetUserDataByID requests user data from auth0 via ID

func (*Auth0Manager) UpdateUserAppMetadata

func (am *Auth0Manager) UpdateUserAppMetadata(userID string, appMetadata AppMetadata) error

UpdateUserAppMetadata updates user app metadata based on userId and metadata map

type Config

type Config struct {
	ManagerType            string
	Auth0ClientCredentials Auth0ClientConfig
}

Config an idp configuration struct to be loaded from management server's config file

type JWTToken

type JWTToken struct {
	AccessToken string `json:"access_token"`
	ExpiresIn   int    `json:"expires_in"`

	Scope     string `json:"scope"`
	TokenType string `json:"token_type"`
	// contains filtered or unexported fields
}

JWTToken a JWT object that holds information of a token

type JsonParser

type JsonParser struct{}

func (JsonParser) Marshal

func (JsonParser) Marshal(v interface{}) ([]byte, error)

func (JsonParser) Unmarshal

func (JsonParser) Unmarshal(data []byte, v interface{}) error

type Manager

type Manager interface {
	UpdateUserAppMetadata(userId string, appMetadata AppMetadata) error
	GetUserDataByID(userId string, appMetadata AppMetadata) (*UserData, error)
	GetAccount(accountId string) ([]*UserData, error)
	GetAllAccounts() (map[string][]*UserData, error)
}

Manager idp manager interface

func NewManager

func NewManager(config Config) (Manager, error)

NewManager returns a new idp manager based on the configuration that it receives

type ManagerCredentials

type ManagerCredentials interface {
	Authenticate() (JWTToken, error)
}

ManagerCredentials interface that authenticates using the credential of each type of idp

type ManagerHTTPClient

type ManagerHTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

ManagerHTTPClient http client interface for API calls

type ManagerHelper

type ManagerHelper interface {
	Marshal(v interface{}) ([]byte, error)
	Unmarshal(data []byte, v interface{}) error
}

ManagerHelper helper

type UserData

type UserData struct {
	Email string `json:"email"`
	Name  string `json:"name"`
	ID    string `json:"user_id"`
}

Jump to

Keyboard shortcuts

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