DEVELOPMENT ENVIRONMENT

~liljamo/tixe

ref: dabeb23b2a9717bddba91cc8c530c134d0224ede tixe/handlers/authlogout.go -rw-r--r-- 867 bytes
dabeb23bJonni Liljamo docs: update example docker-compose 1 year, 1 month ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*
 * Copyright (C) 2023 Jonni Liljamo <jonni@liljamo.com>
 *
 * This file is licensed under AGPL-3.0-or-later, see NOTICE and LICENSE for
 * more information.
 */
package handlers

import (
	"net/http"

	"github.com/gin-contrib/sessions"
	"github.com/gin-gonic/gin"
)

func AuthLogout(c *gin.Context) {
	session := sessions.Default(c)
	session.Clear()
	_ = session.Save()

	/*
	logoutUrl, err := url.Parse("https://" + config.TixeConfig.OidcDomain + "/logout")
	if err != nil {
		c.String(http.StatusInternalServerError, err.Error())
		return
	}

	params := url.Values{}
	params.Add("returnTo", config.TixeConfig.Scheme + "://" + config.TixeConfig.Host)
	params.Add("client_id", config.TixeConfig.OidcClientID)
	logoutUrl.RawQuery = params.Encode()

	c.Redirect(http.StatusTemporaryRedirect, logoutUrl.String())
	*/

	c.Redirect(http.StatusTemporaryRedirect, "/")
}