-
-
Notifications
You must be signed in to change notification settings - Fork 538
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
Add session expire functionality based on inactivity #2326
Conversation
Hello @ctrl-zzz can you check the failing tests and Sonar checks? We will review the feature and give you a feedback ASAP |
Hello, I believe they are about the Cognitive Complexity of some methods. Since it's a new feature I added some new properties that had to be checked as well for some functionalities. I guess there needs to be less conditions to be checked, but not checking them wouldn't make the methods work as intended |
thanks, there are some optimizations that can done, see some suggestions below: For For
if peer.AddedWithSSOLogin() {
if peer.LoginExpirationEnabled && account.Settings.PeerLoginExpirationEnabled {
am.checkAndSchedulePeerLoginExpiration(ctx, account)
}
if peer.InactivityExpirationEnabled && account.Settings.PeerInactivityExpirationEnabled {
am.checkAndSchedulePeerInactivityExpiration(ctx, account)
}
} |
…accountsettings methods
902c88a
to
342c939
Compare
Quality Gate passedIssues Measures |
# Conflicts: # management/server/http/api/types.gen.go # management/server/peer.go
# Conflicts: # management/server/account.go
Quality Gate passedIssues Measures |
Describe your changes
I have implemented a session timeout feature based on inactivity, forcing re-authentication with every
netbird up
. This was necessary because, while evaluating if Netbird was suitable for my use case, I noticed that authentication is only required after the login expiration period has elapsed. For security reasons, I wanted access to be required with every connection: this way, the authentication process with the identity provider is triggered and, by using a session timeout setting in Keycloak, credentials are requested each time.Building on the existing approach for login expiration, I implemented inactivity expiration by checking the status of a peer: after a configurable period of time following
netbird down
, the peer showslogin required
.I also added a setting,
inactivityExpirationEnabled
, that can enable or disable the inactivity expiration feature through the APIs.I needed this functionality due to a business requirement and thought it might be useful to you as well.
Checklist