Documentation
¶
Overview ¶
Package demo is a credentials.Broker that needs no accounts: its consent page is a local web page, and the only provider API it fakes is Google Calendar event creation. It exists so the AUTH_REQUIRED flow can be run and tested end to end.
Index ¶
- Constants
- type Broker
- func (b *Broker) Await(ctx context.Context, c *credentials.Challenge) (credentials.Grant, error)
- func (b *Broker) Begin(ctx context.Context, user, integration string) (*credentials.Challenge, error)
- func (b *Broker) Decide(id string, allow bool) error
- func (b *Broker) Events() []CalendarEvent
- func (b *Broker) Handler() http.Handler
- func (b *Broker) Lookup(ctx context.Context, user, integration string) (credentials.Grant, error)
- type CalendarEvent
- type EventDate
Constants ¶
const CalendarEventsPath = "/calendar/v3/calendars/primary/events"
CalendarEventsPath is the Google Calendar API path the demo grant understands.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Broker ¶
type Broker struct {
// contains filtered or unexported fields
}
Broker is the demo credentials broker.
func New ¶
New creates a demo broker whose pages are served under baseURL, for example "http://localhost:8088/demo-auth". Mount Handler at that path.
func (*Broker) Await ¶
func (b *Broker) Await(ctx context.Context, c *credentials.Challenge) (credentials.Grant, error)
Await implements credentials.Broker.
func (*Broker) Begin ¶
func (b *Broker) Begin(ctx context.Context, user, integration string) (*credentials.Challenge, error)
Begin implements credentials.Broker.
func (*Broker) Events ¶
func (b *Broker) Events() []CalendarEvent
Events returns the calendar events created through demo grants.
type CalendarEvent ¶
type CalendarEvent struct {
ID string `json:"id"`
User string `json:"user"`
Summary string `json:"summary"`
Description string `json:"description,omitempty"`
Start EventDate `json:"start"`
End EventDate `json:"end"`
Created time.Time `json:"created"`
}
CalendarEvent is the subset of a Google Calendar event the demo stores.