Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/redirect to frontend #52

Merged
merged 3 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions internal/core/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 2 additions & 0 deletions internal/webserver/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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
}
2 changes: 1 addition & 1 deletion internal/webserver/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,6 @@ func (i *IngestorWebServerImplemenation) GetLogout(ctx context.Context, request
}

return GetLogout302Response{GetLogout302ResponseHeaders{
Location: "/",
Location: i.frontendUrl,
}}, nil
}
5 changes: 3 additions & 2 deletions internal/webserver/wsconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down
1 change: 1 addition & 0 deletions test/testdata/valid_config_globus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ WebServer:
Auth:
Disable: false
SessionDuration: 28800
FrontendUrl: "http://scicat.localhost/ingest"
OAuth2:
ClientID: "ingestor"
RedirectURL: "http://localhost:8888/callback"
Expand Down
1 change: 1 addition & 0 deletions test/testdata/valid_config_s3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ WebServer:
Auth:
Disable: false
SessionDuration: 28800
FrontendUrl: "http://scicat.localhost/ingest"
OAuth2:
ClientID: "ingestor"
RedirectURL: "http://localhost:8888/callback"
Expand Down
Loading