summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/app/handler/authentication')
-rw-r--r--pkg/app/handler/authentication/auth_session/authsession.go3
-rw-r--r--pkg/app/handler/authentication/totp/totp.go3
-rw-r--r--pkg/app/handler/authentication/webauthn/login.go5
3 files changed, 7 insertions, 4 deletions
diff --git a/pkg/app/handler/authentication/auth_session/authsession.go b/pkg/app/handler/authentication/auth_session/authsession.go
index c86ca99..f365012 100644
--- a/pkg/app/handler/authentication/auth_session/authsession.go
+++ b/pkg/app/handler/authentication/auth_session/authsession.go
@@ -1,6 +1,7 @@
package auth_session
import (
+ "glsamaker/pkg/config"
"glsamaker/pkg/database/connection"
"glsamaker/pkg/logger"
"glsamaker/pkg/models"
@@ -52,7 +53,7 @@ func createSessionCookie(w http.ResponseWriter, sessionID string) {
ck := http.Cookie{
Name: "session",
- Domain: "localhost",
+ Domain: config.Domain(),
Path: "/",
Expires: expires,
}
diff --git a/pkg/app/handler/authentication/totp/totp.go b/pkg/app/handler/authentication/totp/totp.go
index 00e6b83..bc1e509 100644
--- a/pkg/app/handler/authentication/totp/totp.go
+++ b/pkg/app/handler/authentication/totp/totp.go
@@ -3,6 +3,7 @@ package totp
import (
"glsamaker/pkg/app/handler/authentication/auth_session"
"glsamaker/pkg/app/handler/authentication/utils"
+ "glsamaker/pkg/config"
"glsamaker/pkg/models/users"
"bytes"
"encoding/base64"
@@ -38,7 +39,7 @@ func GetToken(user *users.User) string {
func Generate(email string) (string, string) {
key, _ := totp.Generate(totp.GenerateOpts{
- Issuer: "glsamakertest.gentoo.org",
+ Issuer: config.Domain(),
AccountName: email,
})
diff --git a/pkg/app/handler/authentication/webauthn/login.go b/pkg/app/handler/authentication/webauthn/login.go
index 7bf9c1d..d729a55 100644
--- a/pkg/app/handler/authentication/webauthn/login.go
+++ b/pkg/app/handler/authentication/webauthn/login.go
@@ -7,6 +7,7 @@ import (
"fmt"
"github.com/duo-labs/webauthn.io/session"
webauthn_lib "github.com/duo-labs/webauthn/webauthn"
+ "glsamaker/pkg/config"
"log"
"net/http"
)
@@ -101,8 +102,8 @@ func CreateWebAuthn() {
if WebAuthn == nil {
authn, _ := webauthn_lib.New(&webauthn_lib.Config{
RPDisplayName: "Gentoo GLSAMaker", // Display Name for your site
- RPID: "glsamakertest.gentoo.org", // Generally the domain name for your site
- RPOrigin: "https://glsamakertest.gentoo.org", // The origin URL for WebAuthn requests
+ RPID: config.Domain(), // Generally the domain name for your site
+ RPOrigin: "https://" + config.Domain(), // The origin URL for WebAuthn requests
RPIcon: "https://assets.gentoo.org/tyrian/site-logo.png", // Optional icon URL for your site
})