session

package module
v0.0.0-...-551cb73 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2015 License: Apache-2.0 Imports: 8 Imported by: 0

README

session

Secure session IDs encrypted by lemma

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.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearSession

func ClearSession(w http.ResponseWriter, fqdn string) error

func EncodeCookie

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

func SetSession

func SetSession(w http.ResponseWriter, fqdn, user, sid string) error

Types

type IDPair

type IDPair struct {
	SID SecureID
	PID PlainID
}

IDPair is a pair of unique and encrypted session id

func EncodeID

func EncodeID(id string, s secret.SecretService) (*IDPair, error)

func NewID

func NewID(s secret.SecretService) (*IDPair, error)

type MalformedSessionError

type MalformedSessionError struct {
	S   SecureID
	Msg string
}

func (*MalformedSessionError) Error

func (m *MalformedSessionError) Error() string

type PlainID

type PlainID string

Plain text unique session id

func DecodeSID

func DecodeSID(sid SecureID, s secret.SecretService) (PlainID, error)

type SecureID

type SecureID string

Secure encrypted session id

type SessionCookie

type SessionCookie struct {
	User string `json:"user"`
	SID  string `json:"sid"`
}

func DecodeCookie

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

Jump to

Keyboard shortcuts

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