authcontext

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: May 22, 2018 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AuthTokenHeader is the key of auth token header
	AuthTokenHeader = "x-xenon-auth-token"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthContext

type AuthContext struct {
	PrincipalID string     `json:"id"`
	Name        string     `json:"name"`
	Email       string     `json:"email"`
	Roles       []string   `json:"roles"`
	Projects    []*project `json:"projects"`
}

AuthContext ...

func GetAuthCtx

func GetAuthCtx(client *http.Client, url, token string) (*AuthContext, error)

GetAuthCtx returns the auth context of the current user

func Login

func Login(client *http.Client, url, username, password, token string) (*AuthContext, error)

Login with credential and returns auth context and error

func (*AuthContext) GetMyProjects

func (a *AuthContext) GetMyProjects() []*models.Project

GetMyProjects returns all projects which the user is a member of

func (*AuthContext) GetProjectRoles

func (a *AuthContext) GetProjectRoles(projectIDOrName interface{}) []int

GetProjectRoles ...

func (*AuthContext) IsSysAdmin

func (a *AuthContext) IsSysAdmin() bool

IsSysAdmin ...

Jump to

Keyboard shortcuts

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