implicitoauth2

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package implicitoauth2 contains the basic functionality to realize an Implicit Grant OAuth2 authentication

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthTokenURL

func AuthTokenURL(cfg *oauth2.Config, state string) string

AuthTokenURL is a function to retrieve the URL to request the Token with by the Implicit Grant OAuth2 authentication

func ImplicitGrantRequestErrorSuccessful

func ImplicitGrantRequestErrorSuccessful(err error) bool

ImplicitGrantRequestErrorSuccessful checks if the error occurred is the error indicating a successful redirect which is returned as error since we cancel the request the moment we reach it

Types

type ImplicitGrant

type ImplicitGrant struct {
	ImplicitGrantInterface
	Client *http.Client
	Config *oauth2.Config
}

ImplicitGrant implements the ImplicitGrantInterface and provides a basic token function using the interface methods

func (ImplicitGrant) Token

func (g ImplicitGrant) Token() (token *oauth2.Token, err error)

Token is a basic implementation for the workflow of the Implicit Grant OAuth2 authentication

type ImplicitGrantInterface

type ImplicitGrantInterface interface {
	Login() error
	Authorize() error
	Token() (*oauth2.Token, error)
}

ImplicitGrantInterface defines all required methods for an implicit grant OAuth2 process

type ImplicitGrantRedirect

type ImplicitGrantRedirect struct {
	URL *url.URL
}

ImplicitGrantRedirect is a custom error we return when we got successfully redirected to a Token URL

func (ImplicitGrantRedirect) Error

func (r ImplicitGrantRedirect) Error() string

Error is the implementation of the default output of the error interface

type ImplicitGrantTokenSource

type ImplicitGrantTokenSource struct {
	Grant ImplicitGrantInterface
	// contains filtered or unexported fields
}

ImplicitGrantTokenSource is the interface implementation of the oauth2.TokenSource interface

func (*ImplicitGrantTokenSource) Token

func (s *ImplicitGrantTokenSource) Token() (_ *oauth2.Token, err error)

Token is the implementation of the TokenSource interface to return a valid token or the error occurred most of this functionality is copied from the oauth2 package from google

Jump to

Keyboard shortcuts

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