Documentation
¶
Index ¶
- Constants
- type Approval
- type AuthContext
- type AuthenticatedRequestor
- func (ag AuthenticatedRequestor) Delete(client *http.Client, config Config, path string, query string) ([]byte, error)
- func (ag AuthenticatedRequestor) Get(client *http.Client, config Config, path string, query string) ([]byte, error)
- func (ag AuthenticatedRequestor) PatchJSON(client *http.Client, config Config, path string, query string, ...) ([]byte, error)
- func (ag AuthenticatedRequestor) PostForm(client *http.Client, config Config, path string, query string, ...) ([]byte, error)
- func (ag AuthenticatedRequestor) PostJSON(client *http.Client, config Config, path string, query string, ...) ([]byte, error)
- func (ag AuthenticatedRequestor) PutJSON(client *http.Client, config Config, path string, query string, ...) ([]byte, error)
- type AuthorizationCodeClient
- type Client
- type ClientCredentialsClient
- type ClientManager
- func (cm *ClientManager) ChangeSecret(id string, newSecret string) error
- func (cm *ClientManager) Create(client Client) (Client, error)
- func (cm *ClientManager) Delete(id string) (Client, error)
- func (cm *ClientManager) Get(id string) (Client, error)
- func (cm *ClientManager) List() ([]Client, error)
- func (cm *ClientManager) Update(client Client) (Client, error)
- type Config
- type CurlManager
- type Email
- type GrantType
- type Group
- type GroupManager
- func (gm GroupManager) AddMember(groupID, userID string) error
- func (gm GroupManager) Create(group Group) (Group, error)
- func (gm GroupManager) Delete(groupID string) (Group, error)
- func (gm GroupManager) Get(id string) (Group, error)
- func (gm GroupManager) GetByName(name, attributes string) (Group, error)
- func (gm GroupManager) List(filter, sortBy, attributes string, sortOrder SortOrder) ([]Group, error)
- func (gm GroupManager) Update(group Group) (Group, error)
- type GroupMember
- type HealthStatus
- type Info
- type JWK
- type Keys
- type Meta
- type PaginatedClientList
- type PaginatedGroupList
- type PaginatedUserList
- type PhoneNumber
- type RefreshTokenClient
- type Requestor
- type ResourceOwnerPasswordClient
- type SortOrder
- type Target
- type TokenFormat
- type TokenResponse
- type UnauthenticatedRequestor
- func (ug UnauthenticatedRequestor) Delete(client *http.Client, config Config, path string, query string) ([]byte, error)
- func (ug UnauthenticatedRequestor) Get(client *http.Client, config Config, path string, query string) ([]byte, error)
- func (ug UnauthenticatedRequestor) PatchJSON(client *http.Client, config Config, path string, query string, ...) ([]byte, error)
- func (ug UnauthenticatedRequestor) PostForm(client *http.Client, config Config, path string, query string, ...) ([]byte, error)
- func (ug UnauthenticatedRequestor) PostJSON(client *http.Client, config Config, path string, query string, ...) ([]byte, error)
- func (ug UnauthenticatedRequestor) PutJSON(client *http.Client, config Config, path string, query string, ...) ([]byte, error)
- type User
- type UserGroup
- type UserInfo
- type UserManager
- func (um UserManager) Activate(userID string, userMetaVersion int) error
- func (um UserManager) Create(user User) (User, error)
- func (um UserManager) Deactivate(userID string, userMetaVersion int) error
- func (um UserManager) Delete(userID string) (User, error)
- func (um UserManager) Get(userID string) (User, error)
- func (um UserManager) GetByUsername(username, origin, attributes string) (User, error)
- func (um UserManager) List(filter, sortBy, attributes string, sortOrder SortOrder) ([]User, error)
- func (um UserManager) Update(user User) (User, error)
- type UserName
Constants ¶
const ( // OK is healthy. OK = HealthStatus("ok") // ERROR is unhealthy. ERROR = HealthStatus("health_error") )
const ( OPAQUE = TokenFormat("opaque") JWT = TokenFormat("jwt") )
Valid TokenFormat values.
const ( REFRESHTOKEN = GrantType("refresh_token") AUTHCODE = GrantType("authorization_code") IMPLICIT = GrantType("implicit") PASSWORD = GrantType("password") CLIENTCREDENTIALS = GrantType("client_credentials") )
Valid GrantType values.
const ( // SortAscending sorts in ascending order. SortAscending = SortOrder("ascending") // SortDescending sorts in descending order. SortDescending = SortOrder("descending") )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Approval ¶
type Approval struct { UserID string `json:"userId,omitempty"` ClientID string `json:"clientId,omitempty"` Scope string `json:"scope,omitempty"` Status string `json:"status,omitempty"` LastUpdatedAt string `json:"lastUpdatedAt,omitempty"` ExpiresAt string `json:"expiresAt,omitempty"` }
Approval is a record of the user's explicit approval or rejection for an application's request for delegated permissions.
type AuthContext ¶ added in v0.0.2
type AuthContext struct { ClientID string `json:"client_id"` GrantType GrantType `json:"grant_type"` Username string `json:"username"` TokenResponse }
AuthContext is a container for the token used to access UAA.
func NewContextWithToken ¶
func NewContextWithToken(accessToken string) AuthContext
NewContextWithToken creates a new config with the given token.
type AuthenticatedRequestor ¶ added in v0.0.2
type AuthenticatedRequestor struct{}
AuthenticatedRequestor makes requests that are authenticated.
func (AuthenticatedRequestor) Delete ¶ added in v0.0.2
func (ag AuthenticatedRequestor) Delete(client *http.Client, config Config, path string, query string) ([]byte, error)
Delete makes a delete request.
func (AuthenticatedRequestor) Get ¶ added in v0.0.2
func (ag AuthenticatedRequestor) Get(client *http.Client, config Config, path string, query string) ([]byte, error)
Get makes a get request.
func (AuthenticatedRequestor) PatchJSON ¶ added in v0.0.2
func (ag AuthenticatedRequestor) PatchJSON(client *http.Client, config Config, path string, query string, body interface{}, extraHeaders map[string]string) ([]byte, error)
PatchJSON makes a patch request.
func (AuthenticatedRequestor) PostForm ¶ added in v0.0.2
func (ag AuthenticatedRequestor) PostForm(client *http.Client, config Config, path string, query string, body map[string]string) ([]byte, error)
PostForm makes a post request.
type AuthorizationCodeClient ¶
AuthorizationCodeClient is used to authenticate with the authorization server.
func (AuthorizationCodeClient) RequestToken ¶
func (acc AuthorizationCodeClient) RequestToken(httpClient *http.Client, config Config, format TokenFormat, code string, redirectURI string) (TokenResponse, error)
RequestToken gets a token from the token endpoint.
type Client ¶ added in v0.0.2
type Client struct { ClientID string `json:"client_id,omitempty"` ClientSecret string `json:"client_secret,omitempty"` Scope []string `json:"scope,omitempty"` ResourceIDs []string `json:"resource_ids,omitempty"` AuthorizedGrantTypes []string `json:"authorized_grant_types,omitempty"` RedirectURI []string `json:"redirect_uri,omitempty"` Authorities []string `json:"authorities,omitempty"` TokenSalt string `json:"token_salt,omitempty"` AllowedProviders []string `json:"allowedproviders,omitempty"` DisplayName string `json:"name,omitempty"` LastModified int64 `json:"lastModified,omitempty"` RequiredUserGroups []string `json:"required_user_groups,omitempty"` AccessTokenValidity int64 `json:"access_token_validity,omitempty"` RefreshTokenValidity int64 `json:"refresh_token_validity,omitempty"` }
Client is a UAA client http://docs.cloudfoundry.org/api/uaa/version/4.14.0/index.html#clients.
type ClientCredentialsClient ¶
ClientCredentialsClient is used to authenticate with the authorization server.
func (ClientCredentialsClient) RequestToken ¶
func (cc ClientCredentialsClient) RequestToken(httpClient *http.Client, config Config, format TokenFormat) (TokenResponse, error)
RequestToken gets a token from the token endpoint.
type ClientManager ¶
ClientManager allows you to interact with the Clients resource.
func (*ClientManager) ChangeSecret ¶
func (cm *ClientManager) ChangeSecret(id string, newSecret string) error
ChangeSecret updates the secret with the given value for the client with the given id http://docs.cloudfoundry.org/api/uaa/version/4.14.0/index.html#change-secret.
func (*ClientManager) Create ¶
func (cm *ClientManager) Create(client Client) (Client, error)
Create the given client http://docs.cloudfoundry.org/api/uaa/version/4.14.0/index.html#create-6.
func (*ClientManager) Delete ¶
func (cm *ClientManager) Delete(id string) (Client, error)
Delete the client with the given ID http://docs.cloudfoundry.org/api/uaa/version/4.14.0/index.html#delete-6.
func (*ClientManager) Get ¶
func (cm *ClientManager) Get(id string) (Client, error)
Get the client with the given ID http://docs.cloudfoundry.org/api/uaa/version/4.14.0/index.html#retrieve-3.
func (*ClientManager) Update ¶
func (cm *ClientManager) Update(client Client) (Client, error)
Update the given client http://docs.cloudfoundry.org/api/uaa/version/4.14.0/index.html#update-6.
type Config ¶
type Config struct { Verbose bool ZoneSubdomain string Targets map[string]Target ActiveTargetName string }
Config is used to access the UAA API.
func NewConfig ¶
func NewConfig() Config
NewConfig creates a config that is initialized with an empty map of targets.
func NewConfigWithServerURL ¶
NewConfigWithServerURL creates a new config with the given URL.
func (*Config) AddContext ¶
func (c *Config) AddContext(newContext AuthContext)
AddContext adds the given context to the active target.
func (*Config) AddTarget ¶
AddTarget adds the given target to the config, and sets the active target to the given target.
func (Config) GetActiveContext ¶
func (c Config) GetActiveContext() AuthContext
GetActiveContext gets the active context.
func (Config) GetActiveTarget ¶
GetActiveTarget gets the active target.
type CurlManager ¶
CurlManager allows you to make arbitrary requests to the UAA API.
type Email ¶ added in v0.0.2
type Email struct { Value string `json:"value,omitempty"` Primary *bool `json:"primary,omitempty"` }
Email is an email address.
type Group ¶ added in v0.0.2
type Group struct { ID string `json:"id,omitempty"` Meta *Meta `json:"meta,omitempty"` DisplayName string `json:"displayName,omitempty"` ZoneID string `json:"zoneId,omitempty"` Description string `json:"description,omitempty"` Members []GroupMember `json:"members,omitempty"` Schemas []string `json:"schemas,omitempty"` }
Group is a container for users and groups.
type GroupManager ¶
GroupManager allows you to interact with the Groups resource.
func (GroupManager) AddMember ¶
func (gm GroupManager) AddMember(groupID, userID string) error
AddMember adds the user with the given ID to the group with the given ID.
func (GroupManager) Create ¶
func (gm GroupManager) Create(group Group) (Group, error)
Create the given group http://docs.cloudfoundry.org/api/uaa/version/4.14.0/index.html#create-5.
func (GroupManager) Delete ¶
func (gm GroupManager) Delete(groupID string) (Group, error)
Delete the group with the given ID http://docs.cloudfoundry.org/api/uaa/version/4.14.0/index.html#delete-5.
func (GroupManager) Get ¶
func (gm GroupManager) Get(id string) (Group, error)
Get the group with the given ID http://docs.cloudfoundry.org/api/uaa/version/4.14.0/index.html#retrieve-2.
func (GroupManager) GetByName ¶
func (gm GroupManager) GetByName(name, attributes string) (Group, error)
GetByName gets the group with the given name http://docs.cloudfoundry.org/api/uaa/version/4.14.0/index.html#list-4.
func (GroupManager) List ¶
func (gm GroupManager) List(filter, sortBy, attributes string, sortOrder SortOrder) ([]Group, error)
List groups http://docs.cloudfoundry.org/api/uaa/version/4.14.0/index.html#list-4.
func (GroupManager) Update ¶
func (gm GroupManager) Update(group Group) (Group, error)
Update the given group http://docs.cloudfoundry.org/api/uaa/version/4.14.0/index.html#update-5.
type GroupMember ¶ added in v0.0.2
type GroupMember struct { Origin string `json:"origin,omitempty"` Type string `json:"type,omitempty"` Value string `json:"value,omitempty"` }
GroupMember is a user or a group.
type HealthStatus ¶ added in v0.0.2
type HealthStatus string
HealthStatus is either ok or an error.
func Health ¶
func Health(target Target) (HealthStatus, error)
Health gets the health of the UAA API.
type Info ¶
type Info struct { App uaaApp `json:"app"` Links uaaLinks `json:"links"` Prompts map[string][]string `json:"prompts"` ZoneName string `json:"zone_name"` EntityID string `json:"entityID"` CommitID string `json:"commit_id"` Timestamp string `json:"timestamp"` IdpDefinitions map[string]string `json:"idpDefinitions"` }
Info is information about the UAA server.
type JWK ¶
type JWK struct { Kty string `json:"kty"` E string `json:"e,omitempty"` Use string `json:"use"` Kid string `json:"kid"` Alg string `json:"alg"` Value string `json:"value"` N string `json:"n,omitempty"` }
JWK represents a JSON Web Key (https://tools.ietf.org/html/rfc7517).
func TokenKey ¶
TokenKey retrieves a JWK from the token_key endpoint (http://docs.cloudfoundry.org/api/uaa/version/4.14.0/index.html#token-key-s).
type Meta ¶ added in v0.0.2
type Meta struct { Version int `json:"version,omitempty"` Created string `json:"created,omitempty"` LastModified string `json:"lastModified,omitempty"` }
Meta describes the version and timestamps for a resource.
type PaginatedClientList ¶
type PaginatedClientList struct { Resources []Client `json:"resources"` StartIndex int `json:"startIndex"` ItemsPerPage int `json:"itemsPerPage"` TotalResults int `json:"totalResults"` Schemas []string `json:"schemas"` }
PaginatedClientList is the response from the API for a single page of clients.
type PaginatedGroupList ¶
type PaginatedGroupList struct { Resources []Group `json:"resources"` StartIndex int `json:"startIndex"` ItemsPerPage int `json:"itemsPerPage"` TotalResults int `json:"totalResults"` Schemas []string `json:"schemas"` }
PaginatedGroupList is the response from the API for a single page of groups.
type PaginatedUserList ¶
type PaginatedUserList struct { Resources []User `json:"resources"` StartIndex int `json:"startIndex"` ItemsPerPage int `json:"itemsPerPage"` TotalResults int `json:"totalResults"` Schemas []string `json:"schemas"` }
PaginatedUserList is the response from the API for a single page of users.
type PhoneNumber ¶
type PhoneNumber struct {
Value string `json:"value"`
}
PhoneNumber is a phone number for a user.
type RefreshTokenClient ¶
RefreshTokenClient is used to authenticate with the authorization server.
func (RefreshTokenClient) RequestToken ¶
func (rc RefreshTokenClient) RequestToken(httpClient *http.Client, config Config, format TokenFormat, refreshToken string) (TokenResponse, error)
RequestToken gets a token from the token endpoint.
type Requestor ¶ added in v0.0.2
type Requestor interface { Get(client *http.Client, config Config, path string, query string) ([]byte, error) Delete(client *http.Client, config Config, path string, query string) ([]byte, error) PostForm(client *http.Client, config Config, path string, query string, body map[string]string) ([]byte, error) PostJSON(client *http.Client, config Config, path string, query string, body interface{}) ([]byte, error) PutJSON(client *http.Client, config Config, path string, query string, body interface{}) ([]byte, error) }
Requestor makes requests with a client.
type ResourceOwnerPasswordClient ¶
type ResourceOwnerPasswordClient struct { ClientID string ClientSecret string Username string Password string }
ResourceOwnerPasswordClient is used to authenticate with the authorization server.
func (ResourceOwnerPasswordClient) RequestToken ¶
func (rop ResourceOwnerPasswordClient) RequestToken(httpClient *http.Client, config Config, format TokenFormat) (TokenResponse, error)
RequestToken gets a token from the token endpoint.
type SortOrder ¶ added in v0.0.2
type SortOrder string
SortOrder defines the sort order when listing users or groups.
type Target ¶
type Target struct { BaseURL string SkipSSLValidation bool Contexts map[string]AuthContext ActiveContextName string }
Target is a UAA endpoint.
func NewTarget ¶
func NewTarget() Target
NewTarget creates a target that is initialized with an empty map of contexts.
func (Target) GetActiveContext ¶
func (t Target) GetActiveContext() AuthContext
GetActiveContext gets the active context.
type TokenResponse ¶
type TokenResponse struct { AccessToken string `json:"access_token"` RefreshToken string `json:"refresh_token"` IDToken string `json:"id_token"` TokenType string `json:"token_type"` ExpiresIn int32 `json:"expires_in"` Scope string `json:"scope"` JTI string `json:"jti"` }
TokenResponse is a token.
type UnauthenticatedRequestor ¶ added in v0.0.2
type UnauthenticatedRequestor struct{}
UnauthenticatedRequestor makes requests that are unauthenticated.
func (UnauthenticatedRequestor) Delete ¶ added in v0.0.2
func (ug UnauthenticatedRequestor) Delete(client *http.Client, config Config, path string, query string) ([]byte, error)
Delete makes a delete request.
func (UnauthenticatedRequestor) Get ¶ added in v0.0.2
func (ug UnauthenticatedRequestor) Get(client *http.Client, config Config, path string, query string) ([]byte, error)
Get makes a get request.
func (UnauthenticatedRequestor) PatchJSON ¶ added in v0.0.2
func (ug UnauthenticatedRequestor) PatchJSON(client *http.Client, config Config, path string, query string, body interface{}) ([]byte, error)
PatchJSON makes a patch request.
func (UnauthenticatedRequestor) PostForm ¶ added in v0.0.2
func (ug UnauthenticatedRequestor) PostForm(client *http.Client, config Config, path string, query string, body map[string]string) ([]byte, error)
PostForm makes a post request.
type User ¶ added in v0.0.2
type User struct { ID string `json:"id,omitempty"` Password string `json:"password,omitempty"` ExternalID string `json:"externalId,omitempty"` Meta *Meta `json:"meta,omitempty"` Username string `json:"userName,omitempty"` Name *UserName `json:"name,omitempty"` Emails []Email `json:"emails,omitempty"` Groups []UserGroup `json:"groups,omitempty"` Approvals []Approval `json:"approvals,omitempty"` PhoneNumbers []PhoneNumber `json:"phoneNumbers,omitempty"` Active *bool `json:"active,omitempty"` Verified *bool `json:"verified,omitempty"` Origin string `json:"origin,omitempty"` ZoneID string `json:"zoneId,omitempty"` PasswordLastModified string `json:"passwordLastModified,omitempty"` PreviousLogonTime int `json:"previousLogonTime,omitempty"` LastLogonTime int `json:"lastLogonTime,omitempty"` Schemas []string `json:"schemas,omitempty"` }
User is a UAA user http://docs.cloudfoundry.org/api/uaa/version/4.14.0/index.html#get-3.
type UserGroup ¶ added in v0.0.2
type UserGroup struct { Value string `json:"value,omitempty"` Display string `json:"display,omitempty"` Type string `json:"type,omitempty"` }
UserGroup is a group that a user belongs to.
type UserInfo ¶ added in v0.0.2
type UserInfo struct { UserID string `json:"user_id"` Sub string `json:"sub"` Username string `json:"user_name"` GivenName string `json:"given_name"` FamilyName string `json:"family_name"` Email string `json:"email"` PhoneNumber []string `json:"phone_number"` PreviousLoginTime int64 `json:"previous_logon_time"` Name string `json:"name"` }
UserInfo is a protected resource required for OpenID Connect compatibility. The response format is defined here: https://openid.net/specs/openid-connect-core-1_0.html#UserInfoResponse.
type UserManager ¶
UserManager allows you to interact with the Users resource.
func (UserManager) Activate ¶
func (um UserManager) Activate(userID string, userMetaVersion int) error
Activate the user with the given user ID http://docs.cloudfoundry.org/api/uaa/version/4.14.0/index.html#patch.
func (UserManager) Create ¶
func (um UserManager) Create(user User) (User, error)
Create the given user http://docs.cloudfoundry.org/api/uaa/version/4.14.0/index.html#create-4.
func (UserManager) Deactivate ¶
func (um UserManager) Deactivate(userID string, userMetaVersion int) error
Deactivate the user with the given user ID http://docs.cloudfoundry.org/api/uaa/version/4.14.0/index.html#patch.
func (UserManager) Delete ¶
func (um UserManager) Delete(userID string) (User, error)
Delete the user with the given user ID http://docs.cloudfoundry.org/api/uaa/version/4.14.0/index.html#delete-4.
func (UserManager) Get ¶
func (um UserManager) Get(userID string) (User, error)
Get the user with the given userID http://docs.cloudfoundry.org/api/uaa/version/4.14.0/index.html#get-3.
func (UserManager) GetByUsername ¶
func (um UserManager) GetByUsername(username, origin, attributes string) (User, error)
GetByUsername gets the user with the given username and origin http://docs.cloudfoundry.org/api/uaa/version/4.14.0/index.html#list-with-attribute-filtering.
func (UserManager) List ¶
func (um UserManager) List(filter, sortBy, attributes string, sortOrder SortOrder) ([]User, error)
List users http://docs.cloudfoundry.org/api/uaa/version/4.14.0/index.html#list-with-attribute-filtering.
func (UserManager) Update ¶
func (um UserManager) Update(user User) (User, error)
Update the given user http://docs.cloudfoundry.org/api/uaa/version/4.14.0/index.html#update-4.