frontegg

package
v0.8.7 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2024 License: MPL-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SSORolesApiPathV1 = "/frontegg/team/resources/sso/v1/configurations/%s/roles"
	SSORolesApiPathV2 = "/identity/resources/roles/v2"
)
View Source
const (
	UsersApiPathV1       = "/identity/resources/users/v1"
	UsersApiPathV2       = "/identity/resources/users/v2"
	UsersApiPathV3       = "/identity/resources/users/v3"
	TeamMembersApiPathV1 = "/frontegg/team/resources/members/v1"
)
View Source
const (
	SCIM2ConfigurationsApiPathV1 = "/frontegg/directory/resources/v1/configurations/scim2"
)
View Source
const (
	SCIMGroupsApiPathV1 = "/frontegg/identity/resources/groups/v1"
)
View Source
const (
	SSOConfigurationsApiPathV1 = "/frontegg/team/resources/sso/v1/configurations"
)
View Source
const (
	SSODomainsApiPathV1 = "/frontegg/team/resources/sso/v1/configurations"
)
View Source
const (
	SSOGroupMappingApiPathV1 = "/frontegg/team/resources/sso/v1/configurations"
)
View Source
const (
	TenantApiTokenPath = "/identity/resources/tenants/api-tokens/v1"
)
View Source
const (
	UserApiTokenPath = "/identity/resources/users/api-tokens/v1"
)

Variables

This section is empty.

Functions

func AddRolesToGroup added in v0.6.10

func AddRolesToGroup(ctx context.Context, client *clients.FronteggClient, groupId string, roleIds []string) error

AddRolesToGroup adds roles to an existing group in Frontegg.

func AddUsersToGroup added in v0.6.10

func AddUsersToGroup(ctx context.Context, client *clients.FronteggClient, groupId string, userIds []string) error

AddUsersToGroup adds users to an existing group in Frontegg.

func ClearSSODefaultRoles added in v0.6.8

func ClearSSODefaultRoles(ctx context.Context, client *clients.FronteggClient, configID string) error

ClearSSODefaultRoles clears the default roles for an SSO configuration.

func DeleteSCIM2Configuration added in v0.6.9

func DeleteSCIM2Configuration(ctx context.Context, client *clients.FronteggClient, id string) error

DeleteSCIM2Configuration deletes an existing SCIM 2.0 configuration

func DeleteSCIMGroup added in v0.6.10

func DeleteSCIMGroup(ctx context.Context, client *clients.FronteggClient, groupID string) error

DeleteSCIMGroup deletes an existing group in Frontegg.

func DeleteSSOConfiguration added in v0.6.7

func DeleteSSOConfiguration(ctx context.Context, client *clients.FronteggClient, configId string) error

DeleteSSOConfiguration deletes an existing SSO configuration

func DeleteSSODomain added in v0.6.8

func DeleteSSODomain(ctx context.Context, client *clients.FronteggClient, configID, domainID string) error

DeleteSSODomain deletes a specific SSO domain.

func DeleteSSOGroupMapping added in v0.6.8

func DeleteSSOGroupMapping(ctx context.Context, client *clients.FronteggClient, ssoConfigID, groupID string) error

DeleteSSOGroupMapping deletes an existing SSO group role mapping.

func DeleteTenantApiToken added in v0.8.1

func DeleteTenantApiToken(ctx context.Context, client *clients.FronteggClient, id string) error

func DeleteUser added in v0.6.6

func DeleteUser(ctx context.Context, client *clients.FronteggClient, userID string) error

DeleteUser deletes a user from Frontegg.

func DeleteUserApiToken added in v0.8.1

func DeleteUserApiToken(ctx context.Context, client *clients.FronteggClient, id string) error

func FetchSSOConfigurationsRaw added in v0.6.9

func FetchSSOConfigurationsRaw(ctx context.Context, client *clients.FronteggClient) ([]byte, error)

FetchSSOConfigurationsRaw fetches the raw SSO configurations

func FlattenRoles added in v0.6.9

func FlattenRoles(roles []ScimRole) []interface{}

Helper function to flatten the roles data

func FlattenSCIM2Configurations

func FlattenSCIM2Configurations(configurations SCIM2ConfigurationsResponse) []interface{}

Helper function to flatten the SCIM 2.0 configurations data

func FlattenSSOConfigurations added in v0.6.7

func FlattenSSOConfigurations(configurations SSOConfigurationsResponse) []interface{}

Helper function to flatten the SSO configurations data

func FlattenScimGroups added in v0.6.9

func FlattenScimGroups(groups []ScimGroup) []interface{}

Helper function to flatten the groups data

func FlattenUsers added in v0.6.9

