httpapi

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const API = "1.0"

API is the current API version

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	SessionExpiration int `default:"60"` //in minutes

	LDAPServer   string `required:"true"`
	LDAPPort     int    `default:"389" required:"true"`
	LDAPBaseDN   string `required:"true"`
	LDAPSecurity string `default:"none" required:"true"`

	GroupRoleMap  RoleMap           `required:"true"` //map[group]roles
	APIKeyRoleMap map[string]string //map[api_key]role

	ListenAddr string `default:":8080" required:"true"` //addr format used for net.Dial; required
	Prefix     string //url prefix to mount api to without trailing slash
}

Config represents options given in the environment

func (*Config) SecurityType

func (c *Config) SecurityType() auth.SecurityType

SecurityType returns the auth.SecurityType for the config

type RoleMap

type RoleMap map[string][]string

RoleMap represents groups mapped to roles

func (*RoleMap) Decode

func (r *RoleMap) Decode(val string) error

Decode parses the format k1:v1,v2,...;k2:v3,v4,... to map[string][]string

func (*RoleMap) Groups

func (r *RoleMap) Groups() []string

Groups returns the groups in r

type Server

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

Server represents shared resources

func NewServer

func NewServer(config *Config) *Server

NewServer returns a new server with the given resources

func (*Server) Router

func (s *Server) Router() http.Handler

Router returns a new router

func (*Server) UserRoles

func (s *Server) UserRoles(sess session.Session) []string

UserRoles returns the roles for the session user

Jump to

Keyboard shortcuts

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