authz

package
v0.0.1-alpha.8 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigAccountOwnerRole

func ConfigAccountOwnerRole() string

func ConfigAnonymousAccount

func ConfigAnonymousAccount() string

func ConfigAnonymousRole

func ConfigAnonymousRole() string

func ConfigAnonymousUser

func ConfigAnonymousUser() string

func ConfigLoggedInRole

func ConfigLoggedInRole() string

Types

type AccountGetter

type AccountGetter interface {
	GetAccount(r *http.Request) (string, error)
}

type AccountGetterMock

type AccountGetterMock struct {
	AccountGetter
	mock.Mock
}

func (*AccountGetterMock) GetAccount

func (m *AccountGetterMock) GetAccount(r *http.Request) (string, error)

type AuthInfoGetter

type AuthInfoGetter interface {
	GetAuthInfo(r *http.Request) (*AuthzInfo, error)
}

type AuthInfoGetterImpl

type AuthInfoGetterImpl struct {
	UserGetter
	RoleGetter
	AccountGetter
}

func (*AuthInfoGetterImpl) GetAuthInfo

func (s *AuthInfoGetterImpl) GetAuthInfo(r *http.Request) (*AuthzInfo, error)

GetAuthInfo returns all the authentication information for a JWT token. It takes care of validating both token and membership of the user in the account (if provided)

type AuthInfoGetterMock

type AuthInfoGetterMock struct {
	mock.Mock
}

func (*AuthInfoGetterMock) GetAuthInfo

func (m *AuthInfoGetterMock) GetAuthInfo(r *http.Request) (*AuthzInfo, error)

func (*AuthInfoGetterMock) GetAuthInfoFromRequest

func (m *AuthInfoGetterMock) GetAuthInfoFromRequest(r *http.Request) (*AuthzInfo, error)

type AuthzInfo

type AuthzInfo struct {
	RoleId    string
	UserId    string
	AccountId string
}

type RoleGetter

type RoleGetter interface {
	GetRole(r *http.Request) (string, error)
}

type RoleGetterMock

type RoleGetterMock struct {
	RoleGetter
	mock.Mock
}

func (*RoleGetterMock) GetRole

func (m *RoleGetterMock) GetRole(r *http.Request) (string, error)

type Service

type Service interface {
	RoleGetter
	UserGetter
	AccountGetter
	AuthInfoGetter
}

func NewServiceMock

func NewServiceMock() Service

type UserGetter

type UserGetter interface {
	GetUser(r *http.Request) (string, error)
}

type UserGetterMock

type UserGetterMock struct {
	UserGetter
	mock.Mock
}

func (*UserGetterMock) GetUser

func (m *UserGetterMock) GetUser(r *http.Request) (string, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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