auth

package
v0.0.0-...-17bba56 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2019 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Credentials

type Credentials struct {
	Base       *models.Configuration `json:"base,omitempty"`
	NgcSession string                `json:"ngc_session,omitempty"`
}

Credentials stores third-party credentials

func FindCredentials

func FindCredentials(username string) *Credentials

FindCredentials returns creds from local DB

func (*Credentials) Save

func (c *Credentials) Save() error

Save to local DB

func (*Credentials) ToSession

func (c *Credentials) ToSession() *Session

ToSession translate credentials to session

type Principal

type Principal struct {
	Username string
}

Principal principal

func RequestToPrincipal

func RequestToPrincipal(token string) (*Principal, error)

RequestToPrincipal returns principal from token string in the request 'Authorization' header

type Session

type Session struct {
	DockerUsername string `json:"docker_username,omitempty"`
	DockerPassword string `json:"-"`
	NgcEmail       string `json:"ngc_email,omitempty"`
	NgcPassword    string `json:"-"`
	NgcApikey      string `json:"-"`
	NgcSession     string `json:"-"`
	K8sConfig      string `json:"-"`
	RescaleKey     string `json:"-"`
}

Session defines JWT payload

func RetrieveSession

func RetrieveSession(req *http.Request) (*Session, error)

RetrieveSession retrieves the session itself from a HTTP request

func (*Session) ToJWT

func (s *Session) ToJWT() (string, error)

ToJWT translate session to JWT string

Jump to

Keyboard shortcuts

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