func FlattenUsers(users []ScimUser) []interface{}

Helper function to flatten the users data

func GetSSODefaultRoles added in v0.6.8

func GetSSODefaultRoles(ctx context.Context, client *clients.FronteggClient, configID string) ([]string, error)

GetSSODefaultRoles retrieves the default roles for an SSO configuration.

func GetSSOGroupMappings added in v0.6.8

func GetSSOGroupMappings(ctx context.Context, client *clients.FronteggClient, ssoConfigID string) (*[]GroupMapping, error)

GetSSOGroupMappings retrieves all SSO group role mappings for a specific SSO configuration.

func GetTenantApiTokenApiEndpoint added in v0.8.1

func GetTenantApiTokenApiEndpoint(client *clients.FronteggClient, resourcePath string, resourceID ...string) string

Helper function to construct the full API endpoint for a tenant API token.

func GetUserApiTokenApiEndpoint added in v0.8.1

func GetUserApiTokenApiEndpoint(client *clients.FronteggClient, resourcePath string, resourceID ...string) string

Helper function to construct the full API endpoint for a user API token.

func ListFronteggRoles added in v0.8.3

func ListFronteggRoles(ctx context.Context, client *clients.FronteggClient) (map[string]string, error)

ListRoles fetches roles from the Frontegg API and returns a map of role names to their IDs.

func RemoveRolesFromGroup added in v0.6.10

func RemoveRolesFromGroup(ctx context.Context, client *clients.FronteggClient, groupId string, roleIds []string) error

RemoveRolesFromGroup removes roles from an existing group in Frontegg.

func RemoveUsersFromGroup added in v0.6.10

func RemoveUsersFromGroup(ctx context.Context, client *clients.FronteggClient, groupId string, userIds []string) error

RemoveUsersFromGroup removes users from an existing group in Frontegg.

func SetSSODefaultRoles added in v0.6.8

func SetSSODefaultRoles(ctx context.Context, client *clients.FronteggClient, configID string, roleIDs []string) error

SetSSODefaultRoles sets the default roles for an SSO configuration.

func UpdateSCIMGroup added in v0.6.10

func UpdateSCIMGroup(ctx context.Context, client *clients.FronteggClient, groupID string, params GroupUpdateParams) error

UpdateSCIMGroup updates an existing group in Frontegg.

func UpdateUserRoles added in v0.8.4

func UpdateUserRoles(ctx context.Context, client *clients.FronteggClient, userID string, email string, roleIDs []string) error

Types

type AddRolesToGroupParams added in v0.6.10

type AddRolesToGroupParams struct {
	RoleIds []string `json:"roleIds"`
}

AddRolesToGroupParams represents the parameters for adding roles to a group.

type Domain added in v0.6.7

type Domain struct {
	ID          string `json:"id"`
	Domain      string `json:"domain"`
	Validated   bool   `json:"validated"`
	SsoConfigId string `json:"ssoConfigId"`
}

Domain represents the structure for SSO domain.

func CreateSSODomain added in v0.6.8

func CreateSSODomain(ctx context.Context, client *clients.FronteggClient, configID, domainName string) (*Domain, error)

CreateDomain creates a new SSO domain.

func FetchSSODomain added in v0.6.8

func FetchSSODomain(ctx context.Context, client *clients.FronteggClient, configID, domainName string) (*Domain, error)

FetchSSODomain fetches a specific SSO domain.

type FronteggRole added in v0.6.8

type FronteggRole struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type FronteggRolesResponse added in v0.6.8

type FronteggRolesResponse struct {
	Items    []FronteggRole `json:"items"`
	Metadata struct {
		TotalItems int `json:"totalItems"`
		TotalPages int `json:"totalPages"`
	} `json:"_metadata"`
}

type GroupCreateParams added in v0.6.10

type GroupCreateParams struct {
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
	Color       string `json:"color,omitempty"`
	Metadata    string `json:"metadata,omitempty"`
}

GroupCreateParams represents the parameters for creating a new group.

type GroupMapping added in v0.6.8

type GroupMapping struct {
	ID          string   `json:"id"`
	Group       string   `json:"group"`
	Enabled     bool     `json:"enabled"`
	RoleIds     []string `json:"roleIds"`
	SsoConfigId string   `json:"-"`
}

GroupMapping represents the structure for SSO group role mapping.

func CreateSSOGroupMapping added in v0.6.8

func CreateSSOGroupMapping(ctx context.Context, client *clients.FronteggClient, ssoConfigID, group string, roleIDs []string) (*GroupMapping, error)

CreateSSOGroupMapping creates a new SSO group role mapping.

func FetchSSOGroupMapping added in v0.6.8

