services

package
v0.0.0-...-0298089 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2017 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ApplicationSessionService = new(SessionService)

Session stuff

View Source
var SessionPeriod *int
View Source
var SessionSecret *string

Application Parameters

View Source
var StatsMiddleware = stats.New()

Contains the global variables used

View Source
var UserFile *string // Known users
View Source
var Version string = "0.8"

Version

Functions

func CreateSession

func CreateSession(user User, secondsToLive int, secret string) (string, error)

CreateSession - creates a sesion WITHOUT adding it to the session DB

func GetLocalIP

func GetLocalIP() string

func HashPassword

func HashPassword(password, salt string) string

func LoadUsers

func LoadUsers(filename string) error

Initiaizes data structues - IE Read user DB

Types

type AuthenticationArgs

type AuthenticationArgs struct {
	User     string `json:"username"`
	Password string `json:"password"`
}

type AuthenticationReply

type AuthenticationReply struct {
	Token string `json:"token"`
}

type AuthenticationService

type AuthenticationService int

func (*AuthenticationService) Authenticate

func (t *AuthenticationService) Authenticate(r *http.Request, args *AuthenticationArgs, result *AuthenticationReply) error

func (*AuthenticationService) Version

func (t *AuthenticationService) Version(r *http.Request, args *string, result *string) error

Get version

type HealthArgs

type HealthArgs struct {
}

type HealthReply

type HealthReply struct {
	Status string `json:"status"`
}

type HealthService

type HealthService int

func (*HealthService) Status

func (t *HealthService) Status(r *http.Request, args *HealthArgs, result *HealthReply) error

type Session

type Session struct {
	Id      string   `json:"id"`
	User    string   `json:"user"`
	Expires int64    `json:"expires"`
	Roles   []string `json:"roles"`
}

func Decode

func Decode(tokenString, secret string) (Session, error)

Decode

func (*Session) ToString

func (s *Session) ToString() string

type SessionDetailsArgs

type SessionDetailsArgs struct {
	Authorization string `json:"authorization"`
	Token         string `json:"token"`
}

SessionDetailsArgs a struct with a field 'authorization' containing callers token and 'token' which is the token to decode. Requires caller to have admin role and

type SessionInterface

type SessionInterface interface {
	// contains filtered or unexported methods
}

type SessionService

type SessionService int

func (*SessionService) Details

func (t *SessionService) Details(r *http.Request, args *SessionDetailsArgs, result *Session) error

List available sessions

func (*SessionService) NewSession

func (t *SessionService) NewSession(user User) (string, error)

NewSession - creates a session and add its to the session DB

func (*SessionService) Validate

func (t *SessionService) Validate(r *http.Request, args *SessionValidateArgs, result *SessionValidateReply) error

Verifies is a token is valid - public

func (*SessionService) Version

func (t *SessionService) Version(r *http.Request, args *string, result *string) error

Get version

type SessionValidateArgs

type SessionValidateArgs string

Call data

type SessionValidateReply

type SessionValidateReply bool

type StatsArgs

type StatsArgs struct {
}

type StatsReply

type StatsReply struct {
	Application string      `json:"application"`
	Version     string      `json:"version"`
	Host        string      `json:"host"`
	Statistics  *stats.Data `json:"statistics"`
}

type StatsService

type StatsService int

func (*StatsService) Status

func (t *StatsService) Status(r *http.Request, args *StatsArgs, result *StatsReply) error

type User

type User struct {
	User     string   `json:"username"`
	Password string   `json:"password"` // Salted
	Enabled  bool     `json:"enabled"`
	Roles    []string `json:"roles"`
}

Jump to

Keyboard shortcuts

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