sac

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateBearerToken

func CreateBearerToken(ctx context.Context, username, password, tenant string) (string, error)

CreateBearerToken creates a bearer token for the given username, password, and tenant.

Types

type Account

type Account struct {
	Name string
	ID   string
}

type AuthResponse

type AuthResponse struct {
	AccessToken      string `json:"access_token"`
	ExpiresIn        int    `json:"expires_in"`
	Scope            string `json:"scope"`
	Error            string `json:"error"`
	ErrorDescription string `json:"error_description"`
}

type Client

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

func NewClient

func NewClient(httpClient *http.Client, tenant, token string) *Client

func (*Client) GetPolicy added in v0.0.4

func (c *Client) GetPolicy(ctx context.Context, policyId string) (Policy, error)

GetPolicy returns a policy by ID.

func (*Client) ListAllGroups

func (c *Client) ListAllGroups(ctx context.Context) ([]Group, error)

ListAllGroups returns a list of all groups for all identity providers.

func (*Client) ListAllPolicies added in v0.0.4

func (c *Client) ListAllPolicies(ctx context.Context) ([]Policy, error)

ListAllPolicies returns a paginated list of all policies.

func (*Client) ListAllUsers

func (c *Client) ListAllUsers(ctx context.Context) ([]User, error)

ListAllUsers returns a list of all users for all identity providers.

func (*Client) ListGroupMembers

func (c *Client) ListGroupMembers(ctx context.Context, identityProviderId string, groupId string, nextPage string) ([]User, PaginationData, error)

ListGroupUsers returns a list of users for the given identity provider id and group id.

func (*Client) ListGroupsPerProvider

func (c *Client) ListGroupsPerProvider(ctx context.Context, identityProviderId string, nextPage string) ([]Group, PaginationData, error)

ListGroups returns a list of groups for the given identity provider id.

func (*Client) ListIdentityProviderIDs added in v0.0.8

func (c *Client) ListIdentityProviderIDs(ctx context.Context) ([]string, error)

ListIdentityProviderIDs returns a list of identity provider ids.

func (*Client) ListPolicies added in v0.0.4

func (c *Client) ListPolicies(ctx context.Context, pageNumber int) ([]Policy, PaginationData, error)

List Policies returns a list of policies.

func (*Client) ListUsersPerProvider

func (c *Client) ListUsersPerProvider(ctx context.Context, identityProviderId string, nextPage string) ([]User, PaginationData, error)

ListUserPerProvider returns a list of users for the given identity provider id.

type DirectoryEntity added in v0.0.4

type DirectoryEntity struct {
	ID                   string `json:"id"`
	IdentifierInProvider string `json:"identifierInProvider"`
	IdentityProviderID   string `json:"identityProviderId"`
	IdentityProviderType string `json:"identityProviderType"`
	Type                 string `json:"type"`
	DisplayName          string `json:"displayName"`
}

Either User or Group.

type Group

type Group struct {
	ID                 string `json:"id"`
	Name               string `json:"name"`
	RepositoryType     string `json:"repository_type"`
	IdentityProviderID string `json:"identity_provider_id"`
}

type IdentityProvider

type IdentityProvider struct {
	ID              string      `json:"id"`
	Name            string      `json:"name"`
	Provider        string      `json:"provider"`
	IsAuthenticator bool        `json:"is_authenticator"`
	IsUserStore     bool        `json:"is_user_store"`
	AuthenticatorID interface{} `json:"authenticator_id"`
}

type PaginationData

type PaginationData struct {
	First            bool   `json:"first"`
	Last             bool   `json:"last"`
	Size             int    `json:"size"`
	TotalElements    int    `json:"totalElements"`
	PerPage          int    `json:"perPage"`
	NextPage         string `json:"nextPage"`
	TotalPages       int    `json:"totalPages"`
	Number           int    `json:"number"`
	NumberOfElements int    `json:"numberOfElements"`
}

type Policy added in v0.0.4

type Policy struct {
	ID                string            `json:"id"`
	Name              string            `json:"name"`
	Type              string            `json:"type"`
	Enabled           bool              `json:"enabled"`
	CreatedAt         string            `json:"createdAt"`
	DirectoryEntities []DirectoryEntity `json:"directoryEntities"`
	PolicyAccess      string            `json:"PolicyAccess"`
}

type User

type User struct {
	Username           string `json:"username"`
	FirstName          string `json:"first_name"`
	LastName           string `json:"last_name"`
	Email              string `json:"email"`
	RepositoryType     string `json:"repository_type"`
	IsAdmin            bool   `json:"is_admin"`
	IsDeleted          bool   `json:"is_deleted"`
	Blocked            bool   `json:"blocked"`
	NotificationEmail  string `json:"notification_email"`
	ID                 string `json:"id"`
	IdentityProviderID string `json:"identity_provider_id"`
}

Jump to

Keyboard shortcuts

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