func FetchSSOGroupMapping(ctx context.Context, client *clients.FronteggClient, ssoConfigID, groupID string) (*GroupMapping, error)

FetchSSOGroupMapping retrieves a specific SSO group role mapping.

func UpdateSSOGroupMapping added in v0.6.8

func UpdateSSOGroupMapping(ctx context.Context, client *clients.FronteggClient, ssoConfigID, groupID, group string, roleIDs []string) (*GroupMapping, error)

UpdateSSOGroupMapping updates an existing SSO group role mapping.

type GroupUpdateParams added in v0.6.10

type GroupUpdateParams struct {
	Name        string `json:"name,omitempty"`
	Description string `json:"description,omitempty"`
	Color       string `json:"color,omitempty"`
	Metadata    string `json:"metadata,omitempty"`
}

GroupUpdateParams represents the parameters for updating an existing group.

type QueryUsersParams added in v0.8.3

type QueryUsersParams struct {
	IncludeSubTenants bool   `url:"_includeSubTenants,omitempty"`
	Limit             int    `url:"_limit,omitempty"`
	Offset            int    `url:"_offset,omitempty"`
	Email             string `url:"_email,omitempty"`
	TenantID          string `url:"_tenantId,omitempty"`
	IDs               string `url:"ids,omitempty"`
	SortBy            string `url:"_sortBy,omitempty"`
	Order             string `url:"_order,omitempty"`
}

type RoleIDs added in v0.6.8

type RoleIDs struct {
	RoleIds []string `json:"roleIds"`
}

type SCIM2Configuration

type SCIM2Configuration struct {
	ID                   string    `json:"id"`
	Source               string    `json:"source"`
	TenantID             string    `json:"tenantId"`
	ConnectionName       string    `json:"connectionName"`
	SyncToUserManagement bool      `json:"syncToUserManagement"`
	CreatedAt            time.Time `json:"createdAt"`
	Token                string    `json:"token"`
}

SCIM 2.0 Configurations API response

func CreateSCIM2Configuration added in v0.6.9

func CreateSCIM2Configuration(ctx context.Context, client *clients.FronteggClient, config SCIM2Configuration) (*SCIM2Configuration, error)

CreateSCIM2Configuration creates a new SCIM 2.0 configuration

type SCIM2ConfigurationsResponse

type SCIM2ConfigurationsResponse []SCIM2Configuration

func FetchSCIM2Configurations

func FetchSCIM2Configurations(ctx context.Context, client *clients.FronteggClient) (SCIM2ConfigurationsResponse, error)

FetchSCIM2Configurations fetches the SCIM 2.0 configurations

type SCIMGroupsResponse added in v0.6.9

type SCIMGroupsResponse struct {
	Groups []ScimGroup `json:"groups"`
}

SCIMGroupsResponse represents the overall structure of the response from the SCIM groups API.

type SSOConfig added in v0.6.7

type SSOConfig struct {
	Id                string    `json:"id"`
	Enabled           bool      `json:"enabled"`
	SsoEndpoint       string    `json:"ssoEndpoint"`
	PublicCertificate string    `json:"publicCertificate"`
	SignRequest       bool      `json:"signRequest"`
	AcsUrl            string    `json:"acsUrl"`
	SpEntityId        string    `json:"spEntityId"`
	Type              string    `json:"type"`
	OidcClientId      string    `json:"oidcClientId"`
	OidcSecret        string    `json:"oidcSecret"`
	CreatedAt         time.Time `json:"createdAt"`
	Domains           []Domain
}

SSOConfig represents the structure for SSO configuration.

func CreateSSOConfiguration added in v0.6.7

func CreateSSOConfiguration(ctx context.Context, client *clients.FronteggClient, ssoConfig SSOConfig) (*SSOConfig, error)

CreateSSOConfiguration creates a new SSO configuration

func UpdateSSOConfiguration added in v0.6.7

func UpdateSSOConfiguration(ctx context.Context, client *clients.FronteggClient, ssoConfig SSOConfig) (*SSOConfig, error)

UpdateSSOConfiguration updates an existing SSO configuration

type SSOConfigurationsResponse added in v0.6.7

type SSOConfigurationsResponse []SSOConfig

func FetchSSOConfigurations added in v0.6.7

func FetchSSOConfigurations(ctx context.Context, client *clients.FronteggClient) (SSOConfigurationsResponse, error)

FetchSSOConfigurations fetches the SSO configurations

type ScimGroup added in v0.6.9

type ScimGroup struct {
	ID          string     `json:"id"`
	Name        string     `json:"name"`
	Description string     `json:"description"`
	Metadata    string     `json:"metadata"`
	Roles       []ScimRole `json:"roles"`
	Users       []ScimUser `json:"users"`
	ManagedBy   string     `json:"managedBy"`
}

