Documentation
¶
Index ¶
- Constants
- func Init(portalProxy api.PortalProxy) (api.StratosPlugin, error)
- type CFError
- type ClientConfig
- type Config
- type EmailTemplateParams
- type OrgRolesResponse
- type RetrieveOrgRolesResponse
- type SMTPConfig
- type StatusResponse
- type TemplateConfig
- type UAAUserInviteReq
- type UserInvite
- func (userinvite *UserInvite) AddAdminGroupRoutes(echoGroup *echo.Group)
- func (userinvite *UserInvite) AddSessionGroupRoutes(echoGroup *echo.Group)
- func (invite *UserInvite) AssociateSpaceRoleForUser(cnsiGUID, userID, newUserGUID, spaceGUID, roleName string) (*CFError, error)
- func (invite *UserInvite) AssociateSpaceRoles(cnsiGUID, userID, newUserGUID string, inviteRequest *UserInviteReq) (*CFError, error)
- func (invite *UserInvite) AssociateUserWithOrg(cnsiGUID, userID, newUserGUID, orgGUID string) (*CFError, error)
- func (invite *UserInvite) Connect(echoContext echo.Context, cnsiRecord api.CNSIRecord, userId string) (*api.TokenRecord, bool, error)
- func (invite *UserInvite) CreateCloudFoundryUser(cnsiGUID, userID, newUserGUID string) (*CFError, error)
- func (userinvite *UserInvite) GetEndpointPlugin() (api.EndpointPlugin, error)
- func (userinvite *UserInvite) GetMiddlewarePlugin() (api.MiddlewarePlugin, error)
- func (userinvite *UserInvite) GetRoutePlugin() (api.RoutePlugin, error)
- func (invite *UserInvite) GetType() string
- func (invite *UserInvite) Info(apiEndpoint string, skipSSLValidation bool, caCert string) (api.CNSIRecord, interface{}, error)
- func (userinvite *UserInvite) Init() error
- func (userinvite *UserInvite) LoadConfig(env env.VarSet) (*Config, error)
- func (invite *UserInvite) RefreshToken(cfGUID, clientID, clientSecret string) (*api.UAAResponse, *api.TokenRecord, error)
- func (invite *UserInvite) Register(echoContext echo.Context) error
- func (invite *UserInvite) SendEmail(emailAddress, inviteLink string, endpoint api.CNSIRecord) error
- func (invite *UserInvite) UAAUserInvite(c echo.Context, endpoint api.CNSIRecord, uaaInviteReq *UserInviteReq) (*UserInviteResponse, error)
- func (invite *UserInvite) UpdateMetadata(info *api.Info, userGUID string, echoContext echo.Context)
- func (invite *UserInvite) Validate(userGUID string, cnsiRecord api.CNSIRecord, tokenRecord api.TokenRecord) error
- func (userinvite *UserInvite) ValidateConfig(c *Config) error
- type UserInviteReq
- type UserInviteResponse
- type UserInviteUser
Constants ¶
const UAAClientAuthType = "uaa-client"
UAAClientAuthType is the Auth Type for client id/client secret
const UserInvitePluginConfigSetting = "userInvitationsEnabled"
UserInvitePluginConfigSetting is config value send back to the client to indicate if user invite is enabled
const UserInviteUserID = "00000000-1111-2222-3333-444444444455"
UserInviteUserID is the User ID for the user invitation token
Variables ¶
This section is empty.
Functions ¶
func Init ¶
func Init(portalProxy api.PortalProxy) (api.StratosPlugin, error)
Init creates a new UserInvite
Types ¶
type CFError ¶
type CFError struct {
Description string `json:"description"`
ErrorCode string `json:"error_code"`
Code int `json:"code"`
}
CFError is the error info returned from the CF API
type ClientConfig ¶
type ClientConfig struct {
ID string `configName:"INVITE_USER_CLIENT_ID"`
Secret string `configName:"INVITE_USER_CLIENT_SECRET"`
}
UAA Client details used to create uaa & cf user
type Config ¶
type Config struct {
SMTP *SMTPConfig
TemplateConfig *TemplateConfig
PlainTextTemplate *text.Template
HTMLTemplate *html.Template
SubjectTemplate *text.Template
Client *ClientConfig
}
Config represents the configuration required
type EmailTemplateParams ¶
type EmailTemplateParams struct {
InviteLink string
EmailAddress string
EndpointName string
EndpointURL string
}
EmailTemplateParams is the supported params for the email templates
type OrgRolesResponse ¶
type RetrieveOrgRolesResponse ¶
type RetrieveOrgRolesResponse struct {
TotalResults int `json:"total_results"`
Resources []OrgRolesResponse `json:"resources"`
}
RetrieveOrgRolesResponse is the response from the CF GET Org Roles API
type SMTPConfig ¶
type SMTPConfig struct {
Auth bool `configName:"SMTP_AUTH"`
FromAddress string `configName:"SMTP_FROM_ADDRESS"`
Host string `configName:"SMTP_HOST"`
Password string `configName:"SMTP_PASSWORD"`
Port int `configName:"SMTP_PORT"`
Username string `configName:"SMTP_USER"`
}
SMTPConfig represents email configuration
type StatusResponse ¶
type TemplateConfig ¶
type TemplateConfig struct {
TemplateDir string `configName:"TEMPLATE_DIR"`
HTMLTemplate string `configName:"INVITE_USER_HTML_TEMPLATE"`
PlainTextTemplate string `configName:"INVITE_USER_TEXT_TEMPLATE"`
Subject string `configName:"INVITE_USER_SUBJECT"`
}
TemplateConfig configures the templates for sending emails
type UAAUserInviteReq ¶
type UAAUserInviteReq struct {
Emails []string `json:"emails"`
}
UAAUserInviteReq is the structure to send to the UAA Invite Users API
type UserInvite ¶
type UserInvite struct {
Config *Config
// contains filtered or unexported fields
}
UserInvite is a plugin to allow user invitations
func (*UserInvite) AddAdminGroupRoutes ¶
func (userinvite *UserInvite) AddAdminGroupRoutes(echoGroup *echo.Group)
AddAdminGroupRoutes adds the admin routes for this plugin to the Echo server
func (*UserInvite) AddSessionGroupRoutes ¶
func (userinvite *UserInvite) AddSessionGroupRoutes(echoGroup *echo.Group)
AddSessionGroupRoutes adds the session routes for this plugin to the Echo server
func (*UserInvite) AssociateSpaceRoleForUser ¶
func (invite *UserInvite) AssociateSpaceRoleForUser(cnsiGUID, userID, newUserGUID, spaceGUID, roleName string) (*CFError, error)
AssociateSpaceRoleForUser associates a user in the space with the given role
func (*UserInvite) AssociateSpaceRoles ¶
func (invite *UserInvite) AssociateSpaceRoles(cnsiGUID, userID, newUserGUID string, inviteRequest *UserInviteReq) (*CFError, error)
AssociateSpaceRoles will make the CF API call to associate the correct space roles for the user
func (*UserInvite) AssociateUserWithOrg ¶
func (invite *UserInvite) AssociateUserWithOrg(cnsiGUID, userID, newUserGUID, orgGUID string) (*CFError, error)
AssociateUserWithOrg will make the CF API call to associate the given user with the given org
func (*UserInvite) Connect ¶
func (invite *UserInvite) Connect(echoContext echo.Context, cnsiRecord api.CNSIRecord, userId string) (*api.TokenRecord, bool, error)
Connect is not implemented
func (*UserInvite) CreateCloudFoundryUser ¶
func (invite *UserInvite) CreateCloudFoundryUser(cnsiGUID, userID, newUserGUID string) (*CFError, error)
CreateCloudFoundryUser will make the CF API call to create the user in CF
func (*UserInvite) GetEndpointPlugin ¶
func (userinvite *UserInvite) GetEndpointPlugin() (api.EndpointPlugin, error)
GetEndpointPlugin gets the endpoint plugin for this plugin
func (*UserInvite) GetMiddlewarePlugin ¶
func (userinvite *UserInvite) GetMiddlewarePlugin() (api.MiddlewarePlugin, error)
GetMiddlewarePlugin gets the middleware plugin for this plugin
func (*UserInvite) GetRoutePlugin ¶
func (userinvite *UserInvite) GetRoutePlugin() (api.RoutePlugin, error)
GetRoutePlugin gets the route plugin for this plugin
func (*UserInvite) GetType ¶
func (invite *UserInvite) GetType() string
GetType - return empty string as we don't introduce a new enpoint type
func (*UserInvite) Info ¶
func (invite *UserInvite) Info(apiEndpoint string, skipSSLValidation bool, caCert string) (api.CNSIRecord, interface{}, error)
Info is not implemented
func (*UserInvite) Init ¶
func (userinvite *UserInvite) Init() error
Init performs plugin initialization
func (*UserInvite) LoadConfig ¶
func (userinvite *UserInvite) LoadConfig(env env.VarSet) (*Config, error)
LoadConfig loads the configuration for inviting users
func (*UserInvite) RefreshToken ¶
func (invite *UserInvite) RefreshToken(cfGUID, clientID, clientSecret string) (*api.UAAResponse, *api.TokenRecord, error)
RefreshToken will refresh the token for the client
func (*UserInvite) Register ¶
func (invite *UserInvite) Register(echoContext echo.Context) error
Register is not implemented
func (*UserInvite) SendEmail ¶
func (invite *UserInvite) SendEmail(emailAddress, inviteLink string, endpoint api.CNSIRecord) error
SendEmail sends an invitation email to a user using the configured templates
func (*UserInvite) UAAUserInvite ¶
func (invite *UserInvite) UAAUserInvite(c echo.Context, endpoint api.CNSIRecord, uaaInviteReq *UserInviteReq) (*UserInviteResponse, error)
UAAUserInvite makes the request to the UAA to create accounts and invite links
func (*UserInvite) UpdateMetadata ¶
UpdateMetadata will add metadata for each Cloud Foundry endpoint to indicate if user invitation is allowed
func (*UserInvite) Validate ¶
func (invite *UserInvite) Validate(userGUID string, cnsiRecord api.CNSIRecord, tokenRecord api.TokenRecord) error
func (*UserInvite) ValidateConfig ¶
func (userinvite *UserInvite) ValidateConfig(c *Config) error
ValidateConfig will validate that enough configuration is available
type UserInviteReq ¶
type UserInviteReq struct {
Org string `json:"org"`
Space string `json:"space"`
SpaceRoles struct {
Auditor bool `json:"auditor"`
Developer bool `json:"developer"`
Manager bool `json:"manager"`
} `json:"spaceRoles"`
Emails []string `json:"emails"`
}
UserInviteReq is the payload that is POSTed to request user invites to be generated
type UserInviteResponse ¶
type UserInviteResponse struct {
NewInvites []UserInviteUser `json:"new_invites"`
FailedInvites []UserInviteUser `json:"failed_invites"`
}
UserInviteResponse is the response from the UAA Invite Users API
type UserInviteUser ¶
type UserInviteUser struct {
Email string `json:"email"`
UserID string `json:"userid"`
Success bool `json:"success"`
ErrorCode string `json:"errorCode"`
ErrorMessage string `json:"errorMessage"`
InviteLink string `json:"inviteLink"`
}
UserInviteUser is the individual response from the UAA Invite Users API