auth

package
v0.25.0 Latest Latest
Warning

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

Go to latest
Published: May 25, 2018 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AuthenticatedAdmin = &SimpleAuthenticator{
	admin:                true,
	authorizedSpaceGUIDs: []string{},
}
View Source
var AuthenticatedNonAdmin = &SimpleAuthenticator{
	admin: false,
	authorizedSpaceGUIDs: []string{
		"space_guid",
		"space_guid1",
		"space_guid2",
		"00000001-0001-0000-0000-000000000000",
		"00000001-0002-0000-0000-000000000000",
		"00000001-0003-0000-0000-000000000000",
		"00000002-0001-0000-0000-000000000000",
		"00000002-0002-0000-0000-000000000000",
		"00000003-0005-0000-0000-000000000000",
		"o1s1",
		"o2s1",
	},
}
View Source
var FakeBearerToken = "Bearer FAKE_TOKEN"
View Source
var NonAuthenticated = &SimpleAuthenticator{
	admin:                false,
	authorizedSpaceGUIDs: []string{},
	authorizationError:   nil,
}

Functions

func CreateConfigFromEnv

func CreateConfigFromEnv() (*oauth2.Config, error)

func GetTokenFromRequest

func GetTokenFromRequest(c echo.Context) (string, error)

Types

type Authenticator

type Authenticator interface {
	Exchange(c echo.Context) error
	Authorize(c echo.Context) error
	NewAuthorizer(string) (Authorizer, error)
}

type Authorizer

type Authorizer interface {
	Spaces() ([]string, error)
	Admin() (bool, error)
}

type Claims

type Claims struct {
	Val string `json:"val"`
	jwt.StandardClaims
}

type ClientAuthorizer

type ClientAuthorizer struct {
	// contains filtered or unexported fields
}

func (*ClientAuthorizer) Admin

func (a *ClientAuthorizer) Admin() (bool, error)

func (*ClientAuthorizer) Spaces

func (a *ClientAuthorizer) Spaces() ([]string, error)

type SimpleAuthenticator

type SimpleAuthenticator struct {
	// contains filtered or unexported fields
}

func (*SimpleAuthenticator) Authorize

func (sa *SimpleAuthenticator) Authorize(c echo.Context) error

func (*SimpleAuthenticator) Exchange

func (sa *SimpleAuthenticator) Exchange(c echo.Context) error

func (*SimpleAuthenticator) NewAuthorizer

func (sa *SimpleAuthenticator) NewAuthorizer(token string) (Authorizer, error)

type SimpleAuthorizer

type SimpleAuthorizer struct {
	// contains filtered or unexported fields
}

func (*SimpleAuthorizer) Admin

func (sa *SimpleAuthorizer) Admin() (bool, error)

func (*SimpleAuthorizer) Spaces

func (sa *SimpleAuthorizer) Spaces() ([]string, error)

type UAA

type UAA struct {
	Config *oauth2.Config
}

func (*UAA) Authorize

func (uaa *UAA) Authorize(c echo.Context) error

func (*UAA) Exchange

func (uaa *UAA) Exchange(c echo.Context) error

func (*UAA) NewAuthorizer

func (uaa *UAA) NewAuthorizer(token string) (Authorizer, error)

type UAAClaims

type UAAClaims struct {
	UserID    string   `json:"user_id"`
	Scope     []string `json:"scope"`
	Email     string   `json:"email"`
	UserName  string   `json:"user_name"`
	IssuedAt  int64    `json:"iat"`
	ExpiresAt int64    `json:"exp"`
}

func (*UAAClaims) Valid

func (claims *UAAClaims) Valid() error

Jump to

Keyboard shortcuts

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