ScimGroup represents the structure of a group in the response.

func CreateSCIMGroup added in v0.6.10

func CreateSCIMGroup(ctx context.Context, client *clients.FronteggClient, params GroupCreateParams) (*ScimGroup, error)

CreateSCIMGroup creates a new group in Frontegg.

func FetchSCIMGroups added in v0.6.9

func FetchSCIMGroups(ctx context.Context, client *clients.FronteggClient) ([]ScimGroup, error)

FetchSCIMGroups fetches all SCIM groups.

func GetSCIMGroupByID added in v0.6.10

func GetSCIMGroupByID(ctx context.Context, client *clients.FronteggClient, groupID string) (*ScimGroup, error)

GetSCIMGroupByID fetches a single SCIM group by its ID.

type ScimRole added in v0.6.9

type ScimRole struct {
	ID          string `json:"id"`
	Key         string `json:"key"`
	Name        string `json:"name"`
	Description string `json:"description"`
	IsDefault   bool   `json:"is_default"`
}

ScimRole represents the structure of a role within a group.

type ScimUser added in v0.6.9

type ScimUser struct {
	ID    string `json:"id"`
	Name  string `json:"name"`
	Email string `json:"email"`
}

ScimUser represents the structure of a user within a group.

type TenantApiTokenRequest added in v0.8.1

type TenantApiTokenRequest struct {
	Description string            `json:"description"`
	Metadata    map[string]string `json:"metadata"`
	RoleIDs     []string          `json:"roleIds"`
}

type TenantApiTokenResponse added in v0.8.1

type TenantApiTokenResponse struct {
	ClientID        string            `json:"clientId"`
	Description     string            `json:"description"`
	Secret          string            `json:"secret"`
	CreatedByUserId string            `json:"createdByUserId"`
	Metadata        map[string]string `json:"metadata"`
	CreatedAt       time.Time         `json:"createdAt"`
	RoleIDs         []string          `json:"roleIds"`
}

func CreateTenantApiToken added in v0.8.1

func CreateTenantApiToken(ctx context.Context, client *clients.FronteggClient, request TenantApiTokenRequest) (TenantApiTokenResponse, error)

func ListTenantApiTokens added in v0.8.1

func ListTenantApiTokens(ctx context.Context, client *clients.FronteggClient) ([]TenantApiTokenResponse, error)

ListTenantApiTokens fetches a list of tenant API tokens from the API.

type UserApiTokenRequest added in v0.8.1

type UserApiTokenRequest struct {
	Description string `json:"description"`
}

type UserApiTokenResponse added in v0.8.1

type UserApiTokenResponse struct {
	ClientID    string    `json:"clientId"`
	Description string    `json:"description"`
	CreatedAt   time.Time `json:"created_at"`
	Secret      string    `json:"secret"`
}

func CreateUserApiToken added in v0.8.1

func CreateUserApiToken(ctx context.Context, client *clients.FronteggClient, request UserApiTokenRequest) (UserApiTokenResponse, error)

func ListUserApiTokens added in v0.8.1

func ListUserApiTokens(ctx context.Context, client *clients.FronteggClient) ([]UserApiTokenResponse, error)

ListUserApiTokens fetches a list of user API tokens from the API.

type UserRequest added in v0.6.6

type UserRequest struct {
	Email           string   `json:"email"`
	RoleIDs         []string `json:"roleIds"`
	SkipInviteEmail bool     `json:"skipInviteEmail"`
}

UserRequest represents the request payload for creating or updating a user.

type UserResponse added in v0.6.6

type UserResponse struct {
	ID                string     `json:"id"`
	Email             string     `json:"email"`
	ProfilePictureURL string     `json:"profilePictureUrl"`
	Verified          bool       `json:"verified"`
	Metadata          string     `json:"metadata"`
	Provider          string     `json:"provider"`
	Roles             []UserRole `json:"roles"`
}

UserResponse represents the structure of a user response from Frontegg APIs.

func CreateUser added in v0.6.6

func CreateUser(ctx context.Context, client *clients.FronteggClient, userRequest UserRequest) (UserResponse, error)

CreateUser creates a new user in Frontegg.

func GetUsers added in v0.8.3

func GetUsers(ctx context.Context, client *clients.FronteggClient, params QueryUsersParams) ([]UserResponse, error)

func ReadUser added in v0.6.6

func ReadUser(ctx context.Context, client *clients.FronteggClient, userID string) (UserResponse, error)

ReadUser retrieves a user's details from Frontegg.

type UserRole added in v0.6.10

type UserRole struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
}

Jump to

Keyboard shortcuts

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