Created
September 26, 2019 13:25
-
-
Save gayashanbc/d57c83339aeaa30e6c82dbad0bbc2ee1 to your computer and use it in GitHub Desktop.
Configuring active-sessions-limit-handler variables through deployment.toml file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Concurrent-Session-Management from Template... | |
// This script will prompt concurrent session handling | |
// to one of the given roles | |
// If the user has any of the below roles, concurrent session handling will be prompted | |
// and it will either kill sessions or abort login based on number of active concurrent user sessions | |
var rolesToStepUp = ['admin', 'manager']; | |
var maxSessionCount = 1; | |
function onLoginRequest(context) { | |
executeStep(1, { | |
onSuccess: function (context) { | |
// Extracting authenticated subject from the first step | |
var user = context.currentKnownSubject; | |
// Checking if the user is assigned to one of the given roles | |
var hasRole = hasAnyOfTheRoles(user, rolesToStepUp); | |
if (hasRole) { | |
Log.info(user.username + ' Has one of Roles: ' + rolesToStepUp.toString()); | |
executeStep(2); | |
} | |
} | |
}); | |
} | |
// End of Concurrent-Session-Management....... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment