Skip to content

Commit

Permalink
fix(NET-1540): add cfg to autoclose connections on rac, when logged out
Browse files Browse the repository at this point in the history
only auto-disconnect non-admin users when JWT expires on RAC
  • Loading branch information
Aceix committed Sep 20, 2024
1 parent 2e7d9ad commit ccf5bc8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions logic/jwts.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ func CreateUserJWT(username string, role models.UserRoleID) (response string, er
claims := &models.UserClaims{
UserName: username,
Role: role,
RacAutoDisable: (role != models.SuperAdminRole && role != models.AdminRole),
RegisteredClaims: jwt.RegisteredClaims{
Issuer: "Netmaker",
Subject: fmt.Sprintf("user|%s", username),
Expand Down
5 changes: 3 additions & 2 deletions models/user_mgmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,9 @@ type UserAuthParams struct {

// UserClaims - user claims struct
type UserClaims struct {
Role UserRoleID
UserName string
Role UserRoleID
UserName string
RacAutoDisable bool
jwt.RegisteredClaims
}

Expand Down

0 comments on commit ccf5bc8

Please sign in to comment.