Documentation
¶
Index ¶
- func GeneratePassword(passwordLength, minSpecialChar, minNum, minUpperCase int) string
- type AppMetadata
- type Auth0ClientConfig
- type Auth0Credentials
- type Auth0Manager
- func (am *Auth0Manager) CreateUser(email string, name string, accountID string) (*UserData, error)
- func (am *Auth0Manager) GetAccount(accountID string) ([]*UserData, error)
- func (am *Auth0Manager) GetAllAccounts() (map[string][]*UserData, error)
- func (am *Auth0Manager) GetUserByEmail(email string) ([]*UserData, error)
- func (am *Auth0Manager) GetUserDataByID(userID string, appMetadata AppMetadata) (*UserData, error)
- func (am *Auth0Manager) UpdateUserAppMetadata(userID string, appMetadata AppMetadata) error
- type AzureClientConfig
- type AzureCredentials
- type AzureManager
- func (am *AzureManager) CreateUser(email string, name string, accountID string) (*UserData, error)
- func (am *AzureManager) GetAccount(accountID string) ([]*UserData, error)
- func (am *AzureManager) GetAllAccounts() (map[string][]*UserData, error)
- func (am *AzureManager) GetUserByEmail(email string) ([]*UserData, error)
- func (am *AzureManager) GetUserDataByID(userID string, appMetadata AppMetadata) (*UserData, error)
- func (am *AzureManager) UpdateUserAppMetadata(userID string, appMetadata AppMetadata) error
- type Config
- type JWTToken
- type JsonParser
- type KeycloakClientConfig
- type KeycloakCredentials
- type KeycloakManager
- func (km *KeycloakManager) CreateUser(email string, name string, accountID string) (*UserData, error)
- func (km *KeycloakManager) GetAccount(accountID string) ([]*UserData, error)
- func (km *KeycloakManager) GetAllAccounts() (map[string][]*UserData, error)
- func (km *KeycloakManager) GetUserByEmail(email string) ([]*UserData, error)
- func (km *KeycloakManager) GetUserDataByID(userID string, appMetadata AppMetadata) (*UserData, error)
- func (km *KeycloakManager) UpdateUserAppMetadata(userID string, appMetadata AppMetadata) error
- type Manager
- type ManagerCredentials
- type ManagerHTTPClient
- type ManagerHelper
- type OIDCConfig
- type UserData
- type ZitadelClientConfig
- type ZitadelCredentials
- type ZitadelManager
- func (zm *ZitadelManager) CreateUser(email string, name string, accountID string) (*UserData, error)
- func (zm *ZitadelManager) GetAccount(accountID string) ([]*UserData, error)
- func (zm *ZitadelManager) GetAllAccounts() (map[string][]*UserData, error)
- func (zm *ZitadelManager) GetUserByEmail(email string) ([]*UserData, error)
- func (zm *ZitadelManager) GetUserDataByID(userID string, appMetadata AppMetadata) (*UserData, error)
- func (zm *ZitadelManager) UpdateUserAppMetadata(userID string, appMetadata AppMetadata) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GeneratePassword ¶ added in v0.9.8
GeneratePassword generates user password
Types ¶
type AppMetadata ¶
type AppMetadata struct { // WTAccountID is a NetBird (previously Wiretrustee) account id to update in the IDP // maps to wt_account_id when json.marshal WTAccountID string `json:"wt_account_id,omitempty"` WTPendingInvite *bool `json:"wt_pending_invite"` }
AppMetadata user app metadata to associate with a profile
type Auth0ClientConfig ¶
type Auth0ClientConfig struct { Audience string AuthIssuer string `json:"-"` ClientID string ClientSecret string GrantType string `json:"-"` }
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(oidcConfig OIDCConfig, config Auth0ClientConfig, appMetrics telemetry.AppMetrics) (*Auth0Manager, error)
NewAuth0Manager creates a new instance of the Auth0Manager
func (*Auth0Manager) CreateUser ¶ added in v0.9.8
CreateUser creates a new user in Auth0 Idp and sends an invite
func (*Auth0Manager) GetAccount ¶ added in v0.6.4
func (am *Auth0Manager) GetAccount(accountID string) ([]*UserData, error)
GetAccount returns all the users for a given profile. Calls Auth0 API.
func (*Auth0Manager) GetAllAccounts ¶ added in v0.6.4
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) GetUserByEmail ¶ added in v0.9.8
func (am *Auth0Manager) GetUserByEmail(email string) ([]*UserData, error)
GetUserByEmail searches users with a given email. If no users have been found, this function returns an empty list. This function can return multiple users. This is due to the Auth0 internals - there could be multiple users with the same email but different connections that are considered as separate accounts (e.g., Google and username/password).
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 AzureClientConfig ¶ added in v0.19.0
type AzureClientConfig struct { ClientID string ClientSecret string ObjectID string GraphAPIEndpoint string `json:"-"` TokenEndpoint string `json:"-"` GrantType string `json:"-"` }
AzureClientConfig azure manager client configurations.
type AzureCredentials ¶ added in v0.19.0
type AzureCredentials struct {
// contains filtered or unexported fields
}
AzureCredentials azure authentication information.
func (*AzureCredentials) Authenticate ¶ added in v0.19.0
func (ac *AzureCredentials) Authenticate() (JWTToken, error)
Authenticate retrieves access token to use the azure Management API.
type AzureManager ¶ added in v0.19.0
type AzureManager struct { ClientID string ObjectID string GraphAPIEndpoint string // contains filtered or unexported fields }
AzureManager azure manager client instance.
func NewAzureManager ¶ added in v0.19.0
func NewAzureManager(oidcConfig OIDCConfig, config AzureClientConfig, appMetrics telemetry.AppMetrics) (*AzureManager, error)
NewAzureManager creates a new instance of the AzureManager.
func (*AzureManager) CreateUser ¶ added in v0.19.0
CreateUser creates a new user in azure AD Idp.
func (*AzureManager) GetAccount ¶ added in v0.19.0
func (am *AzureManager) GetAccount(accountID string) ([]*UserData, error)
GetAccount returns all the users for a given profile.
func (*AzureManager) GetAllAccounts ¶ added in v0.19.0
func (am *AzureManager) GetAllAccounts() (map[string][]*UserData, error)
GetAllAccounts gets all registered accounts with corresponding user data. It returns a list of users indexed by accountID.
func (*AzureManager) GetUserByEmail ¶ added in v0.19.0
func (am *AzureManager) GetUserByEmail(email string) ([]*UserData, error)
GetUserByEmail searches users with a given email. If no users have been found, this function returns an empty list.
func (*AzureManager) GetUserDataByID ¶ added in v0.19.0
func (am *AzureManager) GetUserDataByID(userID string, appMetadata AppMetadata) (*UserData, error)
GetUserDataByID requests user data from keycloak via ID.
func (*AzureManager) UpdateUserAppMetadata ¶ added in v0.19.0
func (am *AzureManager) UpdateUserAppMetadata(userID string, appMetadata AppMetadata) error
UpdateUserAppMetadata updates user app metadata based on userID.
type Config ¶
type Config struct { ManagerType string OIDCConfig OIDCConfig `json:"-"` Auth0ClientCredentials Auth0ClientConfig AzureClientCredentials AzureClientConfig KeycloakClientCredentials KeycloakClientConfig ZitadelClientCredentials ZitadelClientConfig }
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 KeycloakClientConfig ¶ added in v0.14.5
type KeycloakClientConfig struct { ClientID string ClientSecret string AdminEndpoint string TokenEndpoint string `json:"-"` GrantType string `json:"-"` }
KeycloakClientConfig keycloak manager client configurations.
type KeycloakCredentials ¶ added in v0.14.5
type KeycloakCredentials struct {
// contains filtered or unexported fields
}
KeycloakCredentials keycloak authentication information.
func (*KeycloakCredentials) Authenticate ¶ added in v0.14.5
func (kc *KeycloakCredentials) Authenticate() (JWTToken, error)
Authenticate retrieves access token to use the keycloak Management API.
type KeycloakManager ¶ added in v0.14.5
type KeycloakManager struct {
// contains filtered or unexported fields
}
KeycloakManager keycloak manager client instance.
func NewKeycloakManager ¶ added in v0.14.5
func NewKeycloakManager(oidcConfig OIDCConfig, config KeycloakClientConfig, appMetrics telemetry.AppMetrics) (*KeycloakManager, error)
NewKeycloakManager creates a new instance of the KeycloakManager.
func (*KeycloakManager) CreateUser ¶ added in v0.14.5
func (km *KeycloakManager) CreateUser(email string, name string, accountID string) (*UserData, error)
CreateUser creates a new user in keycloak Idp and sends an invite.
func (*KeycloakManager) GetAccount ¶ added in v0.14.5
func (km *KeycloakManager) GetAccount(accountID string) ([]*UserData, error)
GetAccount returns all the users for a given profile.
func (*KeycloakManager) GetAllAccounts ¶ added in v0.14.5
func (km *KeycloakManager) GetAllAccounts() (map[string][]*UserData, error)
GetAllAccounts gets all registered accounts with corresponding user data. It returns a list of users indexed by accountID.
func (*KeycloakManager) GetUserByEmail ¶ added in v0.14.5
func (km *KeycloakManager) GetUserByEmail(email string) ([]*UserData, error)
GetUserByEmail searches users with a given email. If no users have been found, this function returns an empty list.
func (*KeycloakManager) GetUserDataByID ¶ added in v0.14.5
func (km *KeycloakManager) GetUserDataByID(userID string, appMetadata AppMetadata) (*UserData, error)
GetUserDataByID requests user data from keycloak via ID.
func (*KeycloakManager) UpdateUserAppMetadata ¶ added in v0.14.5
func (km *KeycloakManager) UpdateUserAppMetadata(userID string, appMetadata AppMetadata) error
UpdateUserAppMetadata updates user app metadata based on userID and metadata map.
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) CreateUser(email string, name string, accountID string) (*UserData, error) GetUserByEmail(email string) ([]*UserData, error) }
Manager idp manager interface
func NewManager ¶
func NewManager(config Config, appMetrics telemetry.AppMetrics) (Manager, error)
NewManager returns a new idp manager based on the configuration that it receives
type ManagerCredentials ¶
ManagerCredentials interface that authenticates using the credential of each type of idp
type ManagerHTTPClient ¶
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 OIDCConfig ¶ added in v0.20.0
OIDCConfig specifies configuration for OpenID Connect provider These configurations are automatically loaded from the OIDC endpoint
type UserData ¶
type UserData struct { Email string `json:"email"` Name string `json:"name"` ID string `json:"user_id"` AppMetadata AppMetadata `json:"app_metadata"` }
type ZitadelClientConfig ¶ added in v0.20.0
type ZitadelClientConfig struct { ClientID string ClientSecret string GrantType string `json:"-"` TokenEndpoint string `json:"-"` ManagementEndpoint string `json:"-"` }
ZitadelClientConfig zitadel manager client configurations.
type ZitadelCredentials ¶ added in v0.20.0
type ZitadelCredentials struct {
// contains filtered or unexported fields
}
ZitadelCredentials zitadel authentication information.
func (*ZitadelCredentials) Authenticate ¶ added in v0.20.0
func (zc *ZitadelCredentials) Authenticate() (JWTToken, error)
Authenticate retrieves access token to use the Zitadel Management API.
type ZitadelManager ¶ added in v0.20.0
type ZitadelManager struct {
// contains filtered or unexported fields
}
ZitadelManager zitadel manager client instance.
func NewZitadelManager ¶ added in v0.20.0
func NewZitadelManager(oidcConfig OIDCConfig, config ZitadelClientConfig, appMetrics telemetry.AppMetrics) (*ZitadelManager, error)
NewZitadelManager creates a new instance of the ZitadelManager.
func (*ZitadelManager) CreateUser ¶ added in v0.20.0
func (zm *ZitadelManager) CreateUser(email string, name string, accountID string) (*UserData, error)
CreateUser creates a new user in zitadel Idp and sends an invite.
func (*ZitadelManager) GetAccount ¶ added in v0.20.0
func (zm *ZitadelManager) GetAccount(accountID string) ([]*UserData, error)
GetAccount returns all the users for a given profile.
func (*ZitadelManager) GetAllAccounts ¶ added in v0.20.0
func (zm *ZitadelManager) GetAllAccounts() (map[string][]*UserData, error)
GetAllAccounts gets all registered accounts with corresponding user data. It returns a list of users indexed by accountID.
func (*ZitadelManager) GetUserByEmail ¶ added in v0.20.0
func (zm *ZitadelManager) GetUserByEmail(email string) ([]*UserData, error)
GetUserByEmail searches users with a given email. If no users have been found, this function returns an empty list.
func (*ZitadelManager) GetUserDataByID ¶ added in v0.20.0
func (zm *ZitadelManager) GetUserDataByID(userID string, appMetadata AppMetadata) (*UserData, error)
GetUserDataByID requests user data from zitadel via ID.
func (*ZitadelManager) UpdateUserAppMetadata ¶ added in v0.20.0
func (zm *ZitadelManager) UpdateUserAppMetadata(userID string, appMetadata AppMetadata) error
UpdateUserAppMetadata updates user app metadata based on userID and metadata map. Metadata values are base64 encoded.