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

fix(NET-1540): add cfg to autoclose connections on rac, when logged out #3130

Merged
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
5 changes: 3 additions & 2 deletions logic/jwts.go
Aceix marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ func CreateJWT(uuid string, macAddress string, network string) (response string,
func CreateUserJWT(username string, role models.UserRoleID) (response string, err error) {
expirationTime := time.Now().Add(servercfg.GetServerConfig().JwtValidityDuration)
claims := &models.UserClaims{
UserName: username,
Role: role,
UserName: username,
Role: role,
RacAutoDisable: servercfg.GetRacAutoDisable() && (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
Loading