model

package
v0.0.0-...-c8fbfac Latest Latest
Warning

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

Go to latest
Published: May 14, 2017 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const EventStringFormat string = `Timestamp %s
Proto: %s
Host: %s
Port: %s
Uri: %s
Client IP: %s
Username: %s
Returned code: %d
Result: %d
Message: %s
`

Variables

View Source
var CounterNames map[CounterID]string = map[CounterID]string{
	LDAP_CONN_ERROR:  "ldap_connection_error",
	RESTARTS:         "restarts",
	HTTP_ABRUPT_TERM: "http_abrupt_termination",
	API_ABRUPT_TERM:  "api_abrupt_termination",
	SIGTERM_SIGINT:   "sigterm_sigint_received",
	SIGHUP:           "sighup_received",
	UNKNOWN_SIG:      "unknown_signal_received",
}

Functions

This section is empty.

Types

type CounterID

type CounterID uint8
const (
	LDAP_CONN_ERROR CounterID = iota
	RESTARTS
	HTTP_ABRUPT_TERM
	API_ABRUPT_TERM
	SIGTERM_SIGINT
	SIGHUP
	UNKNOWN_SIG
)

type Identity

type Identity struct {
	Username    string `json:"username"`
	UsernameOut string `json:"username_out"`
	Email       string `json:"email"`
}

type PackOfEvents

type PackOfEvents []*RequestEvent

func (PackOfEvents) Len

func (p PackOfEvents) Len() int

func (PackOfEvents) Less

func (p PackOfEvents) Less(i, j int) bool

func (PackOfEvents) Swap

func (p PackOfEvents) Swap(i, j int)

type RequestEvent

type RequestEvent struct {
	Identity
	Password  string    `json:"-"`
	Host      string    `json:"host"`
	Uri       string    `json:"uri"`
	Port      string    `json:"port"`
	Proto     string    `json:"proto"`
	ClientIP  string    `json:"client_ip"`
	RetCode   int       `json:"retcode"`
	Timestamp time.Time `json:"timestamp"`
	Message   string    `json:"message"`
	Result    Result    `json:"result"`
	Service   string    `json:"service"`
}

func NewEmptyEvent

func NewEmptyEvent() *RequestEvent

func (*RequestEvent) GenerateBackendJwt

func (e *RequestEvent) GenerateBackendJwt(key *rsa.PrivateKey, issuer string) (string, error)

func (*RequestEvent) GenerateCookie

func (e *RequestEvent) GenerateCookie(name string, secret []byte, d time.Duration) (*http.Cookie, error)

func (*RequestEvent) Hmac

func (e *RequestEvent) Hmac(secret []byte) []byte

func (*RequestEvent) String

func (e *RequestEvent) String() string

type Result

type Result uint8
const (
	SUCCESS_AUTH Result = iota
	SUCCESS_AUTH_CACHE
	FAIL_AUTH
	INVALID_REQUEST
	OP_ERROR
	NO_AUTH
	SUCCESS_AUTH_NAL_COOKIE
)

type Token

type Token struct {
	Identity
	Password  string        `json:"password"`
	Timestamp time.Time     `json:"timestamp"`
	Duration  time.Duration `json:"duration"`
}

func VerifyCookie

func VerifyCookie(cookie *http.Cookie, secret []byte) *Token

Jump to

Keyboard shortcuts

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