mirror of
https://github.com/netbirdio/netbird.git
synced 2026-04-18 08:16:39 +00:00
rename endpoint
This commit is contained in:
@@ -16,6 +16,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
|
"github.com/netbirdio/netbird/management/server/types"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
@@ -220,7 +221,7 @@ func applyEmbeddedIdPConfig(ctx context.Context, cfg *nbconfig.Config) error {
|
|||||||
cfg.HttpConfig.OIDCConfigEndpoint = issuer + "/.well-known/openid-configuration"
|
cfg.HttpConfig.OIDCConfigEndpoint = issuer + "/.well-known/openid-configuration"
|
||||||
cfg.HttpConfig.IdpSignKeyRefreshEnabled = true
|
cfg.HttpConfig.IdpSignKeyRefreshEnabled = true
|
||||||
callbackURL := strings.TrimSuffix(cfg.HttpConfig.AuthIssuer, "/oauth2")
|
callbackURL := strings.TrimSuffix(cfg.HttpConfig.AuthIssuer, "/oauth2")
|
||||||
cfg.HttpConfig.AuthCallbackURL = callbackURL + "/api/oauth/callback"
|
cfg.HttpConfig.AuthCallbackURL = callbackURL + types.ProxyCallbackEndpoint
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
|
"github.com/netbirdio/netbird/management/server/types"
|
||||||
"github.com/rs/cors"
|
"github.com/rs/cors"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
|
||||||
@@ -83,7 +84,7 @@ func NewAPIHandler(ctx context.Context, accountManager account.Manager, networks
|
|||||||
return nil, fmt.Errorf("failed to add bypass path: %w", err)
|
return nil, fmt.Errorf("failed to add bypass path: %w", err)
|
||||||
}
|
}
|
||||||
// OAuth callback for proxy authentication
|
// OAuth callback for proxy authentication
|
||||||
if err := bypass.AddBypassPath("/api/oauth/callback"); err != nil {
|
if err := bypass.AddBypassPath(types.ProxyCallbackEndpoint); err != nil {
|
||||||
return nil, fmt.Errorf("failed to add bypass path: %w", err)
|
return nil, fmt.Errorf("failed to add bypass path: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import (
|
|||||||
|
|
||||||
"github.com/dexidp/dex/storage"
|
"github.com/dexidp/dex/storage"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
|
"github.com/netbirdio/netbird/management/server/types"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
|
||||||
"github.com/netbirdio/netbird/idp/dex"
|
"github.com/netbirdio/netbird/idp/dex"
|
||||||
@@ -94,7 +95,7 @@ func (c *EmbeddedIdPConfig) ToYAMLConfig() (*dex.YAMLConfig, error) {
|
|||||||
// Build dashboard redirect URIs including the OAuth callback for proxy authentication
|
// Build dashboard redirect URIs including the OAuth callback for proxy authentication
|
||||||
dashboardRedirectURIs := c.DashboardRedirectURIs
|
dashboardRedirectURIs := c.DashboardRedirectURIs
|
||||||
baseURL := strings.TrimSuffix(c.Issuer, "/oauth2")
|
baseURL := strings.TrimSuffix(c.Issuer, "/oauth2")
|
||||||
dashboardRedirectURIs = append(dashboardRedirectURIs, baseURL+"/api/oauth/callback")
|
dashboardRedirectURIs = append(dashboardRedirectURIs, baseURL+types.ProxyCallbackEndpoint)
|
||||||
|
|
||||||
cfg := &dex.YAMLConfig{
|
cfg := &dex.YAMLConfig{
|
||||||
Issuer: c.Issuer,
|
Issuer: c.Issuer,
|
||||||
|
|||||||
4
management/server/types/proxy.go
Normal file
4
management/server/types/proxy.go
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
package types
|
||||||
|
|
||||||
|
// ProxyCallbackEndpoint holds the proxy callback endpoint
|
||||||
|
const ProxyCallbackEndpoint = "/api/reverse-proxy/callback"
|
||||||
Reference in New Issue
Block a user