feat: new env variable for server URI

This commit is contained in:
2025-06-06 12:04:25 +02:00
parent 2b40e4e922
commit 83e3e5a2e9
7 changed files with 11 additions and 13 deletions

View File

@ -23,11 +23,11 @@ func (h *OAuthHandler) OpenIdConfiguration(w http.ResponseWriter, r *http.Reques
w.Header().Set("Content-Type", "application/json")
if err := encoder.Encode(Response{
TokenEndpoint: h.cfg.Jwt.Issuer + "/api/v1/oauth/token",
AuthorizationEndpoint: h.cfg.Jwt.Issuer + "/api/v1/oauth/authorize",
JwksURI: h.cfg.Jwt.Issuer + "/.well-known/jwks.json",
Issuer: h.cfg.Jwt.Issuer,
EndSessionEndpoint: h.cfg.Jwt.Issuer + "/api/v1/oauth/logout",
TokenEndpoint: h.cfg.Uri + "/api/v1/oauth/token",
AuthorizationEndpoint: h.cfg.Uri + "/api/v1/oauth/authorize",
JwksURI: h.cfg.Uri + "/.well-known/jwks.json",
Issuer: h.cfg.Uri,
EndSessionEndpoint: h.cfg.Uri + "/api/v1/oauth/logout",
}); err != nil {
web.Error(w, "failed to encode response", http.StatusInternalServerError)
}

View File

@ -91,7 +91,7 @@ func (h *OAuthHandler) tokenEndpoint(w http.ResponseWriter, r *http.Request) {
Nonce: nonce,
Roles: roles,
RegisteredClaims: jwt.RegisteredClaims{
Issuer: h.cfg.Jwt.Issuer,
Issuer: h.cfg.Uri,
// TODO: use dedicated API id that is in local DB and bind to user there
Subject: user.ID.String(),
Audience: jwt.ClaimStrings{clientId},