Documentation ¶
Index ¶
- func NewError(code ErrorCode, f string, a ...interface{}) error
- type AgentLogin
- type AgentLoginResponse
- type CreateAgentBody
- type CreateAgentRequest
- type CreateAgentResponse
- type DeleteSSHKeysBody
- type DeleteSSHKeysRequest
- type DischargeTokenForUserRequest
- type DischargeTokenForUserResponse
- type Error
- type ErrorCode
- type GetUserGroupsWithIDRequest
- type GetUserWithIDRequest
- type Groups
- type GroupsResponse
- type IDPChoice
- type IDPChoiceDetails
- type LoginMethods
- type ModifyGroups
- type ModifyUserGroupsRequest
- type PublicKeyRequest
- type PublicKeyResponse
- type PutSSHKeysBody
- type PutSSHKeysRequest
- type QueryUsersRequest
- type SSHKeysRequest
- type SSHKeysResponse
- type SetUserExtraInfoItemRequest
- type SetUserExtraInfoRequest
- type SetUserGroupsRequest
- type SetUserRequest
- type User
- type UserExtraInfoItemRequest
- type UserExtraInfoRequest
- type UserGroupsRequest
- type UserIDPGroupsRequest
- type UserRequest
- type UserTokenRequest
- type Username
- type VerifyTokenRequest
- type WhoAmIRequest
- type WhoAmIResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AgentLogin ¶
type AgentLogin struct { Username Username `json:"username"` PublicKey *bakery.PublicKey `json:"public_key"` }
AgentLogin contains the claimed identity the agent is attempting to use to log in.
type AgentLoginResponse ¶
type AgentLoginResponse struct {
AgentLogin bool `json:"agent_login"`
}
AgentLoginResponse contains the response to an agent login attempt.
type CreateAgentBody ¶
type CreateAgentBody struct { FullName string `json:"fullname"` Groups []string `json:"idpgroups"` PublicKeys []*bakery.PublicKey `json:"public_keys"` // A parent agent is one that can create its own agents. A parent // agent does not have an owner and so remains a member of the // groups it has been allocated irrespective of whether the // creating user remains a member. Only users in the write-user // ACL can create a parent agent. Parent bool `json:"parent,omitempty"` }
CreateAgentBody holds the body of a CreateAgentRequest. There must be at least one public key specified.
type CreateAgentRequest ¶
type CreateAgentRequest struct { httprequest.Route `httprequest:"POST /v1/u"` CreateAgentBody `httprequest:",body"` }
CreateAgentRequest is a request to add an agent.
type CreateAgentResponse ¶
type CreateAgentResponse struct {
Username Username
}
CreateAgentResponse holds the response from a CreateAgentRequest.
type DeleteSSHKeysBody ¶
type DeleteSSHKeysBody struct {
SSHKeys []string `json:"ssh-keys"`
}
DeleteSSHKeysBody holds the body of a DeleteSSHKeysRequest.
type DeleteSSHKeysRequest ¶
type DeleteSSHKeysRequest struct { httprequest.Route `httprequest:"DELETE /v1/u/:username/ssh-keys"` Username Username `httprequest:"username,path"` Body DeleteSSHKeysBody `httprequest:",body"` }
DeleteSSHKeysRequest is a request to remove ssh keys from the list of ssh keys associated with the user.
type DischargeTokenForUserRequest ¶
type DischargeTokenForUserRequest struct { httprequest.Route `httprequest:"GET /v1/discharge-token-for-user"` Username Username `httprequest:"username,form"` }
DischargeTokenForUserRequest is the request to get a discharge token for a specific user.
type DischargeTokenForUserResponse ¶
DischargeTokenForUserResponse holds the discharge token, in the form of a macaroon, for the requested user.
type Error ¶
type Error struct { Message string `json:"message,omitempty"` Code ErrorCode `json:"code,omitempty"` }
Error represents an error - it is returned for any response that fails.
type ErrorCode ¶
type ErrorCode string
ErrorCode holds the class of an error in machine-readable format. It is also an error in its own right.
type GetUserGroupsWithIDRequest ¶
type GetUserGroupsWithIDRequest struct { httprequest.Route `httprequest:"GET /v1/uid/:UserID/groups"` UserID string `httprequest:",path"` }
GetUserGroupsWithIDRequest is a request for the groups of the user with the given ID.
type GetUserWithIDRequest ¶
type GetUserWithIDRequest struct { httprequest.Route `httprequest:"GET /v1/uid/:UserID"` UserID string `httprequest:",path"` }
GetUserWithIDRequest is a request for the user details of the user with the given ID.
type Groups ¶
type Groups struct {
Groups []string `json:"groups"`
}
Groups contains a list of group names.
type GroupsResponse ¶
type GroupsResponse struct {
Groups []string `json:"groups"`
}
GroupsResponse is the response to a GetUserGroupsWithIDRequest.
type IDPChoice ¶
type IDPChoice struct {
IDPs []IDPChoiceDetails `json:"idps"`
}
IDPChoice lists available IDPs for authentication.
type IDPChoiceDetails ¶
type IDPChoiceDetails struct { Domain string `json:"domain"` Description string `json:"description"` Icon string `json:"icon"` Name string `json:"name"` URL string `json:"url"` }
IDPChoiceDetails provides details about a IDP choice for authentication.
type LoginMethods ¶
type LoginMethods struct { // Agent is the endpoint to connect to, if the client wishes to // authenticate as an agent. Agent string `json:"agent,omitempty"` // Interactive is the endpoint to connect to, if the user can // interact with the login process. Interactive string `json:"interactive,omitempty"` // UbuntuSSOOAuth is the endpoint to send a request, signed with // UbuntuSSO OAuth credentials, to if the client wishes to use // oauth to log in to Identity Manager. Ubuntu SSO uses oauth 1.0. UbuntuSSOOAuth string `json:"usso_oauth,omitempty"` // UbuntuSSODischarge allows login to be performed by discharging // a macaroon with a third-party caveat addressed to Ubuntu SSO. UbuntuSSODischarge string `json:"usso_discharge,omitempty"` // Form is the endpoint to GET a schema for a login form which // can be presented to the user in an interactive manner. The // schema will be returned as an environschema.Fields object. The // completed form should be POSTed back to the same endpoint. Form string `json:"form,omitempty"` }
LoginMethods holds the response from the /login endpoint when called with "Accept: application/json". This enumerates the available methods for the client to log in.
type ModifyGroups ¶
ModifyGroups contains a set of group list modifications.
type ModifyUserGroupsRequest ¶
type ModifyUserGroupsRequest struct { httprequest.Route `httprequest:"POST /v1/u/:username/groups"` Username Username `httprequest:"username,path"` Groups ModifyGroups `httprequest:",body"` }
ModifyUserGroupsRequest is a request to update the list of groups associated with the specified user.
type PublicKeyRequest ¶
type PublicKeyRequest struct {
httprequest.Route `httprequest:"GET /publickey"`
}
PublicKeyRequest documents the /publickey endpoint. As it contains no request information there is no need to ever create one.
type PublicKeyResponse ¶
PublicKeyResponse is the response to a PublicKeyRequest.
type PutSSHKeysBody ¶
PutSSHKeysBody holds the body of a PutSSHKeysRequest.
type PutSSHKeysRequest ¶
type PutSSHKeysRequest struct { httprequest.Route `httprequest:"PUT /v1/u/:username/ssh-keys"` Username Username `httprequest:"username,path"` Body PutSSHKeysBody `httprequest:",body"` }
PutSSHKeysRequest is a request to set ssh keys to the list of ssh keys associated with the user.
type QueryUsersRequest ¶
type QueryUsersRequest struct { httprequest.Route `httprequest:"GET /v1/u"` // ExternalID, if present, matches all identities with the given // external ID (there should be a maximum of 1). ExternalID string `httprequest:"external_id,form"` // EMail, if present, matches all identities with the given email // address. Email string `httprequest:"email,form"` // LastLoginSince, if present, must contain a time marshaled as // if using Time.MarshalText. It matches all identies that have a // last login time after the given time. LastLoginSince string `httprequest:"last-login-since,form"` // LastDischargeSince, if present, must contain a time marshaled as // if using Time.MarshalText. It matches all identies that have a // last discharge time after the given time. LastDischargeSince string `httprequest:"last-discharge-since,form"` // Owner, if present, matches all agent identities with the given // owner. Owner string `httprequest:"owner,form"` }
QueryUsersRequest is a request to query the users in the system.
type SSHKeysRequest ¶
type SSHKeysRequest struct { httprequest.Route `httprequest:"GET /v1/u/:username/ssh-keys"` Username Username `httprequest:"username,path"` }
SSHKeysRequest is a request for the list of ssh keys associated with the specified user.
type SSHKeysResponse ¶
type SSHKeysResponse struct {
SSHKeys []string `json:"ssh_keys"`
}
UserSSHKeysResponse holds a response to the GET /v1/u/:username/ssh-keys containing list of ssh keys associated with the user.
type SetUserExtraInfoItemRequest ¶
type SetUserExtraInfoItemRequest struct { httprequest.Route `httprequest:"PUT /v1/u/:username/extra-info/:item"` Username Username `httprequest:"username,path"` Item string `httprequest:"item,path"` Data interface{} `httprequest:",body"` }
SetUserExtraInfoItemRequest is a request to update a single element of the arbitrary extra information stored about the user.
type SetUserExtraInfoRequest ¶
type SetUserExtraInfoRequest struct { httprequest.Route `httprequest:"PUT /v1/u/:username/extra-info"` Username Username `httprequest:"username,path"` ExtraInfo map[string]interface{} `httprequest:",body"` }
SetUserExtraInfoRequest is a request to updated the arbitrary extra information stored about the user.
type SetUserGroupsRequest ¶
type SetUserGroupsRequest struct { httprequest.Route `httprequest:"PUT /v1/u/:username/groups"` Username Username `httprequest:"username,path"` Groups Groups `httprequest:",body"` }
SetUserGroupsRequest is a request to set the list of groups associated with the specified user.
type SetUserRequest ¶
type SetUserRequest struct { httprequest.Route `httprequest:"PUT /v1/u/:username"` Username Username `httprequest:"username,path"` User `httprequest:",body"` }
SetUserRequest is a request to set the details of a user. This endpoint is no longer functional.
type User ¶
type User struct { Username Username `json:"username,omitempty"` ExternalID string `json:"external_id"` FullName string `json:"fullname"` Email string `json:"email"` GravatarID string `json:"gravatar_id"` IDPGroups []string `json:"idpgroups"` Owner Username `json:"owner,omitempty"` PublicKeys []*bakery.PublicKey `json:"public_keys"` SSHKeys []string `json:"ssh_keys"` LastLogin *time.Time `json:"last_login,omitempty"` LastDischarge *time.Time `json:"last_discharge,omitempty"` }
User represents a user in the system.
type UserExtraInfoItemRequest ¶
type UserExtraInfoItemRequest struct { httprequest.Route `httprequest:"GET /v1/u/:username/extra-info/:item"` Username Username `httprequest:"username,path"` Item string `httprequest:"item,path"` }
UserExtraInfoItemRequest is a request for a single element of the arbitrary extra information stored about the user.
type UserExtraInfoRequest ¶
type UserExtraInfoRequest struct { httprequest.Route `httprequest:"GET /v1/u/:username/extra-info"` Username Username `httprequest:"username,path"` }
UserExtraInfoRequest is a request for the arbitrary extra information stored about the user.
type UserGroupsRequest ¶
type UserGroupsRequest struct { httprequest.Route `httprequest:"GET /v1/u/:username/groups"` Username Username `httprequest:"username,path"` }
UserGroupsRequest is a request for the list of groups associated with the specified user.
type UserIDPGroupsRequest ¶
type UserIDPGroupsRequest struct { httprequest.Route `httprequest:"GET /v1/u/:username/idpgroups"` UserGroupsRequest }
UserIDPGroupsRequest defines the deprecated path for UserGroupsRequest. It should no longer be used.
type UserRequest ¶
type UserRequest struct { httprequest.Route `httprequest:"GET /v1/u/:username"` Username Username `httprequest:"username,path"` }
UserRequest is a request for the user details of the named user.
type UserTokenRequest ¶
type UserTokenRequest struct { httprequest.Route `httprequest:"GET /v1/u/:username/macaroon"` Username Username `httprequest:"username,path"` }
UserTokenRequest is a request for a new token to represent the user.
type Username ¶
type Username string
Username represents the name of a user.
func (*Username) UnmarshalText ¶
UnmarshalText unmarshals a Username checking it is valid. It implements "encoding".TextUnmarshaler.
type VerifyTokenRequest ¶
type VerifyTokenRequest struct { httprequest.Route `httprequest:"POST /v1/verify"` Macaroons macaroon.Slice `httprequest:",body"` }
VerifyTokenRequest is a request to verify that the provided macaroon.Slice is valid and represents a user from identity.
type WhoAmIRequest ¶
type WhoAmIRequest struct {
httprequest.Route `httprequest:"GET /v1/whoami"`
}
WhoAmIRequest holds parameters for requesting the current user name.
type WhoAmIResponse ¶
type WhoAmIResponse struct {
User string `json:"user"`
}
WhoAmIResponse holds information on the currently authenticated user.