identitysync

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2023 License: AGPL-3.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IDPTypeCognito  = "cognito"
	IDPTypeOkta     = "okta"
	IDPTypeAzureAD  = "azure"
	IDPTypeGoogle   = "google"
	IDPTypeAWSSSO   = "aws-sso"
	IDPTypeOneLogin = "one-login"
)
View Source
const ADAuthorityHost = "https://login.microsoftonline.com"
View Source
const MSGraphBaseURL = "https://graph.microsoft.com/v1.0"

Variables

This section is empty.

Functions

This section is empty.

Types

type AWSSSO

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

func (*AWSSSO) Config

func (s *AWSSSO) Config() gconfig.Config

func (*AWSSSO) Init

func (s *AWSSSO) Init(ctx context.Context) error

func (*AWSSSO) ListGroups

func (a *AWSSSO) ListGroups(ctx context.Context) ([]identity.IDPGroup, error)

func (*AWSSSO) ListUsers

func (a *AWSSSO) ListUsers(ctx context.Context) ([]identity.IDPUser, error)

type AddUserToGroupOpts

type AddUserToGroupOpts struct {
	UserID  string
	GroupID string
}

type AzureGroup

type AzureGroup struct {
	ID          string `json:"id"`
	Description string `json:"description"`
	DisplayName string `json:"displayName"`
}

type AzureSync

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

func (*AzureSync) Config

func (s *AzureSync) Config() gconfig.Config

func (*AzureSync) GetMemberGroups

func (a *AzureSync) GetMemberGroups(userID string) ([]string, error)

func (*AzureSync) Init

func (s *AzureSync) Init(ctx context.Context) error

func (*AzureSync) ListGroups

func (a *AzureSync) ListGroups(ctx context.Context) ([]identity.IDPGroup, error)

func (*AzureSync) ListUsers

func (a *AzureSync) ListUsers(ctx context.Context) ([]identity.IDPUser, error)

func (*AzureSync) TestConfig

func (s *AzureSync) TestConfig(ctx context.Context) error

type AzureUser

type AzureUser struct {
	GivenName string `json:"givenName"`
	Mail      string `json:"mail"`
	// this maps to a users email by convention
	// see the graph API spec for details
	// in practice all users have a principal name but some users may not have the "mail" property for different reasons.
	// we use this for the email
	UserPrincipalName string `json:"userPrincipalName"`
	Surname           string `json:"surname"`
	ID                string `json:"id"`
}

properties of a user in the graph API

https://docs.microsoft.com/en-us/graph/api/resources/user?view=graph-rest-1.0#properties

type CognitoSync

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

func (*CognitoSync) AddUserToGroup

func (c *CognitoSync) AddUserToGroup(ctx context.Context, in AddUserToGroupOpts) error

func (*CognitoSync) AdminCreateGroup added in v0.12.0

func (c *CognitoSync) AdminCreateGroup(ctx context.Context, in CreateGroupOpts) (identity.IDPGroup, error)

func (*CognitoSync) AdminCreateUser added in v0.12.0

func (c *CognitoSync) AdminCreateUser(ctx context.Context, in CreateUserOpts) (identity.IDPUser, error)

func (*CognitoSync) AdminUpdateUserGroups added in v0.12.0

func (c *CognitoSync) AdminUpdateUserGroups(ctx context.Context, in UpdateUserGroupsOpts) error

func (*CognitoSync) Config

func (s *CognitoSync) Config() gconfig.Config

func (*CognitoSync) Init

func (s *CognitoSync) Init(ctx context.Context) error

func (*CognitoSync) ListGroups

func (c *CognitoSync) ListGroups(ctx context.Context) ([]identity.IDPGroup, error)

func (*CognitoSync) ListUsers

func (c *CognitoSync) ListUsers(ctx context.Context) ([]identity.IDPUser, error)

func (*CognitoSync) RemoveUserFromGroup

func (c *CognitoSync) RemoveUserFromGroup(ctx context.Context, in RemoveUserFromGroupOpts) error

type CreateGroupOpts

type CreateGroupOpts struct {
	Name        string
	Description string
}

type CreateUserOpts

type CreateUserOpts struct {
	FirstName string
	LastName  string
	Email     string
}

type GetAccessTokenResponse

type GetAccessTokenResponse struct {
	AccessToken  string    `json:"access_token"`
	CreatedAt    time.Time `json:"created_at"`
	ExpiresIn    int       `json:"expires_in"`
	RefreshToken string    `json:"refresh_token"`
	TokenType    string    `json:"token_type"`
	AccountID    int       `json:"account_id"`
}

type GoogleSync

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

func (*GoogleSync) Config

func (s *GoogleSync) Config() gconfig.Config

func (*GoogleSync) Init

