diff --git a/auth.go b/auth.go
index ddd0f4d..03345c3 100644
--- a/auth.go
+++ b/auth.go
@@ -82,7 +82,7 @@ func completeAuth(w http.ResponseWriter, username string, email string, firstnam
Expires: time.Now().Add(30 * 24 * time.Hour),
HttpOnly: true,
SameSite: http.SameSiteStrictMode,
- //Secure: true,
+ Secure: true,
})
return
diff --git a/auth_krb5.go b/auth_krb5.go
index 012f09b..ff6d1ed 100644
--- a/auth_krb5.go
+++ b/auth_krb5.go
@@ -51,7 +51,7 @@ func checkAuthKrb5(w http.ResponseWriter, _ httprouter.Params, body []byte) (int
}
}
- if !found {
+ if !userExists(lf.Login) && !found {
return nil, fmt.Errorf("You are not allowed to log you in this way. Please use OpenID Connect.")
}
diff --git a/auth_oidc.go b/auth_oidc.go
index 828153b..e5ca93b 100644
--- a/auth_oidc.go
+++ b/auth_oidc.go
@@ -20,6 +20,7 @@ var (
oidcRedirectURL = "https://srs.nemunai.re"
oauth2Config oauth2.Config
oidcVerifier *oidc.IDTokenVerifier
+ nextSessionMap = map[string]string{}
)
func init() {
@@ -60,6 +61,12 @@ func initializeOIDC() {
func redirectOIDC_CRI(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
session, err := NewSession()
+
+ // Save next parameter
+ if len(r.URL.Query().Get("next")) > 0 {
+ nextSessionMap[fmt.Sprintf("%x", session.Id)] = r.URL.Query().Get("next")
+ }
+
if err != nil {
http.Error(w, fmt.Sprintf("{'errmsg':%q}", err.Error()), http.StatusInternalServerError)
} else {
@@ -121,5 +128,12 @@ func OIDC_CRI_complete(w http.ResponseWriter, r *http.Request, ps httprouter.Par
return
}
- http.Redirect(w, r, "/", http.StatusFound)
+ // Retrieve next URL associated with session
+ if next, ok := nextSessionMap[fmt.Sprintf("%x", session.Id)]; ok {
+ http.Redirect(w, r, next, http.StatusFound)
+ delete(nextSessionMap, fmt.Sprintf("%x", session.Id))
+ } else {
+ http.Redirect(w, r, "/", http.StatusFound)
+ }
+
}
diff --git a/ui/src/components/AuthButton.svelte b/ui/src/components/AuthButton.svelte
new file mode 100644
index 0000000..fc148fe
--- /dev/null
+++ b/ui/src/components/AuthButton.svelte
@@ -0,0 +1,19 @@
+
+
+
+
+
diff --git a/ui/src/routes/__layout.svelte b/ui/src/routes/__layout.svelte
index 10145b6..a99d9f2 100644
--- a/ui/src/routes/__layout.svelte
+++ b/ui/src/routes/__layout.svelte
@@ -42,6 +42,7 @@