provider

package
v0.0.0-...-2d8e61d Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2021 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package provider is an external auth provider e.g oauth

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EndpointOption

type EndpointOption func(*EndpointOptions)

func WithLoginHint

func WithLoginHint(hint string) EndpointOption

func WithState

func WithState(c string) EndpointOption

type EndpointOptions

type EndpointOptions struct {
	// State is a code to verify the req
	State string
	// LoginHint prefils the user id on oauth clients
	LoginHint string
}

type Grant

type Grant struct {
	// token for reuse
	Token string
	// Expiry of the token
	Expiry time.Time
	// Scopes associated with grant
	Scopes []string
}

Grant is a granted authorisation

type Option

type Option func(*Options)

Option returns a function which sets an option

func Credentials

func Credentials(id, secret string) Option

Credentials is an option which sets the client id and secret

func Endpoint

func Endpoint(e string) Option

Endpoint sets the endpoint option

func Redirect

func Redirect(r string) Option

Redirect sets the Redirect option

func Scope

func Scope(s string) Option

Scope sets the oauth scope

type Options

type Options struct {
	// ClientID is the application's ID.
	ClientID string
	// ClientSecret is the application's secret.
	ClientSecret string
	// Endpoint for the provider
	Endpoint string
	// Redirect url incase of UI
	Redirect string
	// Scope of the oauth request
	Scope string
}

Options a provider can have

type Provider

type Provider interface {
	// String returns the name of the provider
	String() string
	// Options returns the options of a provider
	Options() Options
	// Endpoint for the provider
	Endpoint(...EndpointOption) string
	// Redirect url incase of UI
	Redirect() string
}

Provider is an auth provider

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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