oauth

package
v0.0.0-...-9451de5 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2019 License: BSD-3-Clause Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMissingCodeError       = &tsuruErrors.ValidationError{Message: "You must provide code to login"}
	ErrMissingCodeRedirectURL = &tsuruErrors.ValidationError{Message: "You must provide the used redirect url to login"}
	ErrEmptyAccessToken       = &tsuruErrors.NotAuthorizedError{Message: "Couldn't convert code to access token."}
	ErrEmptyUserEmail         = &tsuruErrors.NotAuthorizedError{Message: "Couldn't parse user email."}
)

Functions

This section is empty.

Types

type OAuthParser

type OAuthParser interface {
	Parse(infoResponse *http.Response) (string, error)
}

type OAuthScheme

type OAuthScheme struct {
	BaseConfig   oauth2.Config
	InfoURL      string
	CallbackPort int
	Parser       OAuthParser
}

func (*OAuthScheme) AppLogin

func (s *OAuthScheme) AppLogin(appName string) (auth.Token, error)

func (*OAuthScheme) AppLogout

func (s *OAuthScheme) AppLogout(token string) error

func (*OAuthScheme) Auth

func (s *OAuthScheme) Auth(header string) (auth.Token, error)

func (*OAuthScheme) Create

func (s *OAuthScheme) Create(user *auth.User) (*auth.User, error)

func (*OAuthScheme) Info

func (s *OAuthScheme) Info() (auth.SchemeInfo, error)

func (*OAuthScheme) Login

func (s *OAuthScheme) Login(params map[string]string) (auth.Token, error)

func (*OAuthScheme) Logout

func (s *OAuthScheme) Logout(token string) error

func (*OAuthScheme) Name

func (s *OAuthScheme) Name() string

func (*OAuthScheme) Parse

func (s *OAuthScheme) Parse(infoResponse *http.Response) (string, error)

func (*OAuthScheme) Remove

func (s *OAuthScheme) Remove(u *auth.User) error

type Token

type Token struct {
	oauth2.Token
	UserEmail string `json:"email"`
}

func (*Token) GetAppName

func (t *Token) GetAppName() string

func (*Token) GetUserName

func (t *Token) GetUserName() string

func (*Token) GetValue

func (t *Token) GetValue() string

func (*Token) IsAppToken

func (t *Token) IsAppToken() bool

func (*Token) Permissions

func (t *Token) Permissions() ([]permission.Permission, error)

func (*Token) User

func (t *Token) User() (*authTypes.User, error)

Jump to

Keyboard shortcuts

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