func (s *GoogleSync) Init(ctx context.Context) error

func (*GoogleSync) ListGroups

func (c *GoogleSync) ListGroups(ctx context.Context) ([]identity.IDPGroup, error)

func (*GoogleSync) ListUsers

func (c *GoogleSync) ListUsers(ctx context.Context) ([]identity.IDPUser, error)

func (*GoogleSync) TestConfig

func (s *GoogleSync) TestConfig(ctx context.Context) error

type IdentityProvider

type IdentityProvider interface {
	ListUsers(ctx context.Context) ([]identity.IDPUser, error)
	ListGroups(ctx context.Context) ([]identity.IDPGroup, error)
	gconfig.Configer
	gconfig.Initer
}

type IdentityProviderRegistry

type IdentityProviderRegistry struct {
	IdentityProviders map[string]RegisteredIdentityProvider
}

func Registry

func Registry() IdentityProviderRegistry

func (IdentityProviderRegistry) CLIOptions

func (r IdentityProviderRegistry) CLIOptions() []string

func (IdentityProviderRegistry) FromCLIOption

func (r IdentityProviderRegistry) FromCLIOption(opt string) (key string, p RegisteredIdentityProvider, err error)

func (IdentityProviderRegistry) Lookup

Lookup a provider by the 'uses' string.

type IdentitySyncer

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

func NewIdentitySyncer

func NewIdentitySyncer(ctx context.Context, opts SyncOpts) (*IdentitySyncer, error)

func (*IdentitySyncer) Sync

func (s *IdentitySyncer) Sync(ctx context.Context) error

type ListGroupsResponse

type ListGroupsResponse struct {
	OdataContext  string       `json:"@odata.context"`
	OdataNextLink *string      `json:"@odata.nextLink,omitempty"`
	Value         []AzureGroup `json:"value"`
}

type ListUsersResponse

type ListUsersResponse struct {
	OdataContext  string                   `json:"@odata.context"`
	OdataNextLink *string                  `json:"@odata.nextLink,omitempty"`
	Value         []map[string]interface{} `json:"value"`
}

type OktaSync

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

func (*OktaSync) Config

func (s *OktaSync) Config() gconfig.Config

func (*OktaSync) Init

func (s *OktaSync) Init(ctx context.Context) error

func (*OktaSync) ListGroups

func (o *OktaSync) ListGroups(ctx context.Context) ([]identity.IDPGroup, error)

func (*OktaSync) ListUsers

func (o *OktaSync) ListUsers(ctx context.Context) ([]identity.IDPUser, error)

func (*OktaSync) TestConfig

func (s *OktaSync) TestConfig(ctx context.Context) error

type OneLoginGroup

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

type OneLoginListGroupsResponse

type OneLoginListGroupsResponse struct {
	Status struct {
		Error   bool   `json:"error"`
		Code    int    `json:"code"`
		Type    string `json:"type"`
		Message string `json:"message"`
	} `json:"status"`
	Pagination struct {
		BeforeCursor interface{} `json:"before_cursor"`
		AfterCursor  interface{} `json:"after_cursor"`
		PreviousLink interface{} `json:"previous_link"`
		NextLink     *string     `json:"next_link"`
	} `json:"pagination"`
	Groups []OneLoginGroup `json:"data"`
}

type OneLoginListUserResponse

type OneLoginListUserResponse struct {
	Status struct {
		Error   bool   `json:"error"`
		Code    int    `json:"code"`
		Type    string `json:"type"`
		Message string `json:"message"`
	} `json:"status"`
	Pagination struct {
		BeforeCursor interface{} `json:"before_cursor"`
		AfterCursor  string      `json:"after_cursor"`
		PreviousLink interface{} `json:"previous_link"`
		NextLink     *string     `json:"next_link"`
	} `json:"pagination"`
	Users []OneLoginUser `json:"data"`
}

type OneLoginSync

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

func (*OneLoginSync) Config

func (s *OneLoginSync) Config() gconfig.Config

func (*OneLoginSync) Init

func (s *OneLoginSync) Init(ctx context.Context) error

func (*OneLoginSync) ListGroups

func (s *OneLoginSync) ListGroups(ctx context.Context) ([]identity.IDPGroup, error)

func (*OneLoginSync) ListUsers

func (s *OneLoginSync) ListUsers(ctx context.Context) ([]identity.IDPUser, error)

func (*OneLoginSync) TestConfig

func (s *OneLoginSync) TestConfig(ctx context.Context) error

type OneLoginUser

type OneLoginUser struct {
	ActivatedAt          time.Time   `json:"activated_at"`
	CreatedAt            time.Time   `json:"created_at"`
	Email                string      `json:"email"`
	Username             string      `json:"username"`
	Firstname            string      `json:"firstname"`
	GroupID              int         `json:"group_id"`
	ID                   int         `json:"id"`
	InvalidLoginAttempts int         `json:"invalid_login_attempts"`
	InvitationSentAt     time.Time   `json:"invitation_sent_at"`
	LastLogin            time.Time   `json:"last_login"`
	Lastname             string      `json:"lastname"`
	LockedUntil          interface{} `json:"locked_until"`
	Notes                interface{} `json:"notes"`
	OpenidName           string      `json:"openid_name"`
	LocaleCode           interface{} `json:"locale_code"`
	PasswordChangedAt    time.Time   `json:"password_changed_at"`
	Phone                string      `json:"phone"`
	Status               int         `json:"status"`
	UpdatedAt            time.Time   `json:"updated_at"`
	DistinguishedName    interface{} `json:"distinguished_name"`
	ExternalID           interface{} `json:"external_id"`
	DirectoryID          interface{} `json:"directory_id"`
	MemberOf             []string    `json:"member_of"`
	Samaccountname       interface{} `json:"samaccountname"`
	Userprincipalname    interface{} `json:"userprincipalname"`
	ManagerAdID          interface{} `json:"manager_ad_id"`
	ManagerUserID        int         `json:"manager_user_id"`
	RoleID               []int       `json:"role_id"`
	Company              string      `json:"company"`
	Department           string      `json:"department"`
	Title                string      `json:"title"`
	State                int         `json:"state"`
	TrustedIdpID         interface{} `json:"trusted_idp_id"`
	CustomAttributes     struct {
		Alias  string `json:"alias"`
		Branch string `json:"branch"`
	} `json:"custom_attributes"`
}

type OneLoginUserDetail

type OneLoginUserDetail struct {
	Status struct {
		Error   bool   `json:"error"`
		Code    int    `json:"code"`
		Type    string `json:"type"`
		Message string `json:"message"`
	} `json:"status"`
	Data []struct {
		ActivatedAt          time.Time   `json:"activated_at"`
		CreatedAt            time.Time   `json:"created_at"`
		Email                string      `json:"email"`
		Username             string      `json:"username"`
		Firstname            string      `json:"firstname"`
		GroupID              int         `json:"group_id"`
		ID                   int         `json:"id"`
		InvalidLoginAttempts int         `json:"invalid_login_attempts"`
		InvitationSentAt     time.Time   `json:"invitation_sent_at"`
		LastLogin            time.Time   `json:"last_login"`
		Lastname             string      `json:"lastname"`
		LockedUntil          interface{} `json:"locked_until"`
		Notes                interface{} `json:"notes"`
		OpenidName           string      `json:"openid_name"`
		LocaleCode           interface{} `json:"locale_code"`
		PasswordChangedAt    time.Time   `json:"password_changed_at"`
		Phone                string      `json:"phone"`
		Status               int         `json:"status"`
		UpdatedAt            time.Time   `json:"updated_at"`
		DistinguishedName    interface{} `json:"distinguished_name"`
		ExternalID           interface{} `json:"external_id"`
		DirectoryID          interface{} `json:"directory_id"`
		MemberOf             []string    `json:"member_of"`
		Samaccountname       interface{} `json:"samaccountname"`
		Userprincipalname    interface{} `json:"userprincipalname"`
		ManagerAdID          interface{} `json:"manager_ad_id"`
		ManagerUserID        int         `json:"manager_user_id"`
		RoleID               []int       `json:"role_id"`
		Company              string      `json:"company"`
		Department           string      `json:"department"`
		Title                string      `json:"title"`
		State                int         `json:"state"`
		TrustedIdpID         interface{} `json:"trusted_idp_id"`
		CustomAttributes     struct {
			Alias  string `json:"alias"`
			Branch string `json:"branch"`
		} `json:"custom_attributes"`
	} `json:"data"`
}

type RegisteredIdentityProvider

type RegisteredIdentityProvider struct {
	IdentityProvider IdentityProvider
	Description      string
	DocsID           string
	// Hidden indicates whether the provider should be hidden from the CLI setup options
	Hidden bool
}

type RemoveUserFromGroupOpts

type RemoveUserFromGroupOpts struct {
	UserID  string
	GroupID string
}

type SyncOpts

type SyncOpts struct {
	TableName      string
	IdpType        string
	UserPoolId     string
	IdentityConfig deploy.FeatureMap
}

type UpdateUserGroupsOpts

type UpdateUserGroupsOpts struct {
	UserID string
	Groups []string
}

type UserGroups

type UserGroups struct {
	OdataNextLink *string  `json:"@odata.nextLink,omitempty"`
	OdataContext  string   `json:"@odata.context"`
	Value         []string `json:"value"`
}

Jump to

Keyboard shortcuts

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