Documentation
¶
Index ¶
- Constants
- Variables
- func Apply(m []AuthenticatedResource)
- func CheckSession(c *revel.Controller)
- func InvalidateSession()
- func RegisterSession(c *revel.Controller, hash string, password string) error
- func SetSession(c *revel.Controller)
- func VerifySession(sid string) bool
- type AuthenticatedResource
- type Session
Constants ¶
View Source
const (
SESSION_KEY = "BasicAuthSessionId"
)
Variables ¶
View Source
var SessionAuthenticationFilter = func(c *revel.Controller, fc []revel.Filter) {
SessionId = c.Session.Id()
fc[0](c, fc[1:])
}
The actual filter added to the resource. It checks for valid session information and redirects the response to create a new session if it is not available or valid.
View Source
var (
SessionId string
)
Functions ¶
func Apply ¶
func Apply(m []AuthenticatedResource)
Apply is run by the developer in the init.go file for his/her project. It loops over the slice for all AuthenticatedResources the developer wishes to be protected with authentication.
func CheckSession ¶
func CheckSession(c *revel.Controller)
CheckSession is called by SessionAuthenticationFilter to check for a valid session.
func InvalidateSession ¶
func InvalidateSession()
func RegisterSession ¶
func RegisterSession(c *revel.Controller, hash string, password string) error
func SetSession ¶
func SetSession(c *revel.Controller)
func VerifySession ¶
VerifySession checks stored session id against stored value
Types ¶
type AuthenticatedResource ¶
type AuthenticatedResource struct {
Resource interface{}
Role string // TODO: allow role-based ACL config
}
defines resource that needs authentication
Click to show internal directories.
Click to hide internal directories.