mirror of
https://github.com/janishutz/oidclogin.git
synced 2026-10-08 17:26:20 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
59f635f01e | ||
|
|
d9ca3abb6c |
No files matched your search
@@ -128,6 +128,15 @@ func logoutHandler(c *gin.Context) {
|
||||
session := sessions.Default(c)
|
||||
session.Clear()
|
||||
session.Save()
|
||||
redir := ""
|
||||
if c.Query("returnTo") != "" {
|
||||
redir = c.Query("returnTo")
|
||||
}
|
||||
if redir != "" {
|
||||
c.Redirect(307, redir)
|
||||
} else {
|
||||
c.Redirect(307, defaultRedirect)
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure that a user is currently logged in.
|
||||
|
||||
@@ -29,13 +29,19 @@ var (
|
||||
defaultRedirect string
|
||||
)
|
||||
|
||||
// Configure and set up the login SDK. The user_function is used to create or update a user
|
||||
func Configure(r *gin.Engine, app_url string, default_redirect string, user_function UserFunc, stubs_on_unconfigured bool) {
|
||||
// Wraps the normal configure function, but also gives you access to change the User Function, which is called upon login.
|
||||
// It is used to create or update a user.
|
||||
func ConfigureFull(r *gin.Engine, app_url string, default_redirect string, user_function UserFunc, stubs_on_unconfigured bool) {
|
||||
userFunc = user_function
|
||||
Configure(r, app_url, default_redirect, stubs_on_unconfigured)
|
||||
}
|
||||
|
||||
// Configure and set up the login SDK
|
||||
func Configure(r *gin.Engine, app_url string, default_redirect string, stubs_on_unconfigured bool) {
|
||||
issuer := os.Getenv("OIDC_ISSUER")
|
||||
clientID := os.Getenv("OIDC_CLIENT_ID")
|
||||
clientSecret := os.Getenv("OIDC_CLIENT_SECRET")
|
||||
defaultRedirect = default_redirect
|
||||
userFunc = user_function
|
||||
|
||||
if issuer == "" || clientID == "" || clientSecret == "" {
|
||||
if stubs_on_unconfigured {
|
||||
|
||||
Reference in new issue
Block a user