mirror of
https://git.rwth-aachen.de/acs/public/villas/web-backend-go/
synced 2025-03-30 00:00:12 +01:00
Authentication: remove unused argument
This commit is contained in:
parent
f6e48ce9f7
commit
f4c662940e
11 changed files with 12 additions and 14 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"))
|
||||
|
||||
|
|
|
@ -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"))
|
||||
|
|
|
@ -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"))
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"))
|
||||
|
|
|
@ -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"))
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue