saviynt

package module
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AnalyticsLimitDefault = 50
	AnalyticsLimitMax     = 500
)
View Source
const (
	RelURLLogin         = "/ECM/api/login"
	RelOAuthAccessToken = "/ECM/oauth/access_token" // #nosec G101
	RelURLECM           = "/ECM"
	RelURLAPI           = "/api/v5"

	RelURLLoginRuntimeControlsData = "/fetchRuntimeControlsDataV2" // API at https://documenter.getpostman.com/view/23973797/2s9XxwutWR#b821cc21-ee7c-49e3-9433-989ed87b2b03
	RelURLUserGetAccessDetails     = "/getAccessDetailsForUser"
	RelURLPasswordChange           = "/changePassword"
	RelURLUserGet                  = "/getUser"
	RelURLUserUpdate               = "/updateUser"

	EnvSaviyntServerURL = "SAVIYNT_SERVER_URL"
	EnvSaviyntUsername  = "SAVIYNT_USERNAME"
	EnvSaviyntPassword  = "SAVIYNT_PASSWORD"
)

Variables

View Source
var (
	ErrClientNotSet       = errors.New("saviynt.Client must be set")
	ErrSimpleClientNotSet = errors.New("simple client must be set")
)

Functions

func GetTokenPassword added in v0.2.0

func GetTokenPassword(ctx context.Context, baseURL, username, password string, useBasicAuth bool) (*oauth2.Token, error)

func GetTokenRefresh added in v0.2.0

func GetTokenRefresh(ctx context.Context, baseURL, refreshToken string) (*oauth2.Token, error)

Types

type AnalyticsRequest

type AnalyticsRequest struct {
	AnalyticsName string `json:"analyticsname"`
	AnalyticsID   string `json:"analyticsid"`
	Requestor     string `json:"requestor"`
	Attributes    any    `json:"attributes,omitempty"`
	Max           string `json:"max,omitempty"`
	Offset        string `json:"offset,omitempty"`
}

type AnalyticsRequestAttributes

type AnalyticsRequestAttributes struct {
	TimeFrame string `json:"timeFrame"`
}

type AnalyticsResponse added in v0.2.0

type AnalyticsResponse struct {
	DisplayCount int                 `json:"displaycount"`
	Msg          string              `json:"msg"`
	TotalCount   int                 `json:"totalcount"`
	Results      []map[string]string `json:"results"`
}

type AnalyticsService added in v0.5.0

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

func NewAnalyticsService added in v0.5.0

func NewAnalyticsService(client *Client) *AnalyticsService

func (*AnalyticsService) FetchRuntimeControlsDataV2 added in v0.5.0

func (svc *AnalyticsService) FetchRuntimeControlsDataV2(analyticsName, requestor, analyticsID string, attrs map[string]any, limit, offset uint) (*httpsimple.Request, *http.Response, error)

FetchRuntimeControlsDataV2 returns data from the `fetchRuntimeControlsDataV2` API endpoint. `analyticsName` is required. `requestor`, and `analyticsID` are optional.

type ChangePasswordOpts added in v0.3.0

type ChangePasswordOpts struct {
	// Username specifies the name of the user for whom you need to change the password.
	Username string `json:"username"`

	// Password specifies the new password.
	Password string `json:"password"`

	// ChangePasswordAssociatedAccounts specifies whether to create the corresponding Change Password task, if `true`. You can specify `false` to only update the user password. The default value is `true`.
	ChangePasswordAssociatedAccounts bool `json:"changePasswordAssociatedAccounts"`

	// Endpoint specifies a list of endpoints (comma-separated) to update the password for
	// if `ChangePasswordAssociatedAccounts` is set to `true`.
	Endpoint []string `json:"endpoint"`

	// SetARSTaskSource specifies whether to set the source column in the `arstasks`
	// table with the `changeOwnPasswordFromAPI` value. When the source column in `arstasks`
	// table is set to the `changeOwnPasswordFromAPI` value then the `pwdLastSet` parameter is
	// not set to `0“ for Active Directory (AD). The default value is `false`.  Note: If your
	// AD password has expired (pwdLastSet = 0), you are forced to choose a new password in EIC
	// on the next login.
	SetARSTaskSource bool `json:"setarstasksource"`

	// UpdateUserPassword specifies whether to update the user password when
	// `ChangePasswordAssociatedAccounts` is set to `true`. Setting this to `true` specifies
	// when `ChangePasswordAssociatedAccounts` is `true` updates the user password and creates
	// the corresponding Change Password task. When set to `false“, only the Change Password
	// task is created. The default value is true.
	UpdateUserPassword bool `json:"updateUserPassword"`

	// ValidateAgainstPolicy specifies whether the new password conforms to the USER scope
	// password policy. If you do not want to apply the password policy, then specify `N`.
	// The default value is `Y`.
	ValidateAgainstPolicy bool `json:"validateagainstpolicy"`
}

func (ChangePasswordOpts) Values added in v0.3.0

func (opts ChangePasswordOpts) Values() url.Values

type Client

type Client struct {
	BaseURL      string
	Path         string
	HTTPClient   *http.Client
	SimpleClient *httpsimple.Client
	Token        *oauth2.Token
	AnalyticsAPI *AnalyticsService
	PasswordAPI  *PasswordService
	UsersAPI     *UsersService
}

func NewClient

func NewClient(ctx context.Context, baseURL, path, username, password string) (*Client, error)

func (*Client) BuildURL added in v0.3.0

func (c *Client) BuildURL(endpointRelPath string) string

func (Client) ConnectionSaveTest added in v0.2.0

func (c Client) ConnectionSaveTest()

func (*Client) GetTokenPassword added in v0.2.0

func (c *Client) GetTokenPassword(ctx context.Context, username, password string) (*oauth2.Token, error)

func (*Client) GetTokenRefresh added in v0.2.0

func (c *Client) GetTokenRefresh(ctx context.Context) (*oauth2.Token, error)

type ConnectionParamsRESTOpts added in v0.2.0

type ConnectionParamsRESTOpts struct {
	ConnectionJSON string
	ImportUserJSON string
}

func (*ConnectionParamsRESTOpts) TrimSpace added in v0.2.0

func (opts *ConnectionParamsRESTOpts) TrimSpace()

func (*ConnectionParamsRESTOpts) Values added in v0.2.0

func (opts *ConnectionParamsRESTOpts) Values() url.Values

type ConnectionSaveTestOpts added in v0.2.0

type ConnectionSaveTestOpts struct {
	ConnectionType string
	SaveConnection bool
	ConnectionName string
	Params         Values
}

func (ConnectionSaveTestOpts) Values added in v0.2.0

func (opts ConnectionSaveTestOpts) Values() url.Values

type GetUserResponse added in v0.2.0

type GetUserResponse struct {
	Msg          string      `json:"msg"`
	DisplayCount string      `json:"displaycount"`
	TotalCount   string      `json:"totalcount"`
	ErrorCode    string      `json:"errorCode"`
	UserDetails  UserDetails `json:"userdetails"`
}

type LoginRequest

type LoginRequest struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

type PasswordService added in v0.3.0

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

func NewPasswordService added in v0.3.0

func NewPasswordService(client *Client) *PasswordService

func (*PasswordService) ChangePassword added in v0.3.0

func (svc *PasswordService) ChangePassword(opts ChangePasswordOpts) (*http.Response, error)

type UserDetails added in v0.2.0

type UserDetails struct {
	City      string `json:"city"`
	Email     string `json:"email"`
	Enabled   string `json:"enabled"`
	FirstName string `json:"firstname"`
	LastName  string `json:"lastname"`
	State     string `json:"state"`
	Username  string `json:"username"`
}

func (*UserDetails) SCIMUser added in v0.2.0

func (ud *UserDetails) SCIMUser() (scim.User, error)

type UserLoginAccessDetail added in v0.2.0

type UserLoginAccessDetail struct {
	Data       string `json:"data,omitempty"`
	Message    string `json:"message,omitempty"`
	ObjectName string `json:"objectName,omitempty"`
}

type UsersService added in v0.4.0

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

func NewUsersService added in v0.4.0

func NewUsersService(client *Client) *UsersService

func (*UsersService) GetUserAccessDetails added in v0.4.0

func (svc *UsersService) GetUserAccessDetails()

func (*UsersService) GetUserByUsername added in v0.4.0

func (svc *UsersService) GetUserByUsername(username string) (*GetUserResponse, []byte, *http.Response, error)

func (*UsersService) UpdateUsers added in v0.4.0

func (svc *UsersService) UpdateUsers(matchField, matchValue string, attrs map[string]any) (*httpsimple.Request, *http.Response, error)

type Values added in v0.2.0

type Values interface {
	Values() url.Values
}

Jump to

Keyboard shortcuts

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