web

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2016 License: Apache-2.0 Imports: 39 Imported by: 0

Documentation

Overview

Copyright 2015 Gravitational, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2015 Gravitational, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2015 Gravitational, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2015 Gravitational, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2015 Gravitational, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2015 Gravitational, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseContext

func CloseContext(key string, val interface{})
func CreateSignupLink(hostPort string, token string) string

func EncodeCookie

func EncodeCookie(user, sid string) (string, error)
func ErrorPageLink(message string) string

func SSHAgentLogin

func SSHAgentLogin(proxyAddr, user, password, hotpToken string, pubKey []byte,
	ttl time.Duration) (cert []byte, err error)

Types

type AuthHandler

type AuthHandler interface {
	GetHost() string
	Auth(user, pass string, hotpToken string) (string, error)
	GetCertificate(c SSHLoginCredentials) ([]byte, error)
	NewUserForm(token string) (user string, QRImg []byte, hotpFirstValues []string, e error)
	NewUserFinish(token, password, hotpToken string) error
	ValidateSession(user, sid string) (Context, error)
	SetSession(w http.ResponseWriter, user, sid string) error
	ClearSession(w http.ResponseWriter)
}

type Context

type Context interface {
	io.Closer
	ConnectUpstream(addr string) (*sshutils.Upstream, error)
	GetAuthMethods() ([]ssh.AuthMethod, error)
	GetWebSID() string
	GetUser() string
	GetClient() auth.ClientI
}
type Cookie struct {
	User string
	SID  string
}

func DecodeCookie

func DecodeCookie(b string) (*Cookie, error)

type LocalAuth

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

func NewLocalAuth

func NewLocalAuth(host string, servers []utils.NetAddr) (*LocalAuth, error)

func (*LocalAuth) Auth

func (s *LocalAuth) Auth(user, pass string, hotpToken string) (string, error)

func (*LocalAuth) ClearSession

func (s *LocalAuth) ClearSession(w http.ResponseWriter)

func (*LocalAuth) GetCertificate

func (s *LocalAuth) GetCertificate(c SSHLoginCredentials) ([]byte, error)

func (*LocalAuth) GetHost

func (s *LocalAuth) GetHost() string

func (*LocalAuth) NewUserFinish

func (s *LocalAuth) NewUserFinish(token, password, hotpToken string) error

func (*LocalAuth) NewUserForm

func (s *LocalAuth) NewUserForm(token string) (user string,
	QRImg []byte, hotpFirstValues []string, e error)

func (*LocalAuth) SetSession

func (s *LocalAuth) SetSession(w http.ResponseWriter, user, sid string) error

func (*LocalAuth) ValidateSession

func (s *LocalAuth) ValidateSession(user, sid string) (Context, error)

type LocalContext

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

func (*LocalContext) Close

func (c *LocalContext) Close() error

func (*LocalContext) ConnectUpstream

func (c *LocalContext) ConnectUpstream(addr string) (*sshutils.Upstream, error)

func (*LocalContext) GetAuthMethods

func (c *LocalContext) GetAuthMethods() ([]ssh.AuthMethod, error)

func (*LocalContext) GetClient

func (c *LocalContext) GetClient() auth.ClientI

func (*LocalContext) GetUser

func (c *LocalContext) GetUser() string

func (*LocalContext) GetWebSID

func (c *LocalContext) GetWebSID() string

type MultiSiteConfig

type MultiSiteConfig struct {
	Tun        reversetunnel.Server
	AssetsDir  string
	AuthAddr   utils.NetAddr
	DomainName string
}

type MultiSiteHandler

type MultiSiteHandler struct {
	httprouter.Router

	sync.Mutex
	// contains filtered or unexported fields
}

func NewMultiSiteHandler

func NewMultiSiteHandler(cfg MultiSiteConfig) (*MultiSiteHandler, error)

func (*MultiSiteHandler) String

func (h *MultiSiteHandler) String() string
type NavSection struct {
	Title string `json:"title"`
	URL   string `json:"url"`
	Icon  string `json:"icon"`
}

type SSHLoginCredentials

type SSHLoginCredentials struct {
	User      string
	Password  string
	HOTPToken string
	PubKey    []byte
	TTL       time.Duration
}

type Server

type Server struct {
	http.Server
}

func New

func New(addr utils.NetAddr, cfg MultiSiteConfig) (*Server, error)

type SiteHandler

type SiteHandler struct {
	httprouter.Router

	sync.Mutex
	// contains filtered or unexported fields
}

SiteHandler implements methods for single site

func NewSiteHandler

func NewSiteHandler(cfg SiteHandlerConfig) *SiteHandler

func (*SiteHandler) Path

func (s *SiteHandler) Path(params ...string) string

type SiteHandlerConfig

type SiteHandlerConfig struct {
	Auth        AuthHandler
	AssetsDir   string
	NavSections []NavSection
	URLPrefix   string
}

type TunAuth

type TunAuth struct {
	AuthHandler
	// contains filtered or unexported fields
}

func NewTunAuth

func NewTunAuth(auth AuthHandler, srv reversetunnel.Server, siteName string) (*TunAuth, error)

func (*TunAuth) ValidateSession

func (t *TunAuth) ValidateSession(user, sid string) (Context, error)

type TunContext

type TunContext struct {
	Context
	// contains filtered or unexported fields
}

func (*TunContext) ConnectUpstream

func (c *TunContext) ConnectUpstream(addr string) (*sshutils.Upstream, error)

func (*TunContext) GetClient

func (c *TunContext) GetClient() auth.ClientI

Jump to

Keyboard shortcuts

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