Documentation ¶
Index ¶
- func ConvertPlainPassword(rawUsername, rawPassword string) string
- func CreateHash(key string) string
- type CookieManager
- type SCManager
- func (SCManager *SCManager) AuthenticateCookie(w http.ResponseWriter, Server *Server, clientCookie database.CookieData, ...) error
- func (SCManager *SCManager) CreateCookie(w http.ResponseWriter, m bson.ObjectId, urlString string) string
- func (SCManager *SCManager) DecodeDBCookieData(data database.CookieData, session *mgo.Session) database.CookieData
- func (SCManager *SCManager) DeleteClientCookie(w http.ResponseWriter, urlString string) error
- func (SCManager *SCManager) DeleteDBCookie(clientCookie database.CookieData, Server *Server, session *mgo.Session) error
- func (SCManager *SCManager) FetchCookie(r *http.Request) (database.CookieData, error)
- func (SCManager *SCManager) Init()
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertPlainPassword ¶
ConvertPlainPassword hashes a raw password and returns the hashed password
Types ¶
type CookieManager ¶
type CookieManager interface { Init() FetchCookie(r *http.Request) database.CookieData CreateCookie(w http.ResponseWriter, m bson.ObjectId, urlString string) string DeleteClientCookie(w http.ResponseWriter, urlString string) string DeleteDBCookie(clientCookie database.CookieData, session *mgo.Session) error DecodeDBCookieData(data database.CookieData, session *mgo.Session) database.CookieData AuthenticateCookie(w http.ResponseWriter, Server *Server, clientCookie database.CookieData, session *mgo.Session) error }
CookieManager is for managing one secure cookie
type SCManager ¶
type SCManager struct {
// contains filtered or unexported fields
}
SCManager implements CookieManager interface. Also holds a SecureCookie
func (*SCManager) AuthenticateCookie ¶
func (SCManager *SCManager) AuthenticateCookie(w http.ResponseWriter, Server *Server, clientCookie database.CookieData, session *mgo.Session) error
AuthenticateCookie checks client cookie towards db cookie to validate the client cookie Returns an error if authentication failed
func (*SCManager) CreateCookie ¶
func (SCManager *SCManager) CreateCookie(w http.ResponseWriter, m bson.ObjectId, urlString string) string
CreateCookie creates a client cookie with login credentials and encodes it encoded data will be returned as string as well as set in http
func (*SCManager) DecodeDBCookieData ¶
func (SCManager *SCManager) DecodeDBCookieData(data database.CookieData, session *mgo.Session) database.CookieData
DecodeDBCookieData decodes cookie data Returns decoded cookie data if success
func (*SCManager) DeleteClientCookie ¶
func (SCManager *SCManager) DeleteClientCookie(w http.ResponseWriter, urlString string) error
DeleteClientCookie deletes(overwrites) client cookie. Returns error if it failed
func (*SCManager) DeleteDBCookie ¶
func (SCManager *SCManager) DeleteDBCookie(clientCookie database.CookieData, Server *Server, session *mgo.Session) error
DeleteDBCookie deletes all cookies with same user id as sent cookie Returns error if failed
func (*SCManager) FetchCookie ¶
FetchCookie retrieves the client cookie and decodes its content. Returns the decoded data and an error