tokens

package
v2.1.8+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2019 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CookieName      = "R_SESS"
	AuthHeaderName  = "Authorization"
	AuthValuePrefix = "Bearer"
	BasicAuthPrefix = "Basic"
)
View Source
const (
	UserIDLabel = "authn.management.cattle.io/token-userId"
)

Variables

This section is empty.

Functions

func ConvertTokenResource

func ConvertTokenResource(schema *types.Schema, token v3.Token) (map[string]interface{}, error)

func GetTokenAuthFromRequest

func GetTokenAuthFromRequest(req *http.Request) string

func IsExpired

func IsExpired(token v3.Token) bool

func NewAPIHandler

func NewAPIHandler(ctx context.Context, apiContext *config.ScaledContext) (http.Handler, error)

func SetTokenExpiresAt

func SetTokenExpiresAt(token *v3.Token)

func SplitTokenParts

func SplitTokenParts(tokenID string) (string, string)

func StartPurgeDaemon

func StartPurgeDaemon(ctx context.Context, mgmt *config.ManagementContext)

Types

type Manager

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

func NewManager

func NewManager(ctx context.Context, apiContext *config.ScaledContext) *Manager

func (*Manager) CreateSecret

func (m *Manager) CreateSecret(userID, provider, secret string) error

CreateSecret saves the secret in k8s. Secret is saved under the userID-secret with key being the provider and data being the providers secret

func (*Manager) CreateTokenAndSetCookie

func (m *Manager) CreateTokenAndSetCookie(userID string, userPrincipal v3.Principal, groupPrincipals []v3.Principal, providerToken string, ttl int, description string, request *types.APIContext) error

func (*Manager) GetGroupsForTokenAuthProvider

func (m *Manager) GetGroupsForTokenAuthProvider(token *v3.Token) []v3.Principal

func (*Manager) GetSecret

func (m *Manager) GetSecret(token *v3.Token) (string, error)

func (*Manager) IsMemberOf

func (m *Manager) IsMemberOf(token v3.Token, group v3.Principal) bool

func (*Manager) NewLoginToken

func (m *Manager) NewLoginToken(userID string, userPrincipal v3.Principal, groupPrincipals []v3.Principal, providerToken string, ttl int64, description string) (v3.Token, error)

func (*Manager) UpateLoginToken

func (m *Manager) UpateLoginToken(token *v3.Token) (*v3.Token, error)

func (*Manager) UpdateSecret

func (m *Manager) UpdateSecret(userID, provider, secret string) error

Jump to

Keyboard shortcuts

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