Authentication: remove unused argument

This commit is contained in:
Steffen Vogel 2021-01-25 12:28:27 +01:00
parent f6e48ce9f7
commit f4c662940e
11 changed files with 12 additions and 14 deletions

View file

@ -158,7 +158,7 @@ func TestMain(m *testing.M) {
api := router.Group("/api")
user.RegisterAuthenticate(api.Group("/authenticate"))
api.Use(user.Authentication(true))
api.Use(user.Authentication())
RegisterComponentConfigurationEndpoints(api.Group("/configs"))
// scenario endpoints required here to first add a scenario to the DB
// that can be associated with a new component configuration

View file

@ -97,7 +97,7 @@ func TestMain(m *testing.M) {
api := router.Group("/api")
user.RegisterAuthenticate(api.Group("/authenticate"))
api.Use(user.Authentication(true))
api.Use(user.Authentication())
RegisterDashboardEndpoints(api.Group("/dashboards"))
// scenario endpoints required here to first add a scenario to the DB
// that can be associated with a new dashboard

View file

@ -95,7 +95,7 @@ func TestMain(m *testing.M) {
api := router.Group("/api")
user.RegisterAuthenticate(api.Group("/authenticate"))
api.Use(user.Authentication(true))
api.Use(user.Authentication())
// scenario endpoints required here to first add a scenario to the DB
scenario.RegisterScenarioEndpoints(api.Group("/scenarios"))

View file

@ -134,7 +134,7 @@ func TestMain(m *testing.M) {
api = router.Group("/api")
user.RegisterAuthenticate(api.Group("/authenticate"))
api.Use(user.Authentication(true))
api.Use(user.Authentication())
RegisterICEndpoints(api.Group("/ic"))
// component configuration endpoints required to associate an IC with a component config
component_configuration.RegisterComponentConfigurationEndpoints(api.Group("/configs"))

View file

@ -84,7 +84,7 @@ func RegisterEndpoints(router *gin.Engine, api *gin.RouterGroup) {
// login (POST /authenticate)
user.RegisterAuthenticate(api.Group("/authenticate"))
api.Use(user.Authentication(true))
api.Use(user.Authentication())
scenario.RegisterScenarioEndpoints(api.Group("/scenarios"))
component_configuration.RegisterComponentConfigurationEndpoints(api.Group("/configs"))

View file

@ -113,7 +113,7 @@ func TestMain(m *testing.M) {
api := router.Group("/api")
user.RegisterAuthenticate(api.Group("/authenticate"))
api.Use(user.Authentication(true))
api.Use(user.Authentication())
// scenario endpoints required here to first add a scenario to the DB
scenario.RegisterScenarioEndpoints(api.Group("/scenarios"))
// file endpoints required to download result file

View file

@ -80,7 +80,7 @@ func TestMain(m *testing.M) {
api := router.Group("/api")
user.RegisterAuthenticate(api.Group("/authenticate"))
api.Use(user.Authentication(true))
api.Use(user.Authentication())
// user endpoints required to set user to inactive
user.RegisterUserEndpoints(api.Group("/users"))

View file

@ -165,7 +165,7 @@ func TestMain(m *testing.M) {
api := router.Group("/api")
user.RegisterAuthenticate(api.Group("/authenticate"))
api.Use(user.Authentication(true))
api.Use(user.Authentication())
// component-configuration endpoints required here to first add a component config to the DB
// that can be associated with a new signal
component_configuration.RegisterComponentConfigurationEndpoints(api.Group("/configs"))

View file

@ -46,7 +46,7 @@ func userToContext(ctx *gin.Context, user_id uint) {
ctx.Set(database.UserIDCtx, user_id)
}
func Authentication(unauthorized bool) gin.HandlerFunc {
func Authentication() gin.HandlerFunc {
return func(ctx *gin.Context) {
@ -74,9 +74,7 @@ func Authentication(unauthorized bool) gin.HandlerFunc {
// If the authentication extraction fails return HTTP CODE 401
if err != nil {
if unauthorized {
helper.UnauthorizedAbort(ctx, "Authentication failed (claims extraction)")
}
helper.UnauthorizedAbort(ctx, "Authentication failed (claims extraction)")
return
}

View file

@ -66,7 +66,7 @@ func TestMain(m *testing.M) {
api := router.Group("/api")
RegisterAuthenticate(api.Group("/authenticate"))
api.Use(Authentication(true))
api.Use(Authentication())
RegisterUserEndpoints(api.Group("/users"))
os.Exit(m.Run())

View file

@ -132,7 +132,7 @@ func TestMain(m *testing.M) {
api := router.Group("/api")
user.RegisterAuthenticate(api.Group("/authenticate"))
api.Use(user.Authentication(true))
api.Use(user.Authentication())
RegisterWidgetEndpoints(api.Group("/widgets"))
// scenario endpoints required here to first add a scenario to the DB
// that can be associated with a new dashboard