Documentation ¶
Index ¶
Constants ¶
View Source
const ( // AuthorizePath is the path to the authorize endpoint. AuthorizePath = "/authorize" // TokenPath is the path to the token endpoint. TokenPath = "/token" // ReadTimeout is the timeout for reading the request. ReadTimeout = 5 * time.Second // WriteTimeout is the timeout for writing the response. WriteTimeout = 5 * time.Minute )
View Source
const RefreshTokenLength = 32
Variables ¶
View Source
var ErrNilCredentials = errors.New("nil credentials")
Functions ¶
This section is empty.
Types ¶
type AccessGenerator ¶
type AccessGenerator struct {
// contains filtered or unexported fields
}
AccessGenerator is an oauth2.AccessGenerate that uses a LoginMethod to generate the access token.
func (*AccessGenerator) SetCredentials ¶
func (ag *AccessGenerator) SetCredentials(clientID string, creds *Credentials)
type Credentials ¶
type InvalidCredentialsError ¶
type InvalidCredentialsError struct {
// contains filtered or unexported fields
}
func (*InvalidCredentialsError) Error ¶
func (e *InvalidCredentialsError) Error() string
type InvalidOptionError ¶
func (*InvalidOptionError) Apply ¶
func (e *InvalidOptionError) Apply(interface{}) error
func (*InvalidOptionError) Error ¶
func (e *InvalidOptionError) Error() string
func (*InvalidOptionError) Unwrap ¶
func (e *InvalidOptionError) Unwrap() error
type LoginMethod ¶
type LoginMethod interface {
Login(ctx context.Context, creds *Credentials) (*oauth2.Token, []*http.Cookie, error)
}
LoginMethod is the method to connect to digiposte.
type LoginMethodFunc ¶
type OptionFunc ¶
type OptionFunc func(instance interface{}) error
func (OptionFunc) Apply ¶
func (f OptionFunc) Apply(instance interface{}) error
type RequiredFieldError ¶
type RequiredFieldError struct {
Field string
}
func (*RequiredFieldError) Error ¶
func (e *RequiredFieldError) Error() string
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is a local web server for collecting auth.
func NewServer ¶
func NewServer(setter digiconfig.Setter, config *Config) (*Server, error)
StartServer starts a local webserver to receive the auth.
func (*Server) AuthorizeURL ¶
AuthorizeURL returns the URL to the authorize endpoint.
func (*Server) RegisterUser ¶
func (s *Server) RegisterUser(clientID, clientSecret, redirectURL, username, password, otpSecret string) error
RegisterUser adds a user to the server.
Directories ¶
Path | Synopsis |
---|---|
configfakes
Code generated by counterfeiter.
|
Code generated by counterfeiter. |
Click to show internal directories.
Click to hide internal directories.