console

package
v3.0.0-pre.0...-f1e8a59 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 3, 2018 License: Apache-2.0 Imports: 14 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// PublicURL is the public URL of the Console.
	PublicURL string `name:"public-url" description:"Public URL of the Console"`

	// DefaultLanguage is the default language of the Console.
	DefaultLanguage string `name:"language" description:"Default language of the Console"`

	// OAuthURL is the location of the OAuth provider.
	OAuthURL string `name:"oauth-url" description:"URL of the OAuth provider"`

	// OAuth is the OAuth config for the Console.
	OAuth OAuth `name:"oauth"`
	// contains filtered or unexported fields
}

Config is the configuration for the Console.

type Console

type Console struct {
	*component.Component
	// contains filtered or unexported fields
}

Console is the Console component.

func New

func New(c *component.Component, assets *assets.Assets, config Config) (*Console, error)

New returns a new Console.

func (*Console) AuthCookie

func (console *Console) AuthCookie() *cookie.Cookie

AuthCookie returns a new authCookie.

func (*Console) Callback

func (console *Console) Callback(c echo.Context) error

Callback is the OAuth callback that accepts the authorization code and exchanges it for an access token (+ refresh token). The access token is stored in the authorization cookie for later reference.

func (*Console) Login

func (console *Console) Login(c echo.Context) error

Login logs in the user by redirecting to the OAuth flow.

func (*Console) Logout

func (console *Console) Logout(c echo.Context) error

Logout logs out the user.

func (*Console) RefreshToken

func (console *Console) RefreshToken(c echo.Context) error

RefreshToken is an echo request handler that refreshes the token currently stored in the authCookie and sets in the response the new authCookie.

func (*Console) RegisterRoutes

func (console *Console) RegisterRoutes(server *web.Server)

RegisterRoutes implements web.Registerer. It registers the Console to the web server.

func (*Console) StateCookie

func (console *Console) StateCookie() *cookie.Cookie

StateCookie returns the cookie storing the state of the console.

func (*Console) Token

func (console *Console) Token(c echo.Context) error

Token is the handler that allows the user to get their OAuth token. It reads the token from the authorization cookie. If the cookie is not there, it returns a 401 Unauthorized error.

type OAuth

type OAuth struct {
	// ID is the client ID for the Console.
	ID string `name:"client-id" description:"The OAuth client ID for the Console"`

	// Secret is the client secret for the Console.
	Secret string `name:"client-secret" description:"The OAuth client secret for the Console" json:"-"`
}

OAuth is the OAuth config for the Console.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL