Documentation
¶
Overview ¶
Package secureconfig provides the plugin with a secure API to interact with Ambient.
Index ¶
- func Error(siteError error) (err error)
- func SaveRoutesForPlugin(name string, recorder *pluginsafe.PluginRouteRecorder, ...)
- type SecureSite
- func (ss *SecureSite) AuthenticatedUser(r *http.Request) (string, error)
- func (ss *SecureSite) Authorized(grant ambient.Grant) bool
- func (ss *SecureSite) CSRF(r *http.Request, token string) bool
- func (ss *SecureSite) Content() (string, error)
- func (ss *SecureSite) DeletePlugin(name string) error
- func (ss *SecureSite) DeletePostByID(ID string) error
- func (ss *SecureSite) DeleteSessionValue(r *http.Request, name string)
- func (ss *SecureSite) DisablePlugin(pluginName string, unloadPlugin bool) error
- func (ss *SecureSite) EnablePlugin(pluginName string, loadPlugin bool) error
- func (ss *SecureSite) Error(siteError error) (err error)
- func (ss *SecureSite) FullURL() (string, error)
- func (ss *SecureSite) Load() error
- func (ss *SecureSite) LoadSinglePluginPages(name string)
- func (ss *SecureSite) LogoutAllUsers(r *http.Request) error
- func (ss *SecureSite) NeighborPluginGrantList(pluginName string) ([]ambient.GrantRequest, error)
- func (ss *SecureSite) NeighborPluginGranted(pluginName string, grantName ambient.Grant) (bool, error)
- func (ss *SecureSite) NeighborPluginGrants(pluginName string) (map[ambient.Grant]bool, error)
- func (ss *SecureSite) NeighborPluginRequestedGrant(pluginName string, grantName ambient.Grant) (bool, error)
- func (ss *SecureSite) NeighborPluginSetting(pluginName string, fieldName string) (interface{}, error)
- func (ss *SecureSite) NeighborPluginSettingString(pluginName string, fieldName string) (string, error)
- func (ss *SecureSite) PluginNames() ([]string, error)
- func (ss *SecureSite) PluginNeighborRoutesList(pluginName string) ([]ambient.Route, error)
- func (ss *SecureSite) PluginNeighborSettingsList(pluginName string) ([]ambient.Setting, error)
- func (ss *SecureSite) PluginSetting(fieldName string) (interface{}, error)
- func (ss *SecureSite) PluginSettingBool(name string) (bool, error)
- func (ss *SecureSite) PluginSettingString(fieldName string) (string, error)
- func (ss *SecureSite) PluginTrusted(pluginName string) (bool, error)
- func (ss *SecureSite) Plugins() (map[string]ambient.PluginData, error)
- func (ss *SecureSite) PostByID(ID string) (ambient.Post, error)
- func (ss *SecureSite) PostBySlug(slug string) (ambient.PostWithID, error)
- func (ss *SecureSite) PostsAndPages(onlyPublished bool) (ambient.PostWithIDList, error)
- func (ss *SecureSite) PublishedPages() ([]ambient.Post, error)
- func (ss *SecureSite) PublishedPosts() ([]ambient.Post, error)
- func (ss *SecureSite) SavePost(ID string, post ambient.Post) error
- func (ss *SecureSite) Scheme() (string, error)
- func (ss *SecureSite) SessionValue(r *http.Request, name string) string
- func (ss *SecureSite) SetCSRF(r *http.Request) string
- func (ss *SecureSite) SetContent(content string) error
- func (ss *SecureSite) SetNeighborPluginGrant(pluginName string, grantName ambient.Grant, granted bool) error
- func (ss *SecureSite) SetNeighborPluginSetting(pluginName string, settingName string, value string) error
- func (ss *SecureSite) SetPluginSetting(settingName string, value string) error
- func (ss *SecureSite) SetScheme(scheme string) error
- func (ss *SecureSite) SetSessionValue(r *http.Request, name string, value string) error
- func (ss *SecureSite) SetTitle(title string) error
- func (ss *SecureSite) SetURL(URL string) error
- func (ss *SecureSite) Tags(onlyPublished bool) (ambient.TagList, error)
- func (ss *SecureSite) Title() (string, error)
- func (ss *SecureSite) URL() (string, error)
- func (ss *SecureSite) Updated() (time.Time, error)
- func (ss *SecureSite) UserLogin(r *http.Request, username string) error
- func (ss *SecureSite) UserLogout(r *http.Request) error
- func (ss *SecureSite) UserPersist(r *http.Request, persist bool) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SaveRoutesForPlugin ¶
func SaveRoutesForPlugin(name string, recorder *pluginsafe.PluginRouteRecorder, pluginsystem ambient.PluginSystem)
SaveRoutesForPlugin will save the routes in the plugin system.
Types ¶
type SecureSite ¶
type SecureSite struct {
// contains filtered or unexported fields
}
SecureSite is a secure data access for the site.
func NewSecureSite ¶
func NewSecureSite(pluginName string, log ambient.AppLogger, ps ambient.PluginSystem, session ambient.AppSession, mux ambient.AppRouter, render ambient.Renderer, recorder *pluginsafe.RouteRecorder, loadPlugins bool) (*SecureSite, http.Handler, error)
NewSecureSite returns a new secure site.
func (*SecureSite) AuthenticatedUser ¶
func (ss *SecureSite) AuthenticatedUser(r *http.Request) (string, error)
AuthenticatedUser returns if the current user is authenticated.
func (*SecureSite) Authorized ¶
func (ss *SecureSite) Authorized(grant ambient.Grant) bool
Authorized determines if the current context has access.
func (*SecureSite) CSRF ¶
func (ss *SecureSite) CSRF(r *http.Request, token string) bool
CSRF returns true if the CSRF token is valid.
func (*SecureSite) Content ¶
func (ss *SecureSite) Content() (string, error)
Content returns the site home page content.
func (*SecureSite) DeletePlugin ¶
func (ss *SecureSite) DeletePlugin(name string) error
DeletePlugin deletes a plugin.
func (*SecureSite) DeletePostByID ¶
func (ss *SecureSite) DeletePostByID(ID string) error
DeletePostByID deletes a post.
func (*SecureSite) DeleteSessionValue ¶
func (ss *SecureSite) DeleteSessionValue(r *http.Request, name string)
DeleteSessionValue deletes a session value on the current session.
func (*SecureSite) DisablePlugin ¶
func (ss *SecureSite) DisablePlugin(pluginName string, unloadPlugin bool) error
DisablePlugin disables a plugin.
func (*SecureSite) EnablePlugin ¶
func (ss *SecureSite) EnablePlugin(pluginName string, loadPlugin bool) error
EnablePlugin enables a plugin.
func (*SecureSite) Error ¶
func (ss *SecureSite) Error(siteError error) (err error)
Error handles returning the proper error.
func (*SecureSite) FullURL ¶
func (ss *SecureSite) FullURL() (string, error)
FullURL returns the URL with the scheme at the beginning.
func (*SecureSite) LoadSinglePluginPages ¶
func (ss *SecureSite) LoadSinglePluginPages(name string)
LoadSinglePluginPages loads the plugin.
func (*SecureSite) LogoutAllUsers ¶
func (ss *SecureSite) LogoutAllUsers(r *http.Request) error
LogoutAllUsers logs out all users.
func (*SecureSite) NeighborPluginGrantList ¶
func (ss *SecureSite) NeighborPluginGrantList(pluginName string) ([]ambient.GrantRequest, error)
NeighborPluginGrantList gets the grants requests for a neighbor plugin.
func (*SecureSite) NeighborPluginGranted ¶
func (ss *SecureSite) NeighborPluginGranted(pluginName string, grantName ambient.Grant) (bool, error)
NeighborPluginGranted returns true if the plugin has the grant.
func (*SecureSite) NeighborPluginGrants ¶
NeighborPluginGrants gets the map of granted permissions.
func (*SecureSite) NeighborPluginRequestedGrant ¶
func (ss *SecureSite) NeighborPluginRequestedGrant(pluginName string, grantName ambient.Grant) (bool, error)
NeighborPluginRequestedGrant returns true if the plugin requests the grant. This shouldn't be used to determine if a plugin has been approved the grant.
func (*SecureSite) NeighborPluginSetting ¶
func (ss *SecureSite) NeighborPluginSetting(pluginName string, fieldName string) (interface{}, error)
NeighborPluginSetting returns a setting for a neighbor plugin as an interface{}.
func (*SecureSite) NeighborPluginSettingString ¶
func (ss *SecureSite) NeighborPluginSettingString(pluginName string, fieldName string) (string, error)
NeighborPluginSettingString returns a setting for a neighbor plugin as a string.
func (*SecureSite) PluginNames ¶
func (ss *SecureSite) PluginNames() ([]string, error)
PluginNames returns the list of plugin name.
func (*SecureSite) PluginNeighborRoutesList ¶
func (ss *SecureSite) PluginNeighborRoutesList(pluginName string) ([]ambient.Route, error)
PluginNeighborRoutesList gets the routes for a neighbor plugin.
func (*SecureSite) PluginNeighborSettingsList ¶
func (ss *SecureSite) PluginNeighborSettingsList(pluginName string) ([]ambient.Setting, error)
PluginNeighborSettingsList gets the grants requests for a neighbor plugin.
func (*SecureSite) PluginSetting ¶
func (ss *SecureSite) PluginSetting(fieldName string) (interface{}, error)
PluginSetting returns a setting for the plugin as an interface{}.
func (*SecureSite) PluginSettingBool ¶
func (ss *SecureSite) PluginSettingBool(name string) (bool, error)
PluginSettingBool returns a plugin setting as a bool.
func (*SecureSite) PluginSettingString ¶
func (ss *SecureSite) PluginSettingString(fieldName string) (string, error)
PluginSettingString returns a setting for the plugin as a string.
func (*SecureSite) PluginTrusted ¶
func (ss *SecureSite) PluginTrusted(pluginName string) (bool, error)
PluginTrusted returns whether a plugin is trusted or not.
func (*SecureSite) Plugins ¶
func (ss *SecureSite) Plugins() (map[string]ambient.PluginData, error)
Plugins returns the plugin list.
func (*SecureSite) PostByID ¶
func (ss *SecureSite) PostByID(ID string) (ambient.Post, error)
PostByID returns the post by ID.
func (*SecureSite) PostBySlug ¶
func (ss *SecureSite) PostBySlug(slug string) (ambient.PostWithID, error)
PostBySlug returns the post by slug.
func (*SecureSite) PostsAndPages ¶
func (ss *SecureSite) PostsAndPages(onlyPublished bool) (ambient.PostWithIDList, error)
PostsAndPages returns the list of posts and pages.
func (*SecureSite) PublishedPages ¶
func (ss *SecureSite) PublishedPages() ([]ambient.Post, error)
PublishedPages returns the list of published pages.
func (*SecureSite) PublishedPosts ¶
func (ss *SecureSite) PublishedPosts() ([]ambient.Post, error)
PublishedPosts returns the list of published posts.
func (*SecureSite) SavePost ¶
func (ss *SecureSite) SavePost(ID string, post ambient.Post) error
SavePost saves a post.
func (*SecureSite) Scheme ¶
func (ss *SecureSite) Scheme() (string, error)
Scheme returns the site scheme.
func (*SecureSite) SessionValue ¶
func (ss *SecureSite) SessionValue(r *http.Request, name string) string
SessionValue returns session value by name.
func (*SecureSite) SetCSRF ¶
func (ss *SecureSite) SetCSRF(r *http.Request) string
SetCSRF sets the session with a token and returns the token for use in a form or header.
func (*SecureSite) SetContent ¶
func (ss *SecureSite) SetContent(content string) error
SetContent sets the home page content.
func (*SecureSite) SetNeighborPluginGrant ¶
func (ss *SecureSite) SetNeighborPluginGrant(pluginName string, grantName ambient.Grant, granted bool) error
SetNeighborPluginGrant sets a grant for a neighbor plugin.
func (*SecureSite) SetNeighborPluginSetting ¶
func (ss *SecureSite) SetNeighborPluginSetting(pluginName string, settingName string, value string) error
SetNeighborPluginSetting sets a setting for a neighbor plugin.
func (*SecureSite) SetPluginSetting ¶
func (ss *SecureSite) SetPluginSetting(settingName string, value string) error
SetPluginSetting sets a variable for the plugin.
func (*SecureSite) SetScheme ¶
func (ss *SecureSite) SetScheme(scheme string) error
SetScheme sets the site scheme.
func (*SecureSite) SetSessionValue ¶
SetSessionValue sets a value on the current session.
func (*SecureSite) SetTitle ¶
func (ss *SecureSite) SetTitle(title string) error
SetTitle sets the title.
func (*SecureSite) SetURL ¶
func (ss *SecureSite) SetURL(URL string) error
SetURL sets the site URL.
func (*SecureSite) Tags ¶
func (ss *SecureSite) Tags(onlyPublished bool) (ambient.TagList, error)
Tags returns the list of tags.
func (*SecureSite) URL ¶
func (ss *SecureSite) URL() (string, error)
URL returns the URL without the scheme at the beginning.
func (*SecureSite) Updated ¶
func (ss *SecureSite) Updated() (time.Time, error)
Updated returns the home last updated timestamp.
func (*SecureSite) UserLogin ¶
func (ss *SecureSite) UserLogin(r *http.Request, username string) error
UserLogin sets the current user as authenticated.
func (*SecureSite) UserLogout ¶
func (ss *SecureSite) UserLogout(r *http.Request) error
UserLogout logs out the current user.
func (*SecureSite) UserPersist ¶
func (ss *SecureSite) UserPersist(r *http.Request, persist bool) error
UserPersist sets the user session to retain after browser close.