示例#1
0
文件: subject.go 项目: jalkanen/kuro
// Load and store the Subject into the store itself.  In practice, all
// we need to store are the principals and whether the user is authenticated
// or not.
func (s *Delegator) store() {
	session := s.Session()

	if session != nil {
		session.Set(sessionPrincipalsKey, s.principals)
		session.Set(sessionAuthenticatedKey, s.authenticated)

		session.Save()
	}
}
示例#2
0
文件: subject.go 项目: jalkanen/kuro
func (s *Delegator) storePrincipalStack(ps *PrincipalStack) error {

	if ps.IsEmpty() {
		return errors.New("Principal stack must contain at least one principal.")
	}

	if session := s.Session(); session != nil {
		session.Set(sessionRunAsKey, ps)
		return nil
	}

	return errors.New("No session available")
}