diff --git a/internal/core/config_test.go b/internal/core/config_test.go index fd56720..b4dc1f2 100644 --- a/internal/core/config_test.go +++ b/internal/core/config_test.go @@ -56,6 +56,7 @@ func createExpectedValidConfig(transferConfig task.TransferConfig) Config { expected_ws := wsconfig.WebServerConfig{ AuthConf: wsconfig.AuthConf{ SessionDuration: 28800, + FrontendUrl: "http://scicat.localhost/ingest", OAuth2Conf: wsconfig.OAuth2Conf{ ClientID: "ingestor", RedirectURL: "http://localhost:8888/callback", diff --git a/internal/webserver/api.go b/internal/webserver/api.go index 4b7f7a0..58db0fc 100644 --- a/internal/webserver/api.go +++ b/internal/webserver/api.go @@ -31,6 +31,7 @@ type IngestorWebServerImplemenation struct { sessionDuration uint scopeToRoleMap map[string]string pathConfig wsconfig.PathsConf + frontendUrl string } func NewIngestorWebServer(version string, tq *core.TaskQueue, eh *metadataextractor.ExtractorHandler, ws wsconfig.WebServerConfig) (*IngestorWebServerImplemenation, error) { @@ -88,5 +89,6 @@ func NewIngestorWebServer(version string, tq *core.TaskQueue, eh *metadataextrac sessionDuration: ws.SessionDuration, pathConfig: ws.PathsConf, metp: metp, + frontendUrl: ws.FrontendUrl, }, nil } diff --git a/internal/webserver/auth.go b/internal/webserver/auth.go index edfe2ae..29a886c 100644 --- a/internal/webserver/auth.go +++ b/internal/webserver/auth.go @@ -202,6 +202,6 @@ func (i *IngestorWebServerImplemenation) GetLogout(ctx context.Context, request } return GetLogout302Response{GetLogout302ResponseHeaders{ - Location: "/", + Location: i.frontendUrl, }}, nil } diff --git a/internal/webserver/wsconfig/config.go b/internal/webserver/wsconfig/config.go index 8ab05a8..c581c96 100644 --- a/internal/webserver/wsconfig/config.go +++ b/internal/webserver/wsconfig/config.go @@ -37,8 +37,9 @@ type RBACConf struct { // full authentication config type AuthConf struct { - Disable bool `bool:"Disable"` - SessionDuration uint // duration of a user session before it expires (by default never) + Disable bool `bool:"Disable"` + SessionDuration uint // duration of a user session before it expires (by default never) + FrontendUrl string `validate:"required_if=Disable false,omitempty"` // used for redirecting the user back to the frontend after login OAuth2Conf `mapstructure:"OAuth2" validate:"required_if=Disable false,omitempty"` OIDCConf `mapstructure:"OIDC" validate:"required_if=Disable false,omitempty"` JWTConf `mapstructure:"JWT" validate:"required_if=Disable false,omitempty"` diff --git a/test/testdata/valid_config_globus.yaml b/test/testdata/valid_config_globus.yaml index 31875f5..f17677a 100644 --- a/test/testdata/valid_config_globus.yaml +++ b/test/testdata/valid_config_globus.yaml @@ -59,6 +59,7 @@ WebServer: Auth: Disable: false SessionDuration: 28800 + FrontendUrl: "http://scicat.localhost/ingest" OAuth2: ClientID: "ingestor" RedirectURL: "http://localhost:8888/callback" diff --git a/test/testdata/valid_config_s3.yaml b/test/testdata/valid_config_s3.yaml index 4a2b0c1..e00025e 100644 --- a/test/testdata/valid_config_s3.yaml +++ b/test/testdata/valid_config_s3.yaml @@ -56,6 +56,7 @@ WebServer: Auth: Disable: false SessionDuration: 28800 + FrontendUrl: "http://scicat.localhost/ingest" OAuth2: ClientID: "ingestor" RedirectURL: "http://localhost:8888/callback"