Documentation ¶
Index ¶
- Variables
- type Client
- type ErrorResponse
- type GetUsersOptions
- type Group
- type GroupService
- type Response
- type User
- type UserService
- func (s *UserService) Authenticate(ctx context.Context, username, password, relayState string) (*User, error)
- func (s *UserService) GetUser(ctx context.Context, id string) (*User, error)
- func (s *UserService) GetUsers(ctx context.Context, options *GetUsersOptions) ([]*User, error)
- func (s *UserService) UpdateCustomAttributes(ctx context.Context, id string, attributes map[string]string) error
Constants ¶
This section is empty.
Variables ¶
var (
ErrAuthenticationFailed = errors.New("authentication failed. Please check username/password.")
)
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { BaseURL *url.URL // User agent used when communicating with the Okta api. UserAgent string User *UserService Group *GroupService // contains filtered or unexported fields }
A Client interacts with Okta.
func (*Client) AddAuthorization ¶
AddAuthorization injects the Authorization header to the request. If the client doesn't has an oauthToken, a new token is issed. If the token is expired, it is automatically refreshed.
func (*Client) Do ¶
Do sends an API request and returns the API response. The API response is JSON decoded and stored in the value pointed to by v, or returned as an error if an API error has occurred. If v implements the io.Writer interface, the raw response body will be written to v, without attempting to first decode it.
The provided ctx must be non-nil. If it is canceled or times out, ctx.Err() will be returned.
type ErrorResponse ¶
type ErrorResponse struct { Response *http.Response // HTTP response that caused this error Code int64 Type string Message string }
An ErrorResponse reports an error caused by an API request.
func (*ErrorResponse) Error ¶
func (r *ErrorResponse) Error() string
type GetUsersOptions ¶
type GetUsersOptions struct { // PerPage is the max number of result in a page, // max value defined by Okta is 200. // If set to less than 1 or more than 200, it will be reset to 200. PerPage int // Pages is the max number of pages to retrieve. // If 0, it will page until there's no more results to retrieve. Pages int }
GetUsersOptions allows to specify query options.
type GroupService ¶
type GroupService service
GroupService deals with Okta groups.
func (*GroupService) GetGroupMembership ¶
GetGroupMembership returns all users from a group.
func (*GroupService) GetGroups ¶
func (s *GroupService) GetGroups(ctx context.Context) ([]*Group, error)
GetGroups returns all the Okta groups.
func (*GroupService) GetUserGroups ¶
type User ¶
type User struct { ID string `json:"id"` Status string `json:"status"` LastLogin string `json:"last_login"` Created string `json:"created"` LastUpdated string `json:"last_updated"` PasswordChanged string `json:"password_changed"` Profile map[string]string `json:"profile"` }
User represents a Okta user.
type UserService ¶
type UserService service
UserService handles users operations.
func (*UserService) Authenticate ¶
func (s *UserService) Authenticate(ctx context.Context, username, password, relayState string) (*User, error)
Authenticate the user with username and password. relayState can be used to add additional information.
func (*UserService) GetUsers ¶
func (s *UserService) GetUsers(ctx context.Context, options *GetUsersOptions) ([]*User, error)
GetUsers returns all the users.
func (*UserService) UpdateCustomAttributes ¶
func (s *UserService) UpdateCustomAttributes(ctx context.Context, id string, attributes map[string]string) error
UpdateCustomAttributes returns a user.