func (s *Delegator) load() *Delegator { session := s.Session() if session != nil { if p := session.Get(sessionPrincipalsKey); p != nil { s.principals = p.([]interface{}) } if a := session.Get(sessionAuthenticatedKey); a != nil { s.authenticated = a.(bool) } } return s }
func (s *Delegator) getPrincipalStack() (*PrincipalStack, error) { session := s.Session() if session != nil { var p *PrincipalStack ps := session.Get(sessionRunAsKey) // The thing is that we don't know in which format the session is storing // our stuff; this is a known problem with Gorilla. if ps == nil { p = &PrincipalStack{} } else if _, ok := ps.(*PrincipalStack); ok { p = ps.(*PrincipalStack) } else if _, ok := ps.(PrincipalStack); ok { pp := ps.(PrincipalStack) p = &pp } return p, nil } return nil, errors.New("No session available") }