package x import ( "net/http" "github.com/coreos/go-oidc/v3/oidc" "golang.org/x/oauth2" ) type Session struct { Token *oauth2.Token IdToken *oidc.IDToken IdTokenRaw interface{} Profile map[string]interface{} AccessTokenClaims map[string]interface{} Message string OAuthState string } func (s *Session) IsLoggedIn() bool { return s.Token != nil } func (s *Session) Flash(msg string, w http.ResponseWriter, r *http.Request) { s.Message = msg http.Redirect(w, r, "/", http.StatusTemporaryRedirect) } func (s *Session) Reset() { s.Token = nil s.IdToken = nil s.IdTokenRaw = nil s.Profile = map[string]interface{}{} s.AccessTokenClaims = map[string]interface{}{} s.Message = "" s.OAuthState = "" }