gsuite_admin_app

package module
v0.0.0-...-31d2bda Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2020 License: MIT Imports: 19 Imported by: 0

README

gsuite-admin-app

GSuite Admin Application

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Context

func Context(ctx ...context.Context) (Ctx context.Context)

Types

type App

type App struct {
	Customer      string
	TokenStorage  TokenStorage
	DomainPageURL string
	SetupURL      string
	IndexHandler  func(w http.ResponseWriter, r *http.Request)

	Crendentials oauth2.Config

	RequireDomainToStoreToken bool
	// contains filtered or unexported fields
}

func New

func New(customer string) *App

func (*App) AddScope

func (this *App) AddScope(s ...string)

func (App) FindDomain

func (this App) FindDomain(tok *oauth2.Token, ctx ...context.Context) (domain string, err error)

func (*App) FindScopes

func (this *App) FindScopes(r *http.Request) (scopes []string, err error)

func (*App) Handler

func (this *App) Handler() http.Handler

func (*App) LoadCredentials

func (this *App) LoadCredentials(b []byte) (err error)

func (App) LoadDomain

func (this App) LoadDomain(authCode string, ctx ...context.Context) (domain string, tok *oauth2.Token, err error)

func (*App) RegisterHandler

func (this *App) RegisterHandler(w http.ResponseWriter, r *http.Request)

func (*App) RegisterRequest

func (this *App) RegisterRequest(w http.ResponseWriter, r *http.Request, domain string)

func (*App) RegisterRequestHandler

func (this *App) RegisterRequestHandler(w http.ResponseWriter, r *http.Request)

func (*App) ScopeAppender

func (this *App) ScopeAppender(f ...ScopeAppender) []ScopeAppender

func (*App) Scopes

func (this *App) Scopes() []string

func (App) Service

func (this App) Service(tok *oauth2.Token, ctx ...context.Context) (service *admin.Service, err error)

func (*App) Setup

func (this *App) Setup(token *Token, r *http.Request) (err error)

func (*App) SetupHandler

func (this *App) SetupHandler(f ...SetupHandler)

type DirTokenStorage

type DirTokenStorage struct {
	Dir string
}

func NewDirTokenStorage

func NewDirTokenStorage(dir string) *DirTokenStorage

func (DirTokenStorage) Get

func (this DirTokenStorage) Get(r *http.Request, domain string) (token *Token, err error)

Retrieves a token from a local file.

func (DirTokenStorage) Put

func (this DirTokenStorage) Put(r *http.Request, token *Token) (err error)

Retrieves a token from a local file.

type RegisterSession

type RegisterSession struct {
	Session *sessions.Session
	Request *http.Request
	// contains filtered or unexported fields
}

func GetRegisterSession

func GetRegisterSession(r *http.Request) (session *RegisterSession, err error)

func (*RegisterSession) Data

func (this *RegisterSession) Data() *RegisterSessionData

func (*RegisterSession) Delete

func (this *RegisterSession) Delete(w http.ResponseWriter) (err error)

func (*RegisterSession) Get

func (this *RegisterSession) Get(key string, result interface{}) error

func (*RegisterSession) GetS

func (this *RegisterSession) GetS(key string) string

func (*RegisterSession) HasData

func (this *RegisterSession) HasData() bool

func (*RegisterSession) Load

func (this *RegisterSession) Load(r *http.Request) (err error)

func (*RegisterSession) Pop

func (this *RegisterSession) Pop(w http.ResponseWriter, key string) error

func (*RegisterSession) PopLoad

func (this *RegisterSession) PopLoad(w http.ResponseWriter, key string, result interface{}) error

func (*RegisterSession) Save

func (this *RegisterSession) Save(w http.ResponseWriter) (err error)

func (*RegisterSession) Set

func (this *RegisterSession) Set(w http.ResponseWriter, key string, value interface{}) error

func (*RegisterSession) SetData

func (this *RegisterSession) SetData(data *RegisterSessionData)

type RegisterSessionData

type RegisterSessionData struct {
	Domain        string   `json:"domains,omitempty"`
	Scopes        []string `json:"scopes,omitempty"`
	RedirectTo    string   `json:"redirect_to,omitempty"`
	StoreTokenUrl string   `json:"store_token_url,omitempty"`
}

type ScopeAppender

type ScopeAppender = func(app *App, scopes *Scopes, r *http.Request) (err error)

type Scopes

type Scopes struct {
	Values []string
}

func (*Scopes) Add

func (this *Scopes) Add(scope ...string) Scopes

type SetupHandler

type SetupHandler = func(app *App, token *Token, r *http.Request) (err error)

type Token

type Token struct {
	*oauth2.Token
	Domain string
	Scopes []string `json:"scopes,omitempty"`
}

type TokenStorage

type TokenStorage interface {
	Get(r *http.Request, domain string) (token *Token, err error)
	Put(r *http.Request, token *Token) (err error)
}

Jump to

Keyboard shortcuts

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