コード例 #